From a2651f7fb1a647587b3cf7f9e99d4fc2958eceb8 Mon Sep 17 00:00:00 2001 From: a1012112796 <1012112796@qq.com> Date: Wed, 8 Sep 2021 10:01:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dgit=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E8=A2=AB=E5=88=A0=E9=99=A4=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: a1012112796 <1012112796@qq.com> --- sharelib.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) 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 == '':