From beffff03411f758a5ad139b9beee248e3a105573 Mon Sep 17 00:00:00 2001 From: crouzet Date: Wed, 10 Jun 2020 14:38:56 +0200 Subject: [PATCH] sat #19234 : remove build products from bin archives, and better management of their environment --- commands/package.py | 14 ++++++++------ src/environment.py | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/commands/package.py b/commands/package.py index d235fb9..60d10fb 100644 --- a/commands/package.py +++ b/commands/package.py @@ -1363,7 +1363,7 @@ The procedure to do it is: return readme_path -def update_config(config, prop, value): +def update_config(config, logger, prop, value): '''Remove from config.APPLICATION.products the products that have the property given as input. :param config Config: The global config. @@ -1379,6 +1379,7 @@ def update_config(config, prop, value): l_product_to_remove.append(product_name) for product_name in l_product_to_remove: config.APPLICATION.products.__delitem__(product_name) + logger.write("Remove product %s with property %s\n" % (product_name, prop), 5) def description(): '''method that is called when salomeTools is called with --help option. @@ -1469,14 +1470,15 @@ Please add it in file: # Remove the products that are filtered by the --without_properties option if options.without_properties: - app = runner.cfg.APPLICATION - logger.trace("without_properties all products:\n %s\n" % PP.pformat(sorted(app.products.keys()))) prop, value = options.without_properties - update_config(runner.cfg, prop, value) - logger.warning("without_properties selected products:\n %s\n" % PP.pformat(sorted(app.products.keys()))) + update_config(runner.cfg, logger, prop, value) # Remove from config the products that have the not_in_package property - update_config(runner.cfg, "not_in_package", "yes") + update_config(runner.cfg, logger, "not_in_package", "yes") + + # for binary packages without sources, remove compile time products + if options.binaries and (not options.sources): + update_config(runner.cfg, logger, "compile_time", "yes") # get the name of the archive or build it if options.name: diff --git a/src/environment.py b/src/environment.py index c8585e2..d76466b 100644 --- a/src/environment.py +++ b/src/environment.py @@ -246,6 +246,14 @@ class SalomeEnviron: sorted_nodes) self.sorted_product_list=sorted_nodes + # store the list of compile time products + # they should be added in build env + compile_time_products=[] + for (pname,pinfo) in all_products_infos: + if src.product.product_is_compile_time(pinfo): + compile_time_products.append(pname) + self.compile_time_products=compile_time_products + def append(self, key, value, sep=os.pathsep): """\ @@ -754,6 +762,11 @@ class SalomeEnviron: self.set_a_product("Python", logger) self.set_python_libdirs() + # for a build environment, add compile time products (like cmake) + if self.forBuild : + for product in self.compile_time_products: + self.set_a_product(product, logger) + # The loop on the products for product in self.sorted_product_list: if product == "Python": @@ -784,6 +797,11 @@ class SalomeEnviron: self.set_a_product("Python", logger) self.set_python_libdirs() + # for a build environment, add compile time products (like cmake) + if self.forBuild : + for product in self.compile_time_products: + self.set_a_product(product, logger) + # set products for product in sorted_product_list: if product == "Python": -- 2.39.2