提交 63c8dc20 编写于 作者: K kinghuin 提交者: wuzewu

fix install bug (#312)

上级 11a25c91
...@@ -168,8 +168,7 @@ class LocalModuleManager(object): ...@@ -168,8 +168,7 @@ class LocalModuleManager(object):
with tarfile.open(module_package, "r:gz") as tar: with tarfile.open(module_package, "r:gz") as tar:
file_names = tar.getnames() file_names = tar.getnames()
size = len(file_names) - 1 size = len(file_names) - 1
module_dir = os.path.split(file_names[0])[0] module_dir = os.path.join(_dir, file_names[0])
module_dir = os.path.join(_dir, module_dir)
for index, file_name in enumerate(file_names): for index, file_name in enumerate(file_names):
tar.extract(file_name, _dir) tar.extract(file_name, _dir)
...@@ -195,7 +194,7 @@ class LocalModuleManager(object): ...@@ -195,7 +194,7 @@ class LocalModuleManager(object):
save_path = os.path.join(MODULE_HOME, module_name) save_path = os.path.join(MODULE_HOME, module_name)
if os.path.exists(save_path): if os.path.exists(save_path):
shutil.move(save_path) shutil.rmtree(save_path)
if from_user_dir: if from_user_dir:
shutil.copytree(module_dir, save_path) shutil.copytree(module_dir, save_path)
else: else:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册