From f49b5b792c25196df0ee8fdcd66239496a73c55c Mon Sep 17 00:00:00 2001 From: crouzet Date: Tue, 23 Jun 2020 12:28:32 +0200 Subject: [PATCH] =?utf8?q?ordre=20de=20compilation=20:=20g=C3=A9n=C3=A9ral?= =?utf8?q?isation=20du=20traitement=20particulier=20de=20Python=20au=20pro?= =?utf8?q?duits=20ayant=20la=20propri=C3=A9t=C3=A9=20compile=5Fand=5Frunti?= =?utf8?q?me?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- commands/compile.py | 23 +++++++++++++---------- src/product.py | 13 +++++++++++++ 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/commands/compile.py b/commands/compile.py index 6c4a53b..87e5359 100644 --- a/commands/compile.py +++ b/commands/compile.py @@ -734,21 +734,24 @@ def run(args, runner, logger): # Use the sorted list of all products to sort the list of products we have to compile sorted_product_list=[] - sorted_product_list_runtime=[] - # python has no dependencies. it is sometimes required by compile time products. - #it's simplier to always compile python first! - if "Python" in products_list: - sorted_product_list.append("Python") - sorted_nodes.remove("Python") + product_list_runtime=[] + product_list_compiletime=[] + product_list_compile_and_runtime=[] # store at beginning compile time products, we need to compile them before! for n in sorted_nodes: if n in products_list: - if src.product.product_is_compile_time(all_products_dict[n][1]): - sorted_product_list.append(n) + if src.product.product_is_compile_and_runtime(all_products_dict[n][1]): + # these products (python/graphviz) are used at compile and run time + # they have no dependencies. + # we always compile them in the first place + product_list_compile_and_runtime.append(n) else: - sorted_product_list_runtime.append(n) - sorted_product_list+=sorted_product_list_runtime + if src.product.product_is_compile_time(all_products_dict[n][1]): + product_list_compiletime.append(n) + else: + product_list_runtime.append(n) + sorted_product_list = product_list_compile_and_runtime + product_list_compiletime + product_list_runtime logger.write("Sorted list of products to compile : %s\n" % sorted_product_list, 5) # from the sorted list of products to compile, build a sorted list of products infos diff --git a/src/product.py b/src/product.py index 32af959..e0bc087 100644 --- a/src/product.py +++ b/src/product.py @@ -1174,6 +1174,19 @@ def product_is_compile_time(product_info): "compile_time" in product_info.properties and product_info.properties.compile_time == "yes") +def product_is_compile_and_runtime(product_info): + """Know if a product is only used at compile time + + :param product_info Config: The configuration specific to + the product + :return: True if the product is only used at compile time + :rtype: boolean + """ + return ("properties" in product_info and + "compile_and_runtime" in product_info.properties and + product_info.properties.compile_and_runtime == "yes") + + def product_test_property(product_info, property_name, property_value): """Generic function to test if a product has a property set to a value -- 2.39.2