提交 a55bd6dd 编写于 作者: W wuzewu

Fix the bug that the module cannot be reinstalled when the local model fails to load

上级 e6d10813
......@@ -218,7 +218,7 @@ class LocalModuleManager(object):
try:
module = self._local_modules[name] = HubModule.load(module_dir)
except:
utils.record_exception('An error was encountered while loading {}.'.format(name))
utils.record_exception('An error was encountered while loading {}'.format(name))
if not module:
return None
......@@ -238,7 +238,7 @@ class LocalModuleManager(object):
try:
self._local_modules[subdir] = HubModule.load(fulldir)
except:
utils.record_exception('An error was encountered while loading {}.'.format(subdir))
utils.record_exception('An error was encountered while loading {}'.format(subdir))
return [module for module in self._local_modules.values()]
......@@ -339,7 +339,7 @@ class LocalModuleManager(object):
hub_module_cls = HubModule.load(directory)
# Uninstall local module
if self.search(hub_module_cls.name):
if os.path.exists(self._get_normalized_path(hub_module_cls.name)):
self.uninstall(hub_module_cls.name)
shutil.copytree(directory, self._get_normalized_path(hub_module_cls.name))
......
......@@ -61,7 +61,7 @@ class GitSource(object):
# reload modules
self.load_hub_modules()
except:
utils.record_exception('An error occurred while checkout {}.'.format(self.path))
utils.record_exception('An error occurred while checkout {}'.format(self.path))
def update(self):
'''Update the current repo.'''
......@@ -71,7 +71,7 @@ class GitSource(object):
self.load_hub_modules()
except:
self.hub_modules = OrderedDict()
utils.record_exception('An error occurred while update {}.'.format(self.path))
utils.record_exception('An error occurred while update {}'.format(self.path))
def load_hub_modules(self):
if 'hubconf' in sys.modules:
......@@ -86,7 +86,7 @@ class GitSource(object):
self.hub_modules[_item.name] = _item
except:
self.hub_modules = OrderedDict()
utils.record_exception('An error occurred while loading {}.'.format(self.path))
utils.record_exception('An error occurred while loading {}'.format(self.path))
sys.path.remove(self.path)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册