+++ /dev/null
-#!/usr/bin/env python
-#-*- coding:utf-8 -*-
-# Copyright (C) 2010-2012 CEA/DEN
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-import os
-
-import src
-
-# Define all possible option for the shell command : sat base <options>
-parser = src.options.Options()
-parser.add_option('s', 'set', 'string', 'base_path',
- _('Optional: The path directory to use as base.'), None)
-
-def set_base(config, path, site_file_path, logger):
- """ Edit the site.pyconf file and change the base path
-
- :param config Config: The global configuration.
- :param path src.Path: The path to put in the site.pyconf file.
- :param site_file_path Str: The path to the site.pyconf file.
- :param logger Logger: The logger instance.
- :return: 0 if all is OK, else 1
- :rtype: int
- """
- # Update the site.pyconf file
- try:
- site_pyconf_cfg = src.pyconf.Config(site_file_path)
- site_pyconf_cfg.SITE.base = str(path)
- ff = open(site_file_path, 'w')
- site_pyconf_cfg.__save__(ff, 1)
- ff.close()
- config.SITE.base = str(path)
- except Exception as e:
- err = str(e)
- msg = _("Unable to update the site.pyconf file: %s\n" % err)
- logger.write(msg, 1)
- return 1
-
- display_base_path(config, logger)
-
- return 0
-
-
-def display_base_path(config, logger):
- """ Display the base path
-
- :param config Config: The global configuration.
- :param logger Logger: The logger instance.
- """
- info = [(_("Base path"), config.SITE.base)]
- src.print_info(logger, info)
-
-def description():
- '''method that is called when salomeTools is called with --help option.
-
- :return: The text to display for the base command description.
- :rtype: str
- '''
- return _("Display or set the base where to put installations of base "
- "products\n\nexample\nsat base --set /tmp/BASE")
-
-def run(args, runner, logger):
- '''method that is called when salomeTools is called with base parameter.
- '''
-
- # Parse the options
- (options, args) = parser.parse_args(args)
-
- # Get the path to the site.pyconf file that contain the base path
- site_file_path = os.path.join(runner.cfg.VARS.salometoolsway,
- "data",
- "site.pyconf")
-
- # If the option set is passed
- if options.base_path:
- # Get the path
- path = src.Path(options.base_path)
-
- # If it is a file, do nothing and return error
- if path.isfile():
- msg = _("Error: The given path is a file. Please provide a path to "
- "a directory")
- logger.write(src.printcolors.printcError(msg), 1)
- return 1
-
- # If it is an existing directory, set the base to it
- if path.exists() and path.isdir():
- # Set the base in the site.pyconf file
- res = set_base(runner.cfg, path, site_file_path, logger)
- return res
-
- # Try to create the given path
- try:
- src.ensure_path_exists(str(path))
- except Exception as e:
- err = src.printcolors.printcError(str(e))
- msg = _("Unable to create the directory %s: %s\n" % (str(path),
- err))
- logger.write(msg, 1)
- return 1
-
- # Set the base in the site.pyconf file
- res = set_base(runner.cfg, path, site_file_path, logger)
- return res
-
- # Display the base that is in the site.pyconf file
- display_base_path(runner.cfg, logger)
- if not options.base_path:
- logger.write(_("To change the value of the base path, use the --set"
- " option.\n"), 2)
-
- return
\ No newline at end of file
exec('cfg.' + rule) # this cannot be factorized because of the exec
# =====================================================================
- # Load SITE config file
+ # Load LOCAL config file
# search only in the data directory
src.pyconf.streamOpener = ConfigOpener([cfg.VARS.datadir])
try:
- site_cfg = src.pyconf.Config(open(os.path.join(cfg.VARS.datadir,
- 'site.pyconf')),
- PWD = ('SITE', cfg.VARS.datadir) )
+ local_cfg = src.pyconf.Config(open(os.path.join(cfg.VARS.datadir,
+ 'local.pyconf')),
+ PWD = ('LOCAL', cfg.VARS.datadir) )
except src.pyconf.ConfigError as e:
raise src.SatException(_("Error in configuration file: "
- "site.pyconf\n %(error)s") % \
+ "local.pyconf\n %(error)s") % \
{'error': str(e) })
except IOError as error:
e = str(error)
- if "site.pyconf" in e :
- e += ("\nYou can copy data"
- + cfg.VARS.sep
- + "site.template.pyconf to data"
- + cfg.VARS.sep
- + "site.pyconf and edit the file")
raise src.SatException( e );
- merger.merge(cfg, site_cfg)
+ merger.merge(cfg, local_cfg)
+
+ # When the key is "unknown", put the default value
+ if cfg.LOCAL.base == "unknown":
+ cfg.LOCAL.base = os.path.abspath(
+ os.path.join(cfg.VARS.salometoolsway,
+ "..",
+ "BASE"))
+ if cfg.LOCAL.workdir == "unknown":
+ cfg.LOCAL.workdir = os.path.abspath(
+ os.path.join(cfg.VARS.salometoolsway,
+ ".."))
+ if cfg.LOCAL.log_dir == "unknown":
+ cfg.LOCAL.log_dir = os.path.abspath(
+ os.path.join(cfg.VARS.salometoolsway,
+ "..",
+ "LOGS"))
# apply overwrite from command line if needed
- for rule in self.get_command_line_overrides(options, ["SITE"]):
+ for rule in self.get_command_line_overrides(options, ["LOCAL"]):
exec('cfg.' + rule) # this cannot be factorized because of the exec
# =====================================================================
#
user_cfg.addMapping('USER', src.pyconf.Mapping(user_cfg), "")
- #
- user_cfg.USER.addMapping('workdir', os.path.expanduser('~'),
- "This is where salomeTools will work. "
- "You may (and probably do) change it.\n")
user_cfg.USER.addMapping('cvs_user', config.VARS.user,
"This is the user name used to access salome cvs base.\n")
user_cfg.USER.addMapping('svn_user', config.VARS.user,
src.pyconf.DOLLAR,
'workdir + $VARS.sep + "BASE"'),
"The products installation base (could be "
- "ignored if this key exists in the site.pyconf"
+ "ignored if this key exists in the local.pyconf"
" file of salomTools).\n")
-
- user_cfg.USER.addMapping("log_dir",
- src.pyconf.Reference(
- user_cfg,
- src.pyconf.DOLLAR,
- 'workdir + $VARS.sep + "LOGS"'),
- "The log repository\n")
-
+
#
src.ensure_path_exists(config.VARS.personalDir)
src.ensure_path_exists(os.path.join(config.VARS.personalDir,
--- /dev/null
+#!/usr/bin/env python
+#-*- coding:utf-8 -*-
+# Copyright (C) 2010-2012 CEA/DEN
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+import os
+
+import src
+
+# Define all possible option for the init command : sat init <options>
+parser = src.options.Options()
+parser.add_option('b', 'base', 'string', 'base',
+ _('Optional: The path to the products base'))
+parser.add_option('w', 'workdir', 'string', 'workdir',
+ _('Optional: The path to the working directory '
+ '(where to install the applications'))
+parser.add_option('v', 'VCS', 'string', 'VCS',
+ _('Optional: The address of the repository of SAT '
+ '(only informative)'))
+parser.add_option('t', 'tag', 'string', 'tag',
+ _('Optional: The tag of SAT (only informative)'))
+parser.add_option('l', 'log_dir', 'string', 'log_dir',
+ _('Optional: The directory where to put all the logs of SAT'))
+
+def set_local_value(config, key, value, logger):
+ """ Edit the site.pyconf file and change a value.
+
+ :param config Config: The global configuration.
+ :param key Str: The key from which to change the value.
+ :param value Str: The path to change.
+ :param logger Logger: The logger instance.
+ :return: 0 if all is OK, else 1
+ :rtype: int
+ """
+ local_file_path = os.path.join(config.VARS.datadir, "local.pyconf")
+ # Update the local.pyconf file
+ try:
+ local_cfg = src.pyconf.Config(local_file_path)
+ local_cfg.LOCAL[key] = value
+ ff = open(local_file_path, 'w')
+ local_cfg.__save__(ff, 1)
+ ff.close()
+ if key != "log_dir":
+ config.LOCAL[key] = value
+ except Exception as e:
+ err = str(e)
+ msg = _("Unable to update the local.pyconf file: %s\n" % err)
+ logger.write(msg, 1)
+ return 1
+
+ return 0
+
+def display_local_values(config, logger):
+ """ Display the base path
+
+ :param config Config: The global configuration.
+ :param key Str: The key from which to change the value.
+ :param logger Logger: The logger instance.
+ """
+ info = [("base", config.LOCAL.base),
+ ("workdir", config.LOCAL.workdir),
+ ("log_dir", config.LOCAL.log_dir),
+ ("VCS", config.LOCAL.VCS),
+ ("tag", config.LOCAL.tag)]
+ src.print_info(logger, info)
+
+ return 0
+
+def check_path(path_to_check, logger):
+ """ Verify that the given path is not a file and can be created.
+
+ :param path_to_check Str: The path to check.
+ :param logger Logger: The logger instance.
+ """
+ if path_to_check == "unknown":
+ return 0
+
+ # Get the path
+ path = src.Path(path_to_check)
+
+ # If it is a file, do nothing and return error
+ if path.isfile():
+ msg = _("Error: The given path is a file. Please provide a path to "
+ "a directory")
+ logger.write(src.printcolors.printcError(msg), 1)
+ return 1
+
+ # Try to create the given path
+ try:
+ src.ensure_path_exists(str(path))
+ except Exception as e:
+ err = src.printcolors.printcError(str(e))
+ msg = _("Unable to create the directory %s: %s\n" % (str(path),
+ err))
+ logger.write(msg, 1)
+ return 1
+
+ return 0
+
+def description():
+ '''method that is called when salomeTools is called with --help option.
+
+ :return: The text to display for the init command description.
+ :rtype: str
+ '''
+ return _("Changes the local settings of SAT.")
+
+def run(args, runner, logger):
+ '''method that is called when salomeTools is called with init parameter.
+ '''
+
+ # Parse the options
+ (options, args) = parser.parse_args(args)
+
+ # Print some informations
+ logger.write(_('Local Settings of SAT %s\n\n') %
+ src.printcolors.printcLabel(runner.cfg.VARS.salometoolsway), 1)
+
+ res = 0
+
+ # Set the options corresponding to a directory
+ for opt in [("base" , options.base),
+ ("workdir", options.workdir),
+ ("log_dir", options.log_dir)]:
+ key, value = opt
+ if value:
+ res_check = check_path(value, logger)
+ res += res_check
+ if res_check == 0:
+ res_set = set_local_value(runner.cfg, key, value, logger)
+ res += res_set
+
+ # Set the options corresponding to an informative value
+ for opt in [("VCS", options.VCS), ("tag", options.tag)]:
+ key, value = opt
+ res_set = set_local_value(runner.cfg, key, value, logger)
+ res += res_set
+
+ display_local_values(runner.cfg, logger)
+
+ return res
\ No newline at end of file
self._has_finished = True
self._has_timouted = True
self._Tf = time.time()
- (out_kill, _) = self.kill_remote_process()
+ (out_kill, __) = self.kill_remote_process()
self.out += "TIMEOUT \n" + out_kill
self.err += "TIMEOUT : %s seconds elapsed\n" % str(self.timeout)
try:
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,
self.logger)
machine.distribution = out_dist.read().decode().replace("\n",
"")
+
# Print the status of the copy
if res_copy == 0:
self.logger.write('\r%s' %
config_jobs.__save__(f)
# log the paramiko problems
- paramiko_log_dir_path = os.path.join(runner.cfg.USER.log_dir, "JOBS")
+ log_dir = src.get_log_path(runner.cfg)
+ paramiko_log_dir_path = os.path.join(log_dir, "JOBS")
src.ensure_path_exists(paramiko_log_dir_path)
paramiko.util.log_to_file(os.path.join(paramiko_log_dir_path,
logger.txtFileName))
logger.flush()
# Copy the stylesheets in the log directory
- log_dir = runner.cfg.USER.log_dir
+ log_dir = log_dir
xsl_dir = os.path.join(runner.cfg.VARS.srcDir, 'xsl')
files_to_copy = []
files_to_copy.append(os.path.join(xsl_dir, STYLESHEET_GLOBAL))
# Instanciate the Gui in order to produce the xml files that contain all
# the boards
- gui = Gui(runner.cfg.USER.log_dir,
+ gui = Gui(log_dir,
today_jobs.ljobs,
today_jobs.ljobs_not_today,
runner.cfg.VARS.datehour,
(options, args) = parser.parse_args(args)
# get the log directory.
- logDir = runner.cfg.USER.log_dir
+ logDir = src.get_log_path(runner.cfg)
# Print a header
nb_files_log_dir = len(glob.glob(os.path.join(logDir, "*")))
# Create or update the hat xml that gives access to all the commands log files
logger.write(_("Generating the hat log file (can be long) ... "), 3)
xmlHatFilePath = os.path.join(logDir, 'hat.xml')
- src.logger.update_hat_xml(runner.cfg.USER.log_dir,
+ src.logger.update_hat_xml(logDir,
application = runner.cfg.VARS.application,
notShownCommands = notShownCommands)
logger.write(src.printcolors.printc("OK"), 3)
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"
- }
- test :{
- tmp_dir_with_application : '/tmp' + $VARS.sep + $VARS.user + """
-"""$VARS.sep + $APPLICATION.name + $VARS.sep + 'test'
- tmp_dir : '/tmp' + $VARS.sep + $VARS.user + $VARS.sep + 'test'
- timeout : 150
- }
-}
+ 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()
+ 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)
+ ff = open(local_pyconf_file, "w")
+ ff.write(LOCAL_TEMPLATE)
ff.close()
return sat_tmp_path.path
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
test_base_name = os.path.basename(test_base)
history_xml_name += test_base_name
history_xml_name += ".xml"
- return os.path.join(config.USER.log_dir, "TEST", history_xml_name)
+ log_dir = src.get_log_path(config)
+ return os.path.join(log_dir, "TEST", history_xml_name)
def run(args, runner, logger):
'''method that is called when salomeTools is called with test parameter.
os.environ['DISPLAY'] = options.display
elif 'DISPLAY' not in os.environ:
# if no display set
- if ('display' in runner.cfg.SITE.test and
- len(runner.cfg.SITE.test.display) > 0):
+ if ('test' in runner.cfg.LOCAL and
+ 'display' in runner.cfg.LOCAL.test and
+ len(runner.cfg.LOCAL.test.display) > 0):
# use default value for test tool
- os.environ['DISPLAY'] = runner.cfg.SITE.test.display
+ os.environ['DISPLAY'] = runner.cfg.LOCAL.test.display
else:
os.environ['DISPLAY'] = "localhost:0.0"
# initialization
#################
if with_application:
- tmp_dir = runner.cfg.SITE.test.tmp_dir_with_application
+ tmp_dir = os.path.join(runner.cfg.VARS.tmp_root,
+ runner.cfg.APPLICATION.name,
+ "test")
else:
- tmp_dir = runner.cfg.SITE.test.tmp_dir
+ tmp_dir = os.path.join(runner.cfg.VARS.tmp_root,
+ "test")
# remove previous tmp dir
if os.access(tmp_dir, os.F_OK):
src.printcolors.print_value(logger, _('Display'), os.environ['DISPLAY'], 2)
src.printcolors.print_value(logger, _('Timeout'),
- runner.cfg.SITE.test.timeout, 2)
+ src.test_module.DEFAULT_TIMEOUT, 2)
src.printcolors.print_value(logger, _("Working dir"), base_dir, 3)
# create the test object
logger.write("\n", 2, False)
logger.write(_("\nGenerate the specific test log\n"), 5)
- out_dir = os.path.join(runner.cfg.USER.log_dir, "TEST")
+ log_dir = src.get_log_path(runner.cfg)
+ out_dir = os.path.join(log_dir, "TEST")
src.ensure_path_exists(out_dir)
name_xml_board = logger.logFileName.split(".")[0] + "board" + ".xml"
historic_xml_path = generate_history_xml_path(runner.cfg, test_base)
base)
opts2=$(echo --set $opts2)
;;
+ init)
+ opts2=$(echo --base --workdir --VCS --tag --log_dir $opts2)
+ ;;
esac
COMPREPLY=( $(compgen -W "${opts2}" -- ${cur}) )
# first argument => show available commands
if [[ ${argc} == 1 ]]
then
- opts="config log source patch prepare environ clean configure make makeinstall compile launcher run jobs job shell test package generate find_duplicates application template base check profile script --help --overwrite --debug --verbose --batch --all_in_terminal --logs_paths_in_file"
+ opts="config log source patch prepare environ clean configure make makeinstall compile launcher run jobs job shell test package generate find_duplicates application template base check profile script init --help --overwrite --debug --verbose --batch --all_in_terminal --logs_paths_in_file"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
fi
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
+ init)
+ opts="--base --workdir --VCS --tag --log_dir"
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
+ ;;
*) return 0 ;;
esac
--- /dev/null
+#!/usr/bin/env python
+#-*- coding:utf-8 -*-
+ LOCAL :
+ {
+ base : 'unknown'
+ workdir : 'unknown'
+ log_dir : 'unknown'
+ VCS : None
+ tag : None
+ }
+ PROJECTS :
+ {
+ project_file_paths :
+ [
+ ]
+ }
+++ /dev/null
-#!/usr/bin/env python
-#-*- coding:utf-8 -*-
-
-SITE :
-{
- base : $USER.workdir + $VARS.sep + "BASE"
- test :{
- tmp_dir_with_application : '/tmp' + $VARS.sep + $VARS.user + $VARS.sep + $APPLICATION.name + $VARS.sep + 'test'
- tmp_dir : '/tmp' + $VARS.sep + $VARS.user + $VARS.sep + 'test'
- timeout : 150
- }
-}
-
-PROJECTS :
-{
-project_file_paths :
-[
-]
-}
# configuration to use this component with sat
pyconf = """
-TOOLS : { common : { module_info : {
- '%(NAME)s':
+ 'default':
{
name : "%(NAME)s"
has_gui : "yes"
- get_sources : '%(get_method)s'
- build_sources : 'autotools'
+ get_source : '%(get_method)s'
+ build_source : 'autotools'
git_info:
{
repo : 'to be filled'
}
archive_info:
{
- archive_name : '%(target)s.tar.gz'
+ archive_name : '%(NAME)s.tar.gz'
}
nb_proc : 1
- source_dir : $TOOLS.common.source_root + '/' + $name
- build_dir : $TOOLS.common.build_root + '/' + $name
+ source_dir : $APPLICATION.workdir + $VARS.sep + 'SOURCES' + $VARS.sep + $name
+ build_dir : $APPLICATION.workdir + $VARS.sep + 'BUILD' + $VARS.sep + $name
depend : [ 'Python', 'KERNEL', 'GUI' ]
opt_depend : []
+ type : "salome"
+ properties :
+ {
+ is_SALOME_module : 'yes'
+ has_unit_tests : True
+ has_salome_gui : 'yes'
+ }
}
-}}}
"""
logger.write("\n", 2)
def get_base_path(config):
- '''Returns the path of the product base.
+ '''Returns the path of the products base.
:param config Config: The global Config instance.
- :return: The path of the product base.
+ :return: The path of the products base.
:rtype: str
'''
- if "base" not in config.SITE:
- site_file_path = os.path.join(config.VARS.salometoolsway,
+ if "base" not in config.LOCAL:
+ local_file_path = os.path.join(config.VARS.salometoolsway,
"data",
- "site.pyconf")
- msg = _("Please define a base path in the file %s" % site_file_path)
+ "local.pyconf")
+ msg = _("Please define a base path in the file %s" % local_file_path)
raise SatException(msg)
+
+ base_path = os.path.abspath(config.LOCAL.base)
+
+ return base_path
- return config.SITE.base
+def get_log_path(config):
+ '''Returns the path of the logs.
+
+ :param config Config: The global Config instance.
+ :return: The path of the logs.
+ :rtype: str
+ '''
+ if "log_dir" not in config.LOCAL:
+ local_file_path = os.path.join(config.VARS.salometoolsway,
+ "data",
+ "local.pyconf")
+ msg = _("Please define a log_dir in the file %s" % local_file_path)
+ raise SatException(msg)
+
+ log_dir_path = os.path.abspath(config.LOCAL.log_dir)
+
+ return log_dir_path
def get_salome_version(config):
if hasattr(config.APPLICATION, 'version_salome'):
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" %
config.VARS.command + "_" +
config.VARS.hostname)
logFileName = prefix + hour_command_host + ".xml"
- logFilePath = os.path.join(config.USER.log_dir, logFileName)
+ log_dir = src.get_log_path(config)
+ logFilePath = os.path.join(log_dir, logFileName)
# Construct txt file location in order to log
# the external commands calls (cmake, make, git clone, etc...)
txtFileName = prefix + hour_command_host + ".txt"
- txtFilePath = os.path.join(config.USER.log_dir, "OUT", txtFileName)
+ txtFilePath = os.path.join(log_dir, "OUT", txtFileName)
src.ensure_path_exists(os.path.dirname(logFilePath))
src.ensure_path_exists(os.path.dirname(txtFilePath))
self.xmlFile.write_tree(stylesheet = "command.xsl")
# Dump the config in a pyconf file in the log directory
- logDir = self.config.USER.log_dir
+ logDir = src.get_log_path(self.config)
dumpedPyconfFileName = (self.config.VARS.datehour
+ "_"
+ self.config.VARS.command
# directories not considered as test grids
C_IGNORE_GRIDS = ['.git', '.svn', 'RESSOURCES']
+DEFAULT_TIMEOUT = 150
+
# Get directory to be used for the temporary files.
#
def getTmpDirDEFAULT():
launcherDir = os.path.dirname(self.launcher)
if launcherName == 'runAppli':
# Old application
- cmd = "for i in " + launcherDir + "/env.d/*.sh; do source ${i};"
- " done ; echo $KERNEL_ROOT_DIR"
+ cmd = ("for i in " + launcherDir + "/env.d/*.sh; do source ${i};"
+ " done ; echo $KERNEL_ROOT_DIR")
else:
# New application
cmd = ("echo -e 'import os\nprint os.environ[\"KERNEL_" +
self.currentsession)
sessionname = "%s/%s" % (self.currentgrid, self.currentsession)
time_out = self.get_test_timeout(sessionname,
- self.config.SITE.test.timeout)
+ DEFAULT_TIMEOUT)
- time_out_salome = src.get_cfg_param(self.config.SITE.test,
- "timeout_app",
- self.config.SITE.test.timeout)
+ time_out_salome = DEFAULT_TIMEOUT
# generate wrapper script
script_path = os.path.join(out_path, 'wrapperScript.py')
self.settings.clear()
# read known failures pyconf
- if "testerror" in self.config.SITE:
+ if "testerror" in self.config.LOCAL:
#import testerror
#self.known_errors = testerror.read_test_failures(
# self.config.TOOLS.testerror.file_path,