diff --git a/scripts/compilation/qp_create_ninja.py b/scripts/compilation/qp_create_ninja.py index a3e8aa00..fd4d6a10 100755 --- a/scripts/compilation/qp_create_ninja.py +++ b/scripts/compilation/qp_create_ninja.py @@ -760,7 +760,7 @@ def create_build_ninja_module(path_module): f.write("\n".join(l_string)) -def create_build_ninja_global(l_module): +def create_build_ninja_global(): l_string = ["rule update_build_ninja_root", " command = {0} update".format(__file__), @@ -772,7 +772,7 @@ def create_build_ninja_global(l_module): ""] l_string += ["rule make_clean", - " command = module_handler.py clean {0}".format(" ".join([m.rel for m in l_module])), + " command = module_handler.py clean --all", " description = Cleaning all modules", ""] l_string += ["build dummy_target: update_build_ninja_root", @@ -892,7 +892,7 @@ if __name__ == "__main__": l_string += ninja_dot_tree_build(module, l_all_module) l_string += ninja_readme_build(module, d_irp, dict_root_path) - create_build_ninja_global(l_module) + create_build_ninja_global() for module_to_compile in l_module: diff --git a/scripts/module/module_handler.py b/scripts/module/module_handler.py index 3043a025..389d8c47 100755 --- a/scripts/module/module_handler.py +++ b/scripts/module/module_handler.py @@ -6,7 +6,7 @@ Module utilitary Usage: module_handler.py print_descendant [...] module_handler.py create_png [...] - module_handler.py clean [...] + module_handler.py clean [ --all | ...] module_handler.py create_git_ignore [...] Options: @@ -31,8 +31,7 @@ except ImportError: # Canot cache for namedtuple are not hashable def is_module(path_module): - return os.path.isfile(os.path.join(QP_SRC, - path_module, + return os.path.isfile(os.path.join(QP_SRC, path_module, "NEEDED_CHILDREN_MODULES")) @@ -91,7 +90,6 @@ def get_l_module_descendant(d_child, l_module): class ModuleHandler(): - def __init__(self, l_root_abs=None): self.dict_child = get_dict_child(l_root_abs) @@ -109,7 +107,8 @@ class ModuleHandler(): d = {} for module_name in d_child: - d[module_name] = [i for i in d_child.keys() if module_name in d_child[i]] + d[module_name] = [i for i in d_child.keys() + if module_name in d_child[i]] return d @@ -123,11 +122,12 @@ class ModuleHandler(): d_child = self.dict_child for module_name in d_child: - try : + try: d[module_name] = get_l_module_descendant(d_child, d_child[module_name]) except KeyError: - print "Check NEEDED_CHILDREN_MODULES for {0}".format(module_name) + print "Check NEEDED_CHILDREN_MODULES for {0}".format( + module_name) sys.exit(1) return d @@ -146,7 +146,9 @@ class ModuleHandler(): dict_root = {} for module in l_all_module: - dict_root[module] = [ p for p in l_all_module if module in [p] + d_desc[p] and not d_asc[p]][0] + dict_root[module] = [p for p in l_all_module + if module in [p] + d_desc[p] and not d_asc[p] + ][0] return dict_root @@ -211,7 +213,11 @@ if __name__ == '__main__': arguments = docopt(__doc__) - if not arguments['']: + if arguments['--all']: + l_module = [f for f in os.listdir(QP_SRC) + if os.path.isdir(os.path.join(QP_SRC, f))] + + elif not arguments['']: dir_ = os.getcwd() l_module = [os.path.basename(dir_)] else: @@ -236,14 +242,15 @@ if __name__ == '__main__': if arguments["clean"] or arguments["create_git_ignore"]: l_dir = ['IRPF90_temp', 'IRPF90_man'] - l_file = ["irpf90_entities", "tags", "irpf90.make", - "Makefile", "Makefile.depend", ".ninja_log", ".ninja_deps", + l_file = ["irpf90_entities", "tags", "irpf90.make", "Makefile", + "Makefile.depend", ".ninja_log", ".ninja_deps", "ezfio_interface.irp.f"] for module in l_module: module_abs = os.path.realpath(os.path.join(QP_SRC, module)) l_symlink = m.l_descendant_unique([module]) - l_exe = [f for f in os.listdir(module_abs) if is_exe(os.path.join(module_abs,f))] + l_exe = [f for f in os.listdir(module_abs) + if is_exe(os.path.join(module_abs, f))] if arguments["clean"]: for f in l_dir: diff --git a/scripts/module/qp_install_module.py b/scripts/module/qp_install_module.py index 2cad51a9..235f9db6 100755 --- a/scripts/module/qp_install_module.py +++ b/scripts/module/qp_install_module.py @@ -80,7 +80,9 @@ if __name__ == '__main__': l_children = arguments[""] - path = os.path.join(QP_PLUGINS, arguments[""][0]) + name = arguments[""][0] + + path = os.path.join(QP_PLUGINS, name) print "You will create the module:" print path @@ -102,9 +104,13 @@ if __name__ == '__main__': print "This can be reduce to:" l_child_reduce = m_instance.l_reduce_tree(l_children) print l_child_reduce + print "Installation", save_new_module(path, l_child_reduce) - print "This was a plugin, you can install it now" + print " [ OK ]" + print "If this was a plugins, you can install it normaly. Type:" + print "` {0} install {1} `".format(os.path.basename(__file__), name) + elif arguments["download"]: pass # d_local = get_dict_child([QP_SRC])