提交 82c4f6e9 编写于 作者: W wuzewu

update module create func

上级 7715f42e
...@@ -82,12 +82,8 @@ def create_module(directory, name, author, email, module_type, summary, ...@@ -82,12 +82,8 @@ def create_module(directory, name, author, email, module_type, summary,
checker.generate_check_info() checker.generate_check_info()
# add __init__ # add __init__
module_init_1 = os.path.join(directory, "__init__.py") module_init = os.path.join(directory, "__init__.py")
with open(module_init_1, "a") as file: with open(module_init, "a") as file:
file.write("")
module_init_2 = os.path.join(directory, "python", "__init__.py")
with open(module_init_2, "a") as file:
file.write("") file.write("")
# package the module # package the module
...@@ -98,8 +94,7 @@ def create_module(directory, name, author, email, module_type, summary, ...@@ -98,8 +94,7 @@ def create_module(directory, name, author, email, module_type, summary,
os.remove(module_desc_path) os.remove(module_desc_path)
os.remove(checker.pb_path) os.remove(checker.pb_path)
os.remove(module_init_1) os.remove(module_init)
os.remove(module_init_2)
_module_runable_func = {} _module_runable_func = {}
...@@ -209,9 +204,8 @@ class Module(object): ...@@ -209,9 +204,8 @@ class Module(object):
basename = os.path.split(directory)[-1] basename = os.path.split(directory)[-1]
dirname = os.path.join(*list(os.path.split(directory)[:-1])) dirname = os.path.join(*list(os.path.split(directory)[:-1]))
sys.path.append(dirname) sys.path.append(dirname)
pymodule = importlib.import_module( user_module = importlib.import_module("{}.module".format(basename))
"{}.python.module".format(basename)) return user_module.HubModule(directory=directory)
return pymodule.HubModule(directory=directory)
return ModuleV1(directory=directory) return ModuleV1(directory=directory)
@property @property
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册