提交 9ddf71ca 编写于 作者: W wuzewu

Fix ModuleV1 info bug

上级 359c4e69
......@@ -180,6 +180,14 @@ class ModuleV1(object):
@classmethod
def load(cls, directory: str) -> EasyDict:
module_info = cls.load_module_info(directory)
# Generate a uuid based on the class information, and dynamically create a new type.
# If we do not do this, the information generated later will overwrite the information
# previously generated.
cls_uuid = utils.md5(module_info.name + module_info.author + module_info.author_email + module_info.type +
module_info.summary + module_info.version + directory)
cls = type(cls_uuid, (cls, ), {})
cls.name = module_info.name
cls.author = module_info.author
cls.author_email = module_info.author_email
......
......@@ -234,7 +234,11 @@ class LocalModuleManager(object):
'''List all installed HubModule.'''
for subdir in os.listdir(self.home):
fulldir = os.path.join(self.home, subdir)
self._local_modules[subdir] = HubModule.load(fulldir)
try:
self._local_modules[subdir] = HubModule.load(fulldir)
except:
log.logger.warning('An error was encountered while loading {}'.format(subdir))
return [module for module in self._local_modules.values()]
def _install_from_url(self, url: str) -> HubModule:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册