# current product
debug = 'no'
dev = 'no'
+ hpc = 'no'
verbose = 'no'
base = 'maybe'
section = None
# if no version, then take the default one defined in the application
- if isinstance(version, bool):
+ if isinstance(version, bool) or isinstance(version, str):
# in this case tag is mandatory, not debug, verbose, dev
- version = config.APPLICATION.tag
if 'debug' in config.APPLICATION:
debug = config.APPLICATION.debug
if 'verbose' in config.APPLICATION:
verbose = config.APPLICATION.verbose
if 'dev' in config.APPLICATION:
dev = config.APPLICATION.dev
-
+ if 'hpc' in config.APPLICATION:
+ hpc = config.APPLICATION.hpc
+ if 'base' in config.APPLICATION:
+ base = config.APPLICATION.base
+
+ # special case for which only the product name is mentionned
+ if isinstance(version, bool):
+ version = config.APPLICATION.tag
+
if isinstance(version, src.pyconf.Mapping):
dic_version = version
# Get the version/tag
elif 'dev' in config.APPLICATION:
dev = config.APPLICATION.dev
+ # Get the hpc if any
+ if 'hpc' in dic_version:
+ hpc = dic_version.hpc
+ elif 'hpc' in config.APPLICATION:
+ hpc = config.APPLICATION.hpc
+
# Get the base if any
if 'base' in dic_version:
base = dic_version.base
if 'section' in dic_version:
section = dic_version.section
+ # this case occur when version is overwritten, cf sat # 8897
+ if isinstance(version, dict):
+ dic_version = version
+ # Get the version/tag
+ if not 'tag' in dic_version:
+ version = config.APPLICATION.tag
+ else:
+ version = dic_version["tag"]
+
+ # Get the debug if any
+ if 'debug' in dic_version:
+ debug = dic_version["debug"]
+ elif 'debug' in config.APPLICATION:
+ debug = config.APPLICATION.debug
+
+ # Get the verbose if any
+ if 'verbose' in dic_version:
+ verbose = dic_version["verbose"]
+ elif 'verbose' in config.APPLICATION:
+ verbose = config.APPLICATION.verbose
+
+ # Get the dev if any
+ if 'dev' in dic_version:
+ dev = dic_version["dev"]
+ elif 'dev' in config.APPLICATION:
+ dev = config.APPLICATION.dev
+
+ # Get the hpc if any
+ if 'hpc' in dic_version:
+ hpc = dic_version.hpc
+ elif 'hpc' in config.APPLICATION:
+ hpc = config.APPLICATION.hpc
+
+ # Get the base if any
+ if 'base' in dic_version:
+ base = dic_version["base"]
+
+ # Get the section if any
+ if 'section' in dic_version:
+ section = dic_version['section']
+
vv = version
# substitute some character with _ in order to get the correct definition
# in config.PRODUCTS. This is done because the pyconf tool does not handle
# Search for the product description in the configuration
prod_info = get_product_section(config, product_name, vv, section)
+ # get salomeTool version
+ prod_info.sat_version = src.get_salometool_version(config)
+
# merge opt_depend in depend
if prod_info is not None and 'opt_depend' in prod_info:
for depend in prod_info.opt_depend:
if depend in config.APPLICATION.products:
prod_info.depend.append(depend,'')
+
# In case of a product get with a vcs,
# put the tag (equal to the version)
if prod_info is not None and prod_info.get_source in AVAILABLE_VCS:
prod_info.debug = debug
prod_info.verbose = verbose
prod_info.dev = dev
+ prod_info.hpc = hpc
prod_info.version = version
# Set the archive_info if the product is get in archive mode
"")
if "archive_name" in prod_info.archive_info:
arch_name = prod_info.archive_info.archive_name
+ elif "archive_prefix" in prod_info.archive_info:
+ arch_name = prod_info.archive_info.archive_prefix + "-" + version + ".tar.gz"
else:
# standard name
arch_name = product_name + "-" + version + ".tar.gz"
if not script_path:
msg = _("Compilation script %s not found in") % script_name
DBG.tofix(msg, config.PATHS.PRODUCTPATH, True) # say where searched
- # avoid stop if sat prepare, script could be included in sources, only warning
- # raise src.SatException(msg)
- script_path = "*** Not Found: %s" % script_name
+ script_path = "%s_(Not_Found_by_Sat!!)" % script_name
prod_info.compil_script = script_path
# Check that the script is executable
if os.path.exists(prod_info.compil_script) and not os.access(prod_info.compil_script, os.X_OK):
- #raise src.SatException(
- # _("Compilation script cannot be executed: %s") %
- # prod_info.compil_script)
- # just as warning, problem later...
DBG.tofix("Compilation script file is not in 'execute mode'", prod_info.compil_script, True)
# Get the full paths of all the patches
"""
install_dir = ""
in_base = False
+ # base : corresponds to what is specified in application pyconf (either from the global key, or from a product dict)
+ # prod_info.install_dir : corresponds to what is specified in product pyconf (usually "base" for prerequisites)
if (("install_dir" in prod_info and prod_info.install_dir == "base")
or base == "yes"):
in_base = True
+ # what was declared in application has precedence over what was said in product pyconf
+ # no_base="yes" has precedence over base == "yes"
if (base == "no" or ("no_base" in config.APPLICATION
and config.APPLICATION.no_base == "yes")):
in_base = False
with open(aFile, 'w') as f:
p_info.__save__(f, evaluated=True) # evaluated expressions mode
except:
- DBG.write("cannot evaluate product info - problem in file %s" % aFile, p_info, True)
- # write DBG mode, as no problem if evaluation not possible
- msg = """\
-# Some informations cannot be evaluated.
-# for example:
-# In the context of non VCS archives, information on git server is not available.
+ # sometime some information cannot be evaluated.
+ # for example, in the context of non VCS archives, information on git server is not available.
+ DBG.write("Warning : sat was not able to evaluate and write down some information in file %s" % aFile)
-"""
- with open(aFile, 'w') as f:
- f.write(msg)
- f.write(DBG.getStrConfigDbg(p_info))
def check_config_exists(config, prod_dir, prod_info, verbose=False):
"""\
else:
ko.append(p_name)
except:
- ok.append(p_name)
+ ko.append(p_name)
if len(ok) != len(resAll):
logger.trace("on properties %s\n products accepted:\n %s\n products rejected:\n %s\n" %
# if product_info.name == "XDATA": return True #test #10569
return res
+def product_is_hpc(product_info):
+ """Know if a product is in hpc mode
+
+ :param product_info Config: The configuration specific to
+ the product
+ :return: True if the product is in hpc mode, else False
+ :rtype: boolean
+ """
+ hpc = product_info.hpc
+ res = (hpc.lower() == 'yes')
+ return res
+
def product_is_debug(product_info):
"""Know if a product is in debug mode
"generate" in product_info.properties and
product_info.properties.generate == "yes")
+def product_is_compile_time(product_info):
+ """Know if a product is only used at compile time
+
+ :param product_info Config: The configuration specific to
+ the product
+ :return: True if the product is only used at compile time
+ :rtype: boolean
+ """
+ return ("properties" in product_info and
+ "compile_time" in product_info.properties and
+ product_info.properties.compile_time == "yes")
+
+
+def product_test_property(product_info, property_name, property_value):
+ """Generic function to test if a product has a property set to a value
+
+ :param product_info Config: The configuration specific to
+ the product
+ :param property_name : The name of the property to check
+ :param property_value : The value of the property to test
+ :return: True if the product has the property and the property is set to property_value
+ :rtype: boolean
+ """
+ # first check if product has the property
+ if not ("properties" in product_info and
+ property_name in product_info.properties):
+ return False
+
+ # then check to the property is set to property_value
+ eval_expression = 'product_info.properties.%s == "%s"' % (property_name,property_value)
+ result = eval(eval_expression)
+ return result
+
+
+
def get_product_components(product_info):
"""Get the component list to generate with the product