self.logger.flush()
res_copy = machine.copy_sat(self.runner.cfg.VARS.salometoolsway,
self.job_file_path)
+
+ # set the local settings of sat on the remote machine using
+ # the init command
+ (__, __, __) = machine.exec_command(
+ os.path.join(machine.sat_path,
+ "sat init --base unknown --workdir unknown"
+ " --log_dir unknown"),
+ self.logger)
+
# get the remote machine distribution using a sat command
(__, out_dist, __) = machine.exec_command(
os.path.join(machine.sat_path,
machine.distribution = out_dist.read().decode().replace("\n",
"")
- # set the local settings of sat on the remote machine using
- # the init command
- (__, __, __) = machine.exec_command(
- os.path.join(machine.sat_path,
- "sat init --base unknown --workdir unknown"
- " --log_dir unknown"),
- self.logger)
-
# Print the status of the copy
if res_copy == 0:
self.logger.write('\r%s' %
# 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()
+ 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,
self.prefix+
self.setVarEnv+
'(r"%s", r"%s", overwrite=True)\n' %
- ('DISTENE_LICENCE_FILE_FOR_MGCLEANER',
+ ('DLIM8VAR',
self.change_to_launcher(
- '<path to your license>')))
- self.output.write(self.indent+
- "#"+
- self.prefix+
- self.setVarEnv+
- '(r"%s", r"%s", overwrite=True)\n' %
- ('DISTENE_LICENCE_FILE_FOR_YAMS',
- self.change_to_launcher(
- '<path to your license>')))
+ '<your licence>')))
return
if "setting environ for" in comment:
self.output.write(self.indent+"#[%s]\n" %