# Get the version of the product from the application definition
version = config.APPLICATION.products[product_name]
- # if no version, then take the default one defined in the application
- if isinstance(version, bool):
- version = config.APPLICATION.tag
# Define debug and dev modes
# Get the tag if a dictionary is given in APPLICATION.products for the
verbose = 'no'
base = 'maybe'
section = None
+
+ # if no version, then take the default one defined in the application
+ if isinstance(version, bool):
+ # 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 isinstance(version, src.pyconf.Mapping):
dic_version = version
# Get the 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 base if any
if 'base' in dic_version:
with open(aFile, 'w') as f:
res.__save__(f)
- # this file is for human eye reading
+ # this file is not mandatory, is for human eye reading
aFile = os.path.join(p_info.install_dir, PRODUCT_FILENAME)
- with open(aFile, 'w') as f:
- # f.write(DBG.getStrConfigDbg(p_info)) # debug mode
- try:
- p_info.__save__(f, evaluated=True) # evaluated expressions mode
- except:
- # the second file is not mandatory. In the context of non VCS archives, p_info cannot be evaluated
- # because information on git server is not available. In this case, we skip the writing without raising an error.
- #DBG.write("cannot evaluate product info - do not write ", PRODUCT_FILENAME, True)
- pass
-
-
+ try:
+ 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.
+
+"""
+ 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:
res = resAll # not existing properties as all accepted
-
- ok = []
- ko = []
- products_infos = []
- for p_name, p_info in res:
- try:
- if src.product.product_is_native(p_info) or src.product.product_is_fixed(p_info):
- ko.append(p_name)
- else:
- products_infos.append((p_name, p_info))
- ok.append(p_name)
- except:
- msg = "problem on 'is_native' or 'is_fixed' for product %s" % p_name
- raise Exception(msg)
-
- if len(ko) > 0:
- logger.warning("on is_native or is_fixed\n products accepted:\n %s\n products rejected:\n %s\n" %
- (PP.pformat(sorted(ok)), PP.pformat(sorted(ko))))
-
- logger.debug("products selected:\n %s\n" % PP.pformat(sorted(ok)))
-
return res