diff --git a/sharelib.py b/sharelib.py index 3f76775..da68285 100644 --- a/sharelib.py +++ b/sharelib.py @@ -177,12 +177,24 @@ class SharelibHandler: finit_cpp.close() def export(self, share_lib_path): + reserved_subdir = ['.git', + 'README.md', '.gitignore', '.gitmodules', '.gitattributes', + '.drone.yml'] + dist_path = share_lib_path + '/' + self._lib_name if os.path.exists(dist_path): - shutil.rmtree(dist_path) + for d in os.listdir(dist_path): + if d in reserved_subdir: + continue + + pth = os.path.join(dist_path, d) + if os.path.isfile(pth): + os.remove(pth) + continue + + shutil.rmtree(pth) print("dist_path: " + dist_path) - os.makedirs(dist_path) for item in self._items: if item._group == '':