From ce68e3720e82c8a9d9ec6a0f581db64932bff87e Mon Sep 17 00:00:00 2001 From: crouzet Date: Tue, 16 Jul 2019 13:56:47 +0200 Subject: [PATCH] sat #17194 : parametrisation of default value for install_dir --- commands/application.py | 4 ++-- commands/clean.py | 3 ++- commands/package.py | 10 +++++++--- src/environment.py | 2 +- src/internal_config/INSTALL_BIN.template | 10 +++++----- src/internal_config/salomeTools.pyconf | 1 + src/product.py | 4 ++-- 7 files changed, 20 insertions(+), 14 deletions(-) diff --git a/commands/application.py b/commands/application.py index f700feb..92b9a0c 100644 --- a/commands/application.py +++ b/commands/application.py @@ -108,8 +108,8 @@ def create_config_file(config, modules, env_files, logger): if src.product.product_is_cpp(mm): # cpp module for aa in src.product.get_product_components(mm): - install_dir = os.path.join(config.APPLICATION.workdir, - "INSTALL") + install_dir=os.path.join(config.APPLICATION.workdir, + config.INTERNAL.config.install_dir) mp = os.path.join(install_dir, aa) flagline = add_module_to_appli(f, aa, diff --git a/commands/clean.py b/commands/clean.py index 57c2920..2577446 100644 --- a/commands/clean.py +++ b/commands/clean.py @@ -128,7 +128,8 @@ def get_generated_directories(config, products_infos): generate_dir = os.path.join(workdir, "GENERATED") source_dir = os.path.join(generate_dir, compo + "_SRC") build_dir = os.path.join(os.path.join(workdir, "BUILD"), compo) - install_dir = os.path.join(os.path.join(workdir, "INSTALL"), compo) + install_dir = os.path.join(workdir, config.INTERNAL.config.install_dir, + compo) l_dir_install.append(src.Path(source_dir)) l_dir_install.append(src.Path(build_dir)) l_dir_install.append(src.Path(install_dir)) diff --git a/commands/package.py b/commands/package.py index ec2a16c..f951028 100644 --- a/commands/package.py +++ b/commands/package.py @@ -393,7 +393,8 @@ def produce_install_bin_file(config, loop_cmd = "for f in $(grep -RIl" for key in d_sub: loop_cmd += " -e "+ key - loop_cmd += ' INSTALL); do\n sed -i "\n' + loop_cmd += ' ' + config.INTERNAL.config.install_dir +\ + '); do\n sed -i "\n' for key in d_sub: loop_cmd += " s?" + key + "?$(pwd)/" + d_sub[key] + "?g\n" loop_cmd += ' " $f\ndone' @@ -401,6 +402,7 @@ def produce_install_bin_file(config, d={} d["BINARIES_DIR"] = binaries_dir_name d["SUBSTITUTION_LOOP"]=loop_cmd + d["INSTALL_DIR"]=config.INTERNAL.config.install_dir # substitute the template and write it in file content=src.template.substitute(installbin_template_path, d) @@ -542,7 +544,8 @@ def binary_package(config, logger, options, tmp_working_dir): # cpp module for name_cpp in src.product.get_product_components(prod_info): install_dir = os.path.join(config.APPLICATION.workdir, - "INSTALL", name_cpp) + config.INTERNAL.config.install_dir, + name_cpp) if os.path.exists(install_dir): l_install_dir.append((name_cpp, install_dir)) else: @@ -1503,7 +1506,8 @@ Please add it in file: for key in d_bin_files_to_add: if key.endswith("(bin)"): source_dir = d_bin_files_to_add[key][0] - path_in_archive = d_bin_files_to_add[key][1].replace("BINARIES-" + runner.cfg.VARS.dist,"INSTALL") + path_in_archive = d_bin_files_to_add[key][1].replace("BINARIES-" +\ + runner.cfg.VARS.dist,runner.cfg.INTERNAL.config.install_dir) if os.path.basename(source_dir)==os.path.basename(path_in_archive): # if basename is the same we will just substitute the dirname d_paths_to_substitute[os.path.dirname(source_dir)]=\ diff --git a/src/environment.py b/src/environment.py index f4816e7..41ec7e5 100644 --- a/src/environment.py +++ b/src/environment.py @@ -649,7 +649,7 @@ class SalomeEnviron: source_dir_save = pi.source_dir name_save = pi.name pi.install_dir = os.path.join(self.cfg.APPLICATION.workdir, - "INSTALL", + config.INTERNAL.config.install_dir, pi.component_name) if self.for_package: pi.install_dir = os.path.join("out_dir_Path", diff --git a/src/internal_config/INSTALL_BIN.template b/src/internal_config/INSTALL_BIN.template index 936362d..eb683a8 100644 --- a/src/internal_config/INSTALL_BIN.template +++ b/src/internal_config/INSTALL_BIN.template @@ -2,9 +2,9 @@ # # This script copies BINARIES content into INSTALL, and substitute paths to enable extra compilation. # If INSTALL already exists : does nothing! -if [ -d INSTALL ] +if [ -d ¤{INSTALL_DIR} ] then - echo Warning: INSTALL already exists! Please rename or delete it before executing this script + echo Warning: ¤{INSTALL_DIR} already exists! Please rename or delete it before executing this script exit fi if [ ! -d ¤{BINARIES_DIR} ] @@ -12,9 +12,9 @@ then echo Error: ¤{BINARIES_DIR} directory not found! exit fi -mkdir INSTALL -echo copies ¤{BINARIES_DIR} into INSTALL -cp -RP ¤{BINARIES_DIR}/* INSTALL +mkdir ¤{INSTALL_DIR} +echo copies ¤{BINARIES_DIR} into ¤{INSTALL_DIR} +cp -RP ¤{BINARIES_DIR}/* ¤{INSTALL_DIR} echo does the substitutions # do the required substitutions ¤{SUBSTITUTION_LOOP} diff --git a/src/internal_config/salomeTools.pyconf b/src/internal_config/salomeTools.pyconf index 50465e9..6c678df 100644 --- a/src/internal_config/salomeTools.pyconf +++ b/src/internal_config/salomeTools.pyconf @@ -7,6 +7,7 @@ INTERNAL : config : { copy_prefix : "LOCAL_" + install_dir : "INSTALL" } log : { diff --git a/src/product.py b/src/product.py index 44d20e9..3ce700c 100644 --- a/src/product.py +++ b/src/product.py @@ -485,8 +485,8 @@ def get_install_dir(config, base, version, prod_info): if "install_dir" not in prod_info or prod_info.install_dir == "base": # Set it to the default value (in application directory) install_dir = os.path.join(config.APPLICATION.workdir, - "INSTALL", - prod_info.name) + config.INTERNAL.config.install_dir, + prod_info.name) else: install_dir = prod_info.install_dir -- 2.39.2