From: rnv Date: Mon, 3 Feb 2020 15:49:17 +0000 (+0300) Subject: Some modifications with python configuration. X-Git-Tag: V9_5_0a1~10 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8ed0d6bab8003feae0e6e61c2b38b89833f6a8c4;p=modules%2Fkernel.git Some modifications with python configuration. --- diff --git a/bin/appli_gen.py b/bin/appli_gen.py index 15648eb90..2e493d613 100755 --- a/bin/appli_gen.py +++ b/bin/appli_gen.py @@ -53,11 +53,13 @@ extra_test_tag = "extra_test" resources_tag = "resources" env_modules_tag = "env_modules" env_module_tag = "env_module" +python_tag = "python" # --- names of attributes in XML configuration file nam_att = "name" path_att = "path" gui_att = "gui" +version_att = "version" # ----------------------------------------------------------------------------- @@ -101,6 +103,10 @@ class xml_parser: if self.space == [appli_tag, sha1_collect_tag] and path_att in attrs.getNames(): self.config["sha1_collect_path"] = attrs.getValue( path_att ) pass + # --- if we are analyzing "python" element then store its "version" attribute + if self.space == [appli_tag, python_tag] and version_att in attrs.getNames(): + self.config["python_version"] = attrs.getValue( version_att ) + pass # --- if we are analyzing "system_conf" element then store its "path" attribute if self.space == [appli_tag, system_conf_tag] and path_att in attrs.getNames(): self.config["system_conf_path"] = attrs.getValue( path_att ) @@ -324,9 +330,13 @@ def install(prefix, config_file, verbose=0): pass # Create environment file: configSalome.sh - - cmd='source %s && python3 -c "import sys ; sys.stdout.write(\\"{}.{}\\".format(sys.version_info.major,sys.version_info.minor))"' %(_config["prereq_path"]) - versionPython=subprocess.check_output(['/bin/bash', '-l' ,'-c',cmd]).decode("utf-8") + + if "python_version" in _config: + versionPython_split = _config["python_version"].split('.') + versionPython = versionPython_split[0] + "." + versionPython_split[1] + else: + cmd='source %s && python3 -c "import sys ; sys.stdout.write(\\"{}.{}\\".format(sys.version_info.major,sys.version_info.minor))"' %(_config["prereq_path"]) + versionPython=subprocess.check_output(['/bin/bash', '-l' ,'-c',cmd]).decode("utf-8") with open(os.path.join(home_dir, 'env.d', 'configSalome.sh'),'w') as f: for module in _config.get("modules", []):