# Write the launcher file\r
logger.write(_("Generating launcher for %s :\n") % \r
src.printcolors.printcLabel(config.VARS.application), 1)\r
- logger.write(" %s\n" %src.printcolors.printcLabel(filepath), 1)\r
+ logger.write(" %s\n" % src.printcolors.printcLabel(filepath), 1)\r
\r
# open the file and write into it\r
launch_file = open(filepath, "w")\r
date[11:13],
date[13:])
return res
+
+def merge_dicts(*dict_args):
+ '''
+ Given any number of dicts, shallow copy and merge into a new dict,
+ precedence goes to key value pairs in latter dicts.
+ '''
+ result = {}
+ for dictionary in dict_args:
+ result.update(dictionary)
+ return result
"""Class to manage the environment of SALOME.
"""
- def __init__(self, cfg, environ, forBuild=False):
+ def __init__(self, cfg, environ, forBuild=False, for_package=None):
'''Initialization.
:param cfg Config: the global config
to store the environment variables
:param forBuild bool: If true, it is a launch environment,
else a build one
+ :param for_package str: If not None, produce a relative environment
+ designed for a package.
'''
self.environ = environ
self.cfg = cfg
self.forBuild = forBuild
+ self.for_package = for_package
self.silent = False
def __repr__(self):
elif not self.silent:
logger.write(" " + _("No install_dir for product %s\n") %
product_info.name, 5)
-
- # set source dir, unless no source dir
- if not src.product.product_is_fixed(product_info):
- src_dir = product_info.name + "_SRC_DIR"
- if not self.is_defined(src_dir):
- self.set(src_dir, product_info.source_dir)
+
+ if not self.for_package:
+ # set source dir, unless no source dir
+ if not src.product.product_is_fixed(product_info):
+ src_dir = product_info.name + "_SRC_DIR"
+ if not self.is_defined(src_dir):
+ self.set(src_dir, product_info.source_dir)
def set_salome_generic_product_env(self, product):
"""Sets the generic environment for a SALOME product.
# Get the informations corresponding to the product
pi = src.product.get_product_config(self.cfg, product)
+ if self.for_package:
+ pi.install_dir = os.path.join(self.for_package, pi.name)
+
# Do not define environment if the product is native
if src.product.product_is_native(pi):
return
return env_file.name
- def write_cfgForPy_file(self, filename, additional_env = {}):
+ def write_cfgForPy_file(self,
+ filename,
+ additional_env = {},
+ for_package = None):
"""Append to current opened aFile a cfgForPy
environment (SALOME python launcher).
:param filename str: the file path
:param additional_env dict: a dictionary of additional variables
to add to the environment
+ :param for_package str: If not None, produce a relative environment
+ designed for a package.
"""
if not self.silent:
self.logger.write(_("Create configuration file %s\n") %
- src.printcolors.printcLabel(aFile.name), 3)
+ src.printcolors.printcLabel(filename.name), 3)
# create then env object
tmp = src.fileEnviron.get_file_environ(filename,
"cfgForPy",
{})
# environment for launch
- env = SalomeEnviron(self.config, tmp, forBuild=False)
+ env = SalomeEnviron(self.config,
+ tmp,
+ forBuild=False,
+ for_package=for_package)
env.silent = self.silent
if self.env_info is not None:
else:
if self.default_level <= current_output_verbose_level and not self.silentSysStd:
sys.stdout.write(message)
+ self.flush()
def error(self, message):
'''Print an error.
# 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
-'''In this file are implemented the classes and methods
+'''In this file are implemented the methods
relative to the product notion of salomeTools
'''
# If it exists, get the information of the product_version
if "version_" + vv in config.PRODUCTS[product_name]:
# returns specific information for the given version
- prod_info = config.PRODUCTS[product_name]["version_" + vv]
+ prod_info = config.PRODUCTS[product_name]["version_" + vv]
+ prod_info.section = "version_" + vv
# Get the standard informations
elif "default" in config.PRODUCTS[product_name]:
# returns the generic information (given version not found)
prod_info = config.PRODUCTS[product_name].default
+ prod_info.section = "default"
# merge opt_depend in depend
if prod_info is not None and 'opt_depend' in prod_info:
else:
if (os.path.basename(prod_info.archive_info.archive_name) ==
prod_info.archive_info.archive_name):
-
+ arch_name = prod_info.archive_info.archive_name
arch_path = src.find_file_in_lpath(
- prod_info.archive_info.archive_name,
+ arch_name,
config.PATHS.ARCHIVEPATH)
if not arch_path:
msg = _("Archive %(arch_name)s for %(prod_name)s not found:"
prod_info.compil_script)
# Get the full paths of all the patches
- if "patches" in prod_info:
+ if product_has_patches(prod_info):
patches = []
for patch in prod_info.patches:
patch_path = patch
prod_info.patches = patches
# Get the full paths of the environment scripts
- if "environ" in prod_info and "env_script" in prod_info.environ:
+ if product_has_env_script(prod_info):
env_script_path = prod_info.environ.env_script
# If only a filename, then search for the environment script
# in the PRODUCTPATH/env_scripts
# Native case
return False
build_src = product_info.build_source
- return build_src.lower() == 'script'
\ No newline at end of file
+ return build_src.lower() == 'script'
+
+def product_has_env_script(product_info):
+ '''Know if a product has an environment script
+
+ :param product_info Config: The configuration specific to
+ the product
+ :return: True if the product it has an environment script, else False
+ :rtype: boolean
+ '''
+ return "environ" in product_info and "env_script" in product_info.environ
+
+def product_has_patches(product_info):
+ '''Know if a product has one or more patches
+
+ :param product_info Config: The configuration specific to
+ the product
+ :return: True if the product has one or more patches
+ :rtype: boolean
+ '''
+ return "patches" in product_info and len(product_info.patches) > 0
\ No newline at end of file
<xsl:attribute name="onclick">javascript:Toggle('<xsl:value-of select="@name"/>')</xsl:attribute>
<xsl:attribute name="title"><xsl:value-of select="state/."/></xsl:attribute>
<xsl:attribute name="class">OK2day</xsl:attribute>
- j
+ job
</a>
</xsl:when>
<xsl:when test="contains(state/., 'Timeout')">