From 7396f2985f9c8830ccc8d7b339590feacb3fedd5 Mon Sep 17 00:00:00 2001 From: Thomas Applencourt Date: Tue, 2 Jun 2015 15:47:24 +0200 Subject: [PATCH] Modify some file --- ocaml/Makefile | 8 ++- scripts/compilation/cache_compile.py | 5 -- scripts/module/module_handler.py | 86 ++++++++++++++++------------ src/Pseudo/NEEDED_CHILDREN_MODULES | 2 +- src/Pseudo/README.rst | 2 +- 5 files changed, 57 insertions(+), 46 deletions(-) diff --git a/ocaml/Makefile b/ocaml/Makefile index ce932bfc..0fb064ad 100644 --- a/ocaml/Makefile +++ b/ocaml/Makefile @@ -13,7 +13,7 @@ LIBS= PKGS= OCAMLCFLAGS="-g -warn-error A" OCAMLBUILD=ocamlbuild -j 0 -syntax camlp4o -cflags $(OCAMLCFLAGS) -lflags $(OCAMLCFLAGS) -MLFILES=$(wildcard *.ml) ezfio.ml Qptypes.ml +MLFILES=$(wildcard *.ml) ezfio.ml Qptypes.ml Input_auto_generated.ml MLIFILES=$(wildcard *.mli) ALL_TESTS=$(patsubst %.ml,%.byte,$(wildcard test_*.ml)) ALL_EXE=$(patsubst %.ml,%.native,$(wildcard qp_*.ml)) @@ -74,5 +74,9 @@ Qptypes.ml: qptypes_generator.byte ${QPACKAGE_ROOT}/EZFIO/Ocaml/ezfio.ml: $(MAKE) -C ${QPACKAGE_ROOT}/src ezfio +Input_auto_generated.ml: + ei_handler.py ocaml_global + clean: - rm -rf _build Qptypes.ml $(ALL_EXE) $(ALL_TESTS) + rm -rf _build Qptypes.ml Input_auto_generated.ml $(ALL_EXE) $(ALL_TESTS) + diff --git a/scripts/compilation/cache_compile.py b/scripts/compilation/cache_compile.py index 3c2d9b9d..d6aac8be 100755 --- a/scripts/compilation/cache_compile.py +++ b/scripts/compilation/cache_compile.py @@ -59,7 +59,6 @@ def run_and_save_the_data(command, path_output, path_key, is_mod): elif not is_mod: try: shutil.copyfile(path_output, path_key) - print "save" except: pass @@ -89,9 +88,6 @@ def cache_utility(command): key = get_hash_key(command, input_data) path_key = os.path.join(TMPDIR, key) - print key - print path_key - # Try to return the content of the .o file try: shutil.copyfile(path_key, path_output) @@ -110,4 +106,3 @@ if __name__ == '__main__': cache_utility(command) except: process = subprocess.Popen(command, shell=True) -# os.execvpe(command.split()[0],command.split(),os.environ) diff --git a/scripts/module/module_handler.py b/scripts/module/module_handler.py index 9def0a5d..fc38a6e5 100755 --- a/scripts/module/module_handler.py +++ b/scripts/module/module_handler.py @@ -93,6 +93,53 @@ def him_and_all_children(d_ref, l_module): return list(set(l)) +def get_dict_genealogy_desc(): + """ + Get a dic of all the genealogy desc (children and all_children) + """ + d_ref = get_dict_genealogy() + + d = {} + + for module_name in d_ref: + d[module_name] = him_and_all_children(d_ref, d_ref[module_name].l_children) + + return d + + +def get_dict_parent(): + """ + Get a dic of the first parent + """ + d_ref = get_dict_genealogy() + + d = {} + + for module_name in d_ref: + d[module_name] = [i for i in d_ref.keys() if module_name in d_ref[i].l_children] + + return d + + +def get_dict_module_boss(): + """ + Return a dict(module_name) = module_boss + Module boss is a module who have not parent (a edge) and have module_name + in is genealogy + """ + d_ref_asc = get_dict_parent() + d_ref_desc = get_dict_genealogy_desc() + + l_all_module = d_ref_asc.keys() + + d_module_boss = {} + + for module in l_all_module: + d_module_boss[module] = [p for p in l_all_module if module in [p] + d_ref_desc[p] and not d_ref_asc[p]][0] + + return d_module_boss + + def module_genealogy(module_name): """ Take a name of a NEEDED_CHILDREN_MODULES @@ -188,40 +235,5 @@ if __name__ == '__main__': create_png_from_path(path_file) if arguments["head_module"]: - d_ref = get_dict_genealogy() - l_all_module = d_ref.keys() - - from itertools import combinations - - print "len_ref", len(l_all_module) - l_head = [] - # All the head module alredy discover - - l_head_and_genealogy = [] - - # All the children of l_head - l_check = [i for i in l_all_module if i not in l_head_and_genealogy] - - while l_check: - len_max = -1 - head = None - - # Find the module in l_check who have the most direct children - # not alredy find - # We do not use the all genealogy for saving few second - for i in l_check: - l_module_and_children = [i] + d_ref[i].l_children - - l_missing_module = [l for l in l_module_and_children if l not in l_head_and_genealogy] - - if len(l_missing_module) > len_max: - len_max = len(l_missing_module) - head = i - # Now add all the genealogy and remove duplicate - l_head_and_genealogy = list(set(l_head_and_genealogy + him_and_all_children(d_ref, [head]))) - # Now only search in the missing module - l_check = [i for i in l_all_module if i not in l_head_and_genealogy] - - l_head.append(head) - - print "l_head", l_head \ No newline at end of file + for module, boss in get_dict_module_boss().iteritems(): + print module, boss diff --git a/src/Pseudo/NEEDED_CHILDREN_MODULES b/src/Pseudo/NEEDED_CHILDREN_MODULES index d9eaf57c..e1bf5e8b 100644 --- a/src/Pseudo/NEEDED_CHILDREN_MODULES +++ b/src/Pseudo/NEEDED_CHILDREN_MODULES @@ -1 +1 @@ -Ezfio_files +Nuclei \ No newline at end of file diff --git a/src/Pseudo/README.rst b/src/Pseudo/README.rst index 798c9712..f27d7c20 100644 --- a/src/Pseudo/README.rst +++ b/src/Pseudo/README.rst @@ -18,5 +18,5 @@ Needed Modules .. image:: tree_dependancy.png -* `Ezfio_files `_ +* `Nuclei `_