提交 cc67c35c 编写于 作者: B BinLong

fix codestyle errors

上级 940b6457
...@@ -46,7 +46,8 @@ class LocalModuleManager(object): ...@@ -46,7 +46,8 @@ class LocalModuleManager(object):
desc = module_desc_pb2.ModuleDesc() desc = module_desc_pb2.ModuleDesc()
with open(desc_pb_path, "rb") as fp: with open(desc_pb_path, "rb") as fp:
desc.ParseFromString(fp.read()) desc.ParseFromString(fp.read())
info['version'] = desc.attr.map.data["module_info"].map.data["version"].s info['version'] = desc.attr.map.data["module_info"].map.data[
"version"].s
except: except:
return False, None return False, None
return True, info return True, info
...@@ -62,7 +63,8 @@ class LocalModuleManager(object): ...@@ -62,7 +63,8 @@ class LocalModuleManager(object):
valid, info = self.check_module_valid(sub_dir_path) valid, info = self.check_module_valid(sub_dir_path)
if valid: if valid:
module_name = sub_dir_name module_name = sub_dir_name
self.modules_dict[module_name] = (sub_dir_path, info['version']) self.modules_dict[module_name] = (sub_dir_path,
info['version'])
return self.modules_dict return self.modules_dict
def search_module(self, module_name, module_version=None, update=False): def search_module(self, module_name, module_version=None, update=False):
...@@ -73,7 +75,8 @@ class LocalModuleManager(object): ...@@ -73,7 +75,8 @@ class LocalModuleManager(object):
self.all_modules(update=True) self.all_modules(update=True)
module_info = self.modules_dict.get(module_name, None) module_info = self.modules_dict.get(module_name, None)
if module_info: if module_info:
if not module_version or module_version == self.modules_dict[module_name][1]: if not module_version or module_version == self.modules_dict[
module_name][1]:
module_dir = self.modules_dict[module_name][0] module_dir = self.modules_dict[module_name][0]
module_tag = module_name if not module_version else '%s-%s' % ( module_tag = module_name if not module_version else '%s-%s' % (
module_name, module_version) module_name, module_version)
...@@ -87,8 +90,8 @@ class LocalModuleManager(object): ...@@ -87,8 +90,8 @@ class LocalModuleManager(object):
md5_value = search_result.get('md5', None) md5_value = search_result.get('md5', None)
installed_module_version = search_result.get('version', None) installed_module_version = search_result.get('version', None)
#TODO(wuzewu): add compatibility check #TODO(wuzewu): add compatibility check
if not url or (module_version is not None and if not url or (module_version is not None
installed_module_version != module_version): and installed_module_version != module_version):
tips = "Can't find module %s" % module_name tips = "Can't find module %s" % module_name
if module_version: if module_version:
tips += " with version %s" % module_version tips += " with version %s" % module_version
...@@ -124,7 +127,8 @@ class LocalModuleManager(object): ...@@ -124,7 +127,8 @@ class LocalModuleManager(object):
if not module_name in self.modules_dict: if not module_name in self.modules_dict:
tips = "%s is not installed" % module_name tips = "%s is not installed" % module_name
return True, tips return True, tips
if module_version and module_version != self.modules_dict[module_name][1]: if module_version and module_version != self.modules_dict[module_name][
1]:
tips = "%s-%s is not installed" % (module_name, module_version) tips = "%s-%s is not installed" % (module_name, module_version)
return True, tips return True, tips
tips = "Successfully uninstalled %s" % module_name tips = "Successfully uninstalled %s" % module_name
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册