MACHINEPATH : $project_path + "machines/"
"""
-SITE_TEMPLATE = ("""#!/usr/bin/env python
+LOCAL_TEMPLATE = ("""#!/usr/bin/env python
#-*- coding:utf-8 -*-
-SITE :
-{
- log :
- {
- log_dir : $USER.workdir + "/LOGS"
- }
-}
+ LOCAL :
+ {
+ base : 'unknown'
+ workdir : 'unknown'
+ log_dir : 'unknown'
+ VCS : None
+ tag : None
+ }
PROJECTS :
{
# Little hack to put out_dir_Path outside the strings
src.replace_in_file(filepath, 'r"out_dir_Path', 'out_dir_Path + r"' )
+ # A hack to put a call to a file for distene licence.
+ # It does nothing to an application that has no distene product
+ hack_for_distene_licence(filepath)
+
# change the rights in order to make the file executable for everybody
os.chmod(filepath,
stat.S_IRUSR |
return filepath
+def hack_for_distene_licence(filepath):
+ '''Replace the distene licence env variable by a call to a file.
+
+ :param filepath Str: The path to the launcher to modify.
+ '''
+ shutil.move(filepath, filepath + "_old")
+ fileout= filepath
+ filein = filepath + "_old"
+ fin = open(filein, "r")
+ fout = open(fileout, "w")
+ text = fin.readlines()
+ # Find the Distene section
+ num_line = -1
+ for i,line in enumerate(text):
+ if "# Set DISTENE License" in line:
+ num_line = i
+ break
+ if num_line == -1:
+ # No distene product, there is nothing to do
+ fin.close()
+ for line in text:
+ fout.write(line)
+ fout.close()
+ return
+ del text[num_line +1]
+ del text[num_line +1]
+ text_to_insert =""" import imp
+ try:
+ distene = imp.load_source('distene_licence', '/data/tmpsalome/salome/prerequis/install/LICENSE/dlim8.var.py')
+ distene.set_distene_variables(context)
+ except:
+ pass\n"""
+ text.insert(num_line + 1, text_to_insert)
+ for line in text:
+ fout.write(line)
+ fin.close()
+ fout.close()
+ return
+
def produce_relative_env_files(config,
logger,
file_dir,
return d_archives, l_pinfo_vcs
def add_salomeTools(config, tmp_working_dir):
- '''Prepare a version of salomeTools that has a specific site.pyconf file
+ '''Prepare a version of salomeTools that has a specific local.pyconf file
configured for a source package.
:param config Config: The global configuration.
sat_running_path = src.Path(config.VARS.salometoolsway)
sat_running_path.copy(sat_tmp_path)
- # Update the site.pyconf file that contains the path to the project
- site_pyconf_name = "site.pyconf"
- site_pyconf_dir = os.path.join(tmp_working_dir, "salomeTools", "data")
- site_pyconf_file = os.path.join(site_pyconf_dir, site_pyconf_name)
- ff = open(site_pyconf_file, "w")
- ff.write(SITE_TEMPLATE)
+ # Update the local.pyconf file that contains the path to the project
+ local_pyconf_name = "local.pyconf"
+ local_pyconf_dir = os.path.join(tmp_working_dir, "salomeTools", "data")
+ local_pyconf_file = os.path.join(local_pyconf_dir, local_pyconf_name)
+ # Remove the .pyconf file in the root directory of salomeTools if there is
+ # any. (For example when launching jobs, a pyconf file describing the jobs
+ # can be here and is not useful)
+ files_or_dir_SAT = os.listdir(os.path.join(tmp_working_dir, "salomeTools"))
+ for file_or_dir in files_or_dir_SAT:
+ if file_or_dir.endswith(".pyconf"):
+ file_path = os.path.join(tmp_working_dir,
+ "salomeTools",
+ file_or_dir)
+ os.remove(file_path)
+
+ ff = open(local_pyconf_file, "w")
+ ff.write(LOCAL_TEMPLATE)
ff.close()
return sat_tmp_path.path
path_targz_prod = os.path.join(where, prod_name + ".tgz")
tar_prod = tarfile.open(path_targz_prod, mode='w:gz')
local_path = prod_info.source_dir
- tar_prod.add(local_path, arcname=prod_name)
+ tar_prod.add(local_path,
+ arcname=prod_name,
+ exclude=exclude_VCS_and_extensions)
tar_prod.close()
return path_targz_prod
compilation based on the binaries used as prerequisites
=======================================================
-If you fail to compile the the complete application (for example because
+If you fail to compile the complete application (for example because
you are not root on your system and cannot install missing packages), you
may try a partial compilation based on the binaries.
For that it is necessary to copy the binaries from BINARIES to INSTALL,
with local paths).
The procedure to do it is:
1) Remove or rename INSTALL directory if it exists
- 2) Execute the shell script bin_install.sh:
+ 2) Execute the shell script install_bin.sh:
> cd $ROOT
- > ./bin_install.sh
+ > ./install_bin.sh
3) Use SalomeTool (as explained in Sources section) and compile only the
modules you need to (with -p option)
if options.project:
# check that the project is visible by SAT
if options.project not in runner.cfg.PROJECTS.project_file_paths:
- site_path = os.path.join(runner.cfg.VARS.salometoolsway,
+ local_path = os.path.join(runner.cfg.VARS.salometoolsway,
"data",
- "site.pyconf")
+ "local.pyconf")
msg = _("ERROR: the project %(proj)s is not visible by salomeTools."
- "\nPlease add it in the %(site)s file." % {
- "proj" : options.project, "site" : site_path})
+ "\nPlease add it in the %(local)s file." % {
+ "proj" : options.project, "local" : local_path})
logger.write(src.printcolors.printcError(msg), 1)
logger.write("\n", 1)
return 1
tar = tarfile.open(path_targz, mode='w:gz')
# get the filtering function if needed
- filter_function = None
filter_function = exclude_VCS_and_extensions
# Add the files to the tarfile object