X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2Fenvironment.py;h=62943389339565b15113bf4f9259be26f1db232f;hb=b290bea918ae017dde95805abe898e5e6bd08f69;hp=fd94a36196bae716cd2d8df3ce54ac9524ded6e8;hpb=1a8b87eb729318ecf6938580b246657b4567c041;p=tools%2Fsat.git diff --git a/src/environment.py b/src/environment.py index fd94a36..6294338 100644 --- a/src/environment.py +++ b/src/environment.py @@ -54,10 +54,15 @@ class Environ: :return: the replaced variable :rtype: str """ - if "$" in value: + if src.architecture.is_windows(): + delim = "%" + else: + delim = "$" + if delim in value: # The string.Template class is a string class # for supporting $-substitutions zt = string.Template(value) + zt.delimiter = delim try: value = zt.substitute(self.environ) except KeyError as exc: @@ -241,6 +246,15 @@ 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) or\ + src.product.product_is_compile_and_runtime(pinfo) : + compile_time_products.append(pname) + self.compile_time_products=compile_time_products + def append(self, key, value, sep=os.pathsep): """\ @@ -375,7 +389,11 @@ class SalomeEnviron: """ if self.for_package: - self.set("PRODUCT_ROOT_DIR", "out_dir_Path") + if src.architecture.is_windows(): + self.set("PRODUCT_ROOT_DIR", "%out_dir_Path%") + else: + self.set("PRODUCT_ROOT_DIR", "out_dir_Path") + else: self.cfg.APPLICATION.environ.PRODUCT_ROOT_DIR = src.pyconf.Reference(self.cfg, src.pyconf.DOLLAR, "workdir") @@ -383,7 +401,8 @@ class SalomeEnviron: self.add_line(1) self.add_comment("reset these sensitive variables to avoid bad environment interactions") self.add_comment("comment these to lines if you wish a different behaviour") - self.set("LD_LIBRARY_PATH", "") + if not src.architecture.is_windows(): + self.set("LD_LIBRARY_PATH", "") self.set("PYTHONPATH", "") self.add_line(1) @@ -447,7 +466,6 @@ class SalomeEnviron: # Construct XXX_ROOT_DIR env_root_dir = self.get(pi.name + "_ROOT_DIR") l_binpath_libpath = [] - # create additional ROOT_DIR for CPP components if 'component_name' in pi: compo_name = pi.component_name @@ -573,7 +591,6 @@ class SalomeEnviron: # Get the informations corresponding to the product pi = src.product.get_product_config(self.cfg, product) - # skip compile time products at run time if not self.forBuild: if src.product.product_is_compile_time(pi): @@ -600,10 +617,14 @@ class SalomeEnviron: if self.for_package: + prod_base_name=os.path.basename(pi.install_dir) + if prod_base_name.startswith("config"): + # case of a products installed in base. We remove "config-i" + prod_base_name=os.path.basename(os.path.dirname(pi.install_dir)) pi.install_dir = os.path.join( "out_dir_Path", self.for_package, - os.path.basename(pi.install_dir)) + prod_base_name) if not self.silent: logger.write(_("Setting environment for %s\n") % product, 4) @@ -742,10 +763,19 @@ 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: + if product == "Python": + continue + self.set_a_product(product, logger) + # The loop on the products for product in self.sorted_product_list: if product == "Python": continue + if self.forBuild and product in self.compile_time_products: + continue self.set_a_product(product, logger) def set_full_environ(self, logger, env_info): @@ -758,7 +788,6 @@ class SalomeEnviron: """ DBG.write("set_full_environ for", env_info) # DBG.write("set_full_environ config", self.cfg.APPLICATION.environ, True) - # set product environ self.set_application_env(logger) @@ -773,10 +802,19 @@ 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: + if product == "Python": + continue + self.set_a_product(product, logger) + # set products for product in sorted_product_list: if product == "Python": continue + if self.forBuild and product in self.compile_time_products: + continue self.set_a_product(product, logger) class FileEnvWriter: @@ -908,7 +946,6 @@ class FileEnvWriter: if not self.silent: self.logger.write(_("Create environment file %s\n") % src.printcolors.printcLabel(filename), 3) - # create then env object env_file = open(os.path.join(self.out_dir, filename), "w") @@ -936,11 +973,9 @@ class FileEnvWriter: else: # set env from the APPLICATION env.set_application_env(self.logger) - # set the products env.set_products(self.logger, src_root=self.src_root) - # Add the additional environment if it is not empty if len(additional_env) != 0: env.add_line(1)