From: Serge Rehbinder Date: Tue, 29 Nov 2016 10:25:45 +0000 (+0100) Subject: Add native environment for products X-Git-Tag: 5.0.0a1~38^2~52 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f7deb9bb641eef1f8ad8930ec6b39ded6c9e9359;p=tools%2Fsat.git Add native environment for products --- diff --git a/src/environment.py b/src/environment.py index 597a46b..f74d761 100644 --- a/src/environment.py +++ b/src/environment.py @@ -528,17 +528,19 @@ class SalomeEnviron: pi.install_dir = os.path.join("out_dir_Path", self.for_package, pi.name) - - # Do not define environment if the product is native - if src.product.product_is_native(pi): - return - + if not self.silent: logger.write(_("Setting environment for %s\n") % product, 4) self.add_line(1) self.add_comment('setting environ for ' + product) - + + # Do not define environment if the product is native + if src.product.product_is_native(pi): + if src.product.product_has_env_script(pi): + self.run_env_script(pi, native=True) + return + # Set an additional environment for SALOME products if src.product.product_is_salome(pi): # set environment using definition of the product @@ -586,11 +588,12 @@ class SalomeEnviron: - def run_env_script(self, product_info, logger=None): + def run_env_script(self, product_info, logger=None, native=False): """Runs an environment script. :param product_info Config: The product description :param logger Logger: The logger instance to display messages + :param native Boolean: if True load set_native_env instead of set_env """ env_script = product_info.environ.env_script # Check that the script exists @@ -606,8 +609,13 @@ class SalomeEnviron: import imp pyproduct = imp.load_source(product_info.name + "_env_script", env_script) - pyproduct.set_env(self, product_info.install_dir, - product_info.version) + if not native: + pyproduct.set_env(self, + product_info.install_dir, + product_info.version) + else: + if "set_nativ_env" in dir(pyproduct): + pyproduct.set_nativ_env(self) except: __, exceptionValue, exceptionTraceback = sys.exc_info() print(exceptionValue)