msg = _("The section APPLICATION.virtual_app is not defined in the product.")
logger.error(UTS.red(msg))
return RCO.ReturnCode("KO", msg)
-
+ virtual_app = config.APPLICATION.virtual_app
+
# get application dir
target_dir = config.APPLICATION.workdir
if options.target:
# set list of modules
if options.modules:
- config.APPLICATION.virtual_app['modules'] = options.modules
+ virtual_app['modules'] = options.modules
# set name and application_name
if options.name:
- config.APPLICATION.virtual_app['name'] = options.name
- config.APPLICATION.virtual_app['application_name'] = options.name + "_appdir"
+ virtual_app['name'] = options.name
+ virtual_app['application_name'] = options.name + "_appdir"
- application_name = src.get_cfg_param(config.APPLICATION.virtual_app,
- "application_name",
- config.APPLICATION.virtual_app.name + "_appdir")
+ default = config.APPLICATION.virtual_app.name + "_appdir"
+ application_name = UTS.get_config_key(virtual_app, "application_name", default)
appli_dir = os.path.join(target_dir, application_name)
fmt = " %s = %s\n" # as " label = value\n"
elif options.gencat:
# generate catalog for given list of computers
catalog_src = options.gencat
- catalog = generate_catalog(options.gencat.split(","),
- config,logger)
- elif 'catalog' in config.APPLICATION.virtual_app:
+ catalog = generate_catalog(options.gencat.split(","), config,logger)
+ elif 'catalog' in virtual_app:
# use catalog specified in the product
- if config.APPLICATION.virtual_app.catalog.endswith(".xml"):
+ if virtual_app.catalog.endswith(".xml"):
# catalog as a file
- catalog = config.APPLICATION.virtual_app.catalog
+ catalog = virtual_app.catalog
else:
# catalog as a list of computers
- catalog_src = config.APPLICATION.virtual_app.catalog
- mlist = filter(lambda l: len(l.strip()) > 0,
- config.APPLICATION.virtual_app.catalog.split(","))
+ catalog_src = virtual_app.catalog
+ mlist = filter(lambda l: len(l.strip()) > 0, virtual_app.catalog.split(","))
if len(mlist) > 0:
- catalog = generate_catalog(config.APPLICATION.virtual_app.catalog.split(","),
- config, logger)
+ catalog = generate_catalog(virtual_app.catalog.split(","), config, logger)
# display which catalog is used
if len(catalog) > 0:
else:
# regular module
mp = mm.install_dir
- gui = src.get_cfg_param(mm, "has_gui", "yes")
+ gui = UTS.get_config_key(mm, "has_gui", "yes")
flagline = add_module_to_appli(f, m, gui, mp, logger, flagline)
f.write('</modules>\n')
cmd_found = True
command = ""
if src.product.product_has_script(p_info) and not ignored:
- command = src.get_cfg_param(p_info, "test_build", "Not found")
+ command = UTS.get_config_key(p_info, "test_build", "Not found")
if command == "Not found":
cmd_found = False
msg = _("""\
# case : give information about the product in parameter
elif options.info:
- src.check_config_has_application(config)
- if options.info in config.APPLICATION.products:
- show_product_info(config, options.info, logger)
- return RCO.ReturnCode("OK", "options.info")
- raise Exception(
- _("%(product_name)s is not a product of %(application_name)s.") % \
- {'product_name' : options.info, 'application_name' : config.VARS.application} )
+ UTS.check_config_has_application(config).raiseIfKo()
+ cfg_products = config.APPLICATION.products
+ if options.info in cfg_products:
+ CFGMGR.show_product_info(config, options.info, logger)
+ return RCO.ReturnCode("OK", "product '%s' found in products" % options.info)
+ msg = _("product '%s' is not defined in application '%s'.") % \
+ (options.info, config.VARS.application)
+ logger.error(msg)
+ return RCO.ReturnCode("KO", msg)
# case : copy an existing <application>.pyconf
# to ~/.salomeTools/Applications/LOCAL_<application>.pyconf
# case : give a synthetic view of all patches used in the application
elif options.show_patchs:
- src.check_config_has_application(config)
+ UTS.check_config_has_application(config).raiseIfKo()
# Print some informations
logger.info(_('Show the patchs of application %s\n') % \
- UTS.label(config.VARS.application))
+ UTS.label(config.VARS.application))
show_patchs(config, logger)
# case: print all the products name of the application (internal use for completion)
if options.path:
l_dir_path = options.path
else:
- src.check_config_has_application(config)
+ UTS.check_config_has_application(config).raiseIfKo()
+ cfg_APP = config.APPLICATION
if options.sources:
- l_dir_path = [os.path.join(config.APPLICATION.workdir, "SOURCES")]
+ l_dir_path = [os.path.join(cfg_APP.workdir, "SOURCES")]
else:
# find all installation paths
- all_products = config.APPLICATION.products.keys()
+ all_products = cfg_APP.products.keys()
l_product_cfg = src.product.get_products_infos(all_products, config)
- l_dir_path = [pi.install_dir for __, pi in l_product_cfg]
+ l_dir_path = [pi.install_dir for tmp, pi in l_product_cfg]
# Get the files to ignore during the searching
files_ignored = default_files_ignored
msg += rep + " "
logger.info(msg + "\n")
- return 0
+ return RCO.ReturnCode("OK", "find_duplicates command done")
def list_directory(lpath, extension_ignored, files_ignored, directories_ignored):
options = self.getOptions()
# Check that the command has been called with an application
- src.check_config_has_application(config)
+ UTS.check_config_has_application(config).raiseIfKo()
logger.info( _('Generation of SALOME modules for application %s\n') % \
UTS.label(config.VARS.application) )
# If the last option is invoked, just, show the last log file
if options.last_terminal:
- src.check_config_has_application(config)
+ UTS.check_config_has_application(config).raiseIfKo()
rootLogDir = os.path.join(config.APPLICATION.workdir, 'LOGS')
UTS.ensure_path_exists(rootLogDir)
log_dirs = os.listdir(rootLogDir)
# if the package contains binaries or sources:
if options.binaries or options.sources:
# Check that the command has been called with an application
- src.check_config_has_application(config)
+ UTS.check_config_has_application(config).raiseIfKo()
# Display information
logger.info(_("Packaging application %s\n") % \
:param prop: (str) The property to filter
:param value: (str) The value of the property to filter
"""
- src.check_config_has_application(config)
+ UTS.check_config_has_application(config).raiseIfKo()
l_product_to_remove = []
for product_name in config.APPLICATION.products.keys():
prod_cfg = src.product.get_product_config(config, product_name)
l_res = []
for p_name_p_cfg in l_products:
__, prod_cfg = p_name_p_cfg
- l_patchs = src.get_cfg_param(prod_cfg, "patches", [])
+ l_patchs = UTS.get_config_key(prod_cfg, "patches", [])
if len(l_patchs)>0:
l_res.append(p_name_p_cfg)
return l_res
logger = self.getLogger()
options = self.getOptions()
- src.check_config_has_application(config)
+ UTS.check_config_has_application(config).raiseIfKo()
if options.prefix is None:
msg = _("The --%s argument is required\n") % "prefix"
logger.error(msg)
return RCO.ReturnCode("KO", msg)
- retcode = generate_profile_sources(config, options, logger)
+ returnCode = generate_profile_sources(config, options, logger)
if not options.no_update :
update_pyconf(config, options)
- return retcode
+ return returnCode
# Class that overrides common.Reference
options = self.getOptions()
# check for product
- src.check_config_has_application(config)
+ UTS.check_config_has_application(config).raiseIfKo()
# Determine launcher path
launcher_name = src.get_launcher_name(config)
# Check the launcher existence
if launcher_name not in os.listdir(launcher_dir):
message = _("""\
-The launcher %(1)s was not found in directory '%(2)s'.
-Did you run the command 'sat launcher' ?\n""") % {"1": launcher_name, "2": launcher_dir}
+The launcher %s was not found in directory '%s'.
+Did you run the command 'sat launcher' ?""") % (launcher_name, launcher_dir)
raise Exception(message)
launcher_path = os.path.join(launcher_dir, launcher_name)
{
project_file_paths :
[
- #"/volatile/wambeke/SAT5/SAT5_S840_MATIX24/SAT_SALOME/salome.pyconf",
+ "/volatile/wambeke/SAT5/SAT5_S840_MATIX24/SAT_SALOME/salome.pyconf",
# "/home/uranietm/proJET/saTJOBS/saT5/uranie.pyconf",
# cloned 2017/12 for matix
- #"/home/matix/GitRepo/uranie/saT5/uranie.pyconf",
- #"/volatile/wambeke/SAT5/SAT_MATIX/matix.pyconf"
- "/home/christian/SAT_SALOME/salome.pyconf"
- "/home/christian/SAT_MATIX/matix.pyconf"
+ "/home/matix/GitRepo/uranie/saT5/uranie.pyconf",
+ "/volatile/wambeke/SAT5/SAT_MATIX/matix.pyconf"
+ #"/home/christian/SAT_SALOME/salome.pyconf"
+ #"/home/christian/SAT_MATIX/matix.pyconf"
#"/home/christian/SAT_MATIX"
]
}
Back: BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, RESET.
Style: DIM, NORMAL, BRIGHT, RESET_ALL
-n.b. DIM is not assumed in win32
+note: DIM is not assumed in win32
"""
# dir(ST)
("<bright>", ST.BRIGHT),
("<normal>", ST.NORMAL),
("<reset>", ST.RESET_ALL),
- ("<info>", ST.RESET_ALL),
+ ("<info>", FG.MAGENTA),
("<header>", FG.BLUE),
("<label>", FG.CYAN),
("<success>", FG.GREEN),
import src.utilsSat as UTS
-C_COMPILE_ENV_LIST = ["CC",
- "CXX",
- "F77",
- "CFLAGS",
- "CXXFLAGS",
- "LIBS",
- "LDFLAGS"]
+C_COMPILE_ENV_LIST = "CC CXX F77 CFLAGS CXXFLAGS LIBS LDFLAGS".split()
class Builder:
"""
def do_script_build(self, script, number_of_proc=0):
# define make options (may not be used by the script)
if number_of_proc==0:
- nb_proc = src.get_cfg_param(self.product_info,"nb_proc", 0)
+ nb_proc = UTS.get_config_key(self.product_info,"nb_proc", 0)
if nb_proc == 0:
nb_proc = self.config.VARS.nb_proc
else:
import datetime
import shutil
import sys
+import StringIO as SIO
import src.debug as DBG
import src.loggingSat as LOG
import src.architecture as ARCH
import src.utilsSat as UTS
import src.pyconf as PYCONF
+import src.product as PROD
+import src.environment as ENVI
+import src.fileEnviron as FENV
+
class ConfigOpener:
"""
return self.user_config_file_path
def check_path(path, ext=[]):
- """Construct a text with the input path and "not found" if it does not exist.
+ """
+ Construct a text with the input path and colorized critical
+ '** not found' if it does not exist.
+ '** bad extension' if extension problem.
:param path: (str) The path to check.
- :param ext: (list)
- An extension. Verify that the path extension is in the list
+ :param ext: (list) Verify that the path extension is in the list
:return: (str) The string of the path with information
"""
# check if file exists
if not os.path.exists(path):
- return "path '%s' ** not found" % path
+ return "%s <critical>** not found" % path
# check extension
if len(ext) > 0:
fe = os.path.splitext(path)[1].lower()
if fe not in ext:
- return "path '%s' ** bad extension" % path
+ return "%s <critical>** bad extension" % path
return path
:param config: (Config) the global configuration.
:param name: (str) The name of the product
:param logger: (Logger) The logger instance to use for the display
- """
-
- def msgAdd(label, value):
+ """
+ def msgFmt(label, value):
"""
local short named macro for convenience
- appending show_product_info.msg variable
+ appending show_product_info msg variable
"""
- msg += " %s = %s\n" % (label, value)
- return
-
+ return " %s = %s\n" % (label, UTS.info(value))
+
msg = "" # used msgAdd()
- msg += _("%s is a product\n") % UTS.blue(name)
- pinfo = src.product.get_product_config(config, name)
+ msg += _("\n%s is a product\n") % UTS.label(name)
+ pinfo = PROD.get_product_config(config, name)
+ # DBG.write("pinffo", pinfo, True)
if "depend" in pinfo:
- msgAdd("depends on", ', '.join(pinfo.depend))
-
+ msg += msgFmt("depends on", ', '.join(sorted(pinfo.depend)))
+
if "opt_depend" in pinfo:
- msgAdd("optional", ', '.join(pinfo.opt_depend))
+ msg += msgFmt("optional", ', '.join(sorted(pinfo.opt_depend)))
# information on pyconf
- msg += UTS.label("configuration:\n")
+ msg += UTS.label("\nconfiguration:\n")
if "from_file" in pinfo:
- msgAdd("pyconf file path", pinfo.from_file)
+ msg += msgFmt("pyconf file path", pinfo.from_file)
if "section" in pinfo:
- msgAdd("section", pinfo.section)
+ msg += msgFmt("section", pinfo.section)
# information on prepare
- msg += UTS.label("prepare:\n")
+ msg += UTS.label("\nprepare:\n")
- is_dev = src.product.product_is_dev(pinfo)
+ is_dev = PROD.product_is_dev(pinfo)
method = pinfo.get_source
if is_dev:
method += " (dev)"
- msgAdd("get method", method)
+ msg += msgFmt("get method", method)
if method == 'cvs':
- msgAdd("server", pinfo.cvs_info.server)
- msgAdd("base module", pinfo.cvs_info.module_base)
- msgAdd("source", pinfo.cvs_info.source)
- msgAdd("tag", pinfo.cvs_info.tag)
+ msg += msgFmt("server", pinfo.cvs_info.server)
+ msg += msgFmt("base module", pinfo.cvs_info.module_base)
+ msg += msgFmt("source", pinfo.cvs_info.source)
+ msg += msgFmt("tag", pinfo.cvs_info.tag)
elif method == 'svn':
- msgAdd("repo", pinfo.svn_info.repo)
+ msg += msgFmt("repo", pinfo.svn_info.repo)
elif method == 'git':
- msgAdd("repo", pinfo.git_info.repo)
- msgAdd("tag", pinfo.git_info.tag)
+ msg += msgFmt("repo", pinfo.git_info.repo)
+ msg += msgFmt("tag", pinfo.git_info.tag)
elif method == 'archive':
- msgAdd("get from", check_path(pinfo.archive_info.archive_name))
+ msg += msgFmt("get from", check_path(pinfo.archive_info.archive_name))
if 'patches' in pinfo:
for patch in pinfo.patches:
- msgAdd("patch", check_path(patch))
+ msg += msgFmt("patch", check_path(patch))
- if src.product.product_is_fixed(pinfo):
- msgAdd("install_dir", check_path(pinfo.install_dir))
+ if PROD.product_is_fixed(pinfo):
+ msg += msgFmt("install_dir", check_path(pinfo.install_dir))
- logger.info(msg) # return possible
- if src.product.product_is_native(pinfo) or src.product.product_is_fixed(pinfo):
+ if PROD.product_is_native(pinfo) or PROD.product_is_fixed(pinfo):
+ logger.info(msg) # return possible
return
# information on compilation
- msg = "\n\n"
- if src.product.product_compiles(pinfo):
- msg += "compile:\n"
- msgAdd("compilation method", pinfo.build_source)
+ if PROD.product_compiles(pinfo):
+ msg += UTS.label("\ncompile:\n")
+ msg += msgFmt("compilation method", pinfo.build_source)
if pinfo.build_source == "script" and "compil_script" in pinfo:
- msgAdd("Compilation script", pinfo.compil_script)
+ msg += msgFmt("Compilation script", pinfo.compil_script)
if 'nb_proc' in pinfo:
- msgAdd("make -j", pinfo.nb_proc)
- msgAdd("source dir", check_path(pinfo.source_dir))
+ msg += msgFmt("make -j", pinfo.nb_proc)
+ msg += msgFmt("source dir", check_path(pinfo.source_dir))
if 'install_dir' in pinfo:
- msgAdd("build dir", check_path(pinfo.build_dir))
- msgAdd("install dir", check_path(pinfo.install_dir))
+ msg += msgFmt("build dir", check_path(pinfo.build_dir))
+ msg += msgFmt("install dir", check_path(pinfo.install_dir))
else:
msg += " %s\n" % UTS.red(_("no install dir"))
else:
msg += "%s\n" % UTS.red(_("This product does not compile"))
-
- logger.info(msg)
# information on environment
- msg = UTS.label("\nenviron:\n")
+ msg += UTS.label("\nenviron:\n")
if "environ" in pinfo and "env_script" in pinfo.environ:
- msgAdd("script", check_path(pinfo.environ.env_script))
- logger.info(msg)
-
- zz = src.environment.SalomeEnviron(
- config, src.fileEnviron.ScreenEnviron(logger), False)
- zz.set_python_libdirs()
+ msg += msgFmt("script", check_path(pinfo.environ.env_script))
+
+ outStream = SIO.StringIO()
+ screenEnv = FENV.ScreenEnviron(outStream)
+ salEnv = ENVI.SalomeEnviron(config, screenEnv, False)
- zz.set_a_product(name, logger)
+ salEnv.set_python_libdirs()
+ salEnv.set_a_product(name, logger)
+ logger.info(msg + outStream.getvalue())
return
def show_patchs(config, logger):
msg = ""
for product in config.APPLICATION.products:
nb = len_max-len(product)-2
- product_info = src.product.get_product_config(config, product)
- if src.product.product_has_patches(product_info):
+ product_info = PROD.get_product_config(config, product)
+ if PROD.product_has_patches(product_info):
msg += "<header>%s: <reset>" % product
msg += " "*nb + "%s\n" % product_info.patches[0]
if len(product_info.patches) > 1:
# Construct the list of tuple containing
# the products name and their definition
- products_infos = src.product.get_products_infos(products, cfg)
+ products_infos = PROD.get_products_infos(products, cfg)
return products_infos
\ No newline at end of file
except:
aStream.write("<blue>%s%s<reset> : '%s'\n" % (indstr, path, str(config)))
return
- for key in sorted(order):
+ for key in sorted(data): #order): # data as sort alphabetical, order as initial order
value = data[key]
strType = str(type(value))
if debug: print indstr + 'strType = %s' % strType, key
import string
import sys
+import src.utilsSat as UTS
import src.pyconf as PYCONF
+import src.product as PROD
+import src.architecture as ARCH
class Environ:
"""
:param lProducts: (list) List of products to potentially add
"""
- lProdHasGui = [p for p in lProducts if 'properties' in
- src.product.get_product_config(self.cfg, p) and
- 'has_salome_gui' in
- src.product.get_product_config(self.cfg, p).properties and
- src.product.get_product_config(self.cfg,
- p).properties.has_salome_gui=='yes']
+ lProdHasGui = [ p for p in lProducts if 'properties' in
+ PROD.get_product_config(self.cfg, p) and \
+ 'has_salome_gui' in PROD.get_product_config(self.cfg, p).properties and \
+ PROD.get_product_config(self.cfg, p).properties.has_salome_gui=='yes' ]
lProdName = []
for ProdName in lProdHasGui:
- pi = src.product.get_product_config(self.cfg, ProdName)
+ pi = PROD.get_product_config(self.cfg, ProdName)
if 'component_name' in pi:
lProdName.append(pi.component_name)
else:
elif not self.silent:
logger.warning(_("No install_dir for product %s\n") % product_info.name)
- source_in_package = src.get_property_in_product_cfg(product_info, "sources_in_package")
+ source_in_package = UTS.get_property_in_product_cfg(product_info, "sources_in_package")
if not self.for_package or source_in_package == "yes":
# set source dir, unless no source dir
- if not src.product.product_is_fixed(product_info):
+ if not PROD.product_is_fixed(product_info):
src_dir = product_info.name + "_SRC_DIR"
if not self.is_defined(src_dir):
if not self.for_package:
lib_path = os.path.join(envcompo_root_dir, 'lib', 'salome')
l_binpath_libpath.append( (bin_path, lib_path) )
- if src.get_property_in_product_cfg(pi, "fhs"):
+ if UTS.get_property_in_product_cfg(pi, "fhs"):
lib_path = os.path.join(env_root_dir, 'lib')
pylib1_path = os.path.join(env_root_dir, self.python_lib0)
pylib2_path = os.path.join(env_root_dir, self.python_lib1)
for bin_path, lib_path in l_binpath_libpath:
if not self.forBuild:
self.prepend('PATH', bin_path)
- if src.architecture.is_windows():
+ if ARCH.is_windows():
self.prepend('PATH', lib_path)
else :
self.prepend('LD_LIBRARY_PATH', lib_path)
for bin_path, lib_path in l_binpath_libpath:
if not self.forBuild:
self.prepend('PATH', bin_path)
- if src.architecture.is_windows():
+ if ARCH.is_windows():
self.prepend('PATH', lib_path)
else :
self.prepend('LD_LIBRARY_PATH', lib_path)
:param product: (str) The product name
:param logger: (Logger) The logger instance to display messages
"""
-
+ logger.debug(_("Setting environment for %s\n") % product)
+
# Get the informations corresponding to the product
- pi = src.product.get_product_config(self.cfg, product)
+ pi = PROD.get_product_config(self.cfg, product)
if self.for_package:
pi.install_dir = os.path.join("out_dir_Path", self.for_package, pi.name)
- if not self.silent:
- logger.info(_("Setting environment for %s\n") % product)
-
self.add_line(1)
self.add_comment('setting environ for ' + product)
# Do not define environment if the product is native
- if src.product.product_is_native(pi):
- if src.product.product_has_env_script(pi):
+ if PROD.product_is_native(pi):
+ if PROD.product_has_env_script(pi):
self.run_env_script(pi, native=True)
return
# Set an additional environment for SALOME products
- if src.product.product_is_salome(pi):
+ if PROD.product_is_salome(pi):
# set environment using definition of the product
self.set_salome_minimal_product_env(pi, logger)
self.set_salome_generic_product_env(pi)
- if src.product.product_is_cpp(pi):
+ if PROD.product_is_cpp(pi):
# set a specific environment for cpp modules
self.set_salome_minimal_product_env(pi, logger)
self.set_cpp_env(pi)
- if src.product.product_is_generated(pi):
+ if PROD.product_is_generated(pi):
if "component_name" in pi:
# hack the source and install directories in order to point
# on the generated product source install directories
self.run_env_script(pi, logger)
-
-
def run_env_script(self, product_info, logger=None, native=False):
"""Runs an environment script.
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import os
+import src.utilsSat as UTS
bat_header="""\
@echo off
###########################################################################
"""
-cfg_header="""[SALOME Configuration]
+cfg_header="""\
+[SALOME Configuration]
"""
-Launcher_header="""# a generated SALOME Configuration file using python syntax
+Launcher_header="""\
+# a generated SALOME Configuration file using python syntax
"""
def get_file_environ(output, shell, environ=None):
:param key: (str) the environment variable
:param command: (str) the command to execute
"""
- raise NotImplementedError("command_value is not implement "
- "for salome context files!")
+ raise NotImplementedError(
+ "command_value is not implemented for salome context files.")
def add_echo(self, text):
"""Add a comment
:param text: (str) the warning to add
"""
- self.add_comment("WARNING %s" % warning)
+ self.add_comment("WARNING %s" % warning)
def prepend_value(self, key, value, sep=os.pathsep):
"""prepend value to key using sep
def write(self, command, name, value, sign="="):
import src
- self.output.write(" %s%s %s %s %s\n" % \
- (UTS.label(command),
- " " * (12 - len(command)),
- UTS.info(name), sign, value))
+ self.output.write(" %s%s %s %s %s\n" % \
+ (UTS.label(command), " " * (12 - len(command)), UTS.info(name), sign, value) )
def is_defined(self, name):
return self.defined.has_key(name)
def run_env_script(self, module, script):
self.write("load", script, "", sign="")
+
# The SALOME launcher template
withProfile = """\
#! /usr/bin/env python
return 1
if test_base_info.get_sources == "dir":
- self.prepare_testbase_from_dir(test_base_name,
- test_base_info.info.dir)
+ self.prepare_testbase_from_dir(test_base_name, test_base_info.info.dir)
elif test_base_info.get_sources == "git":
self.prepare_testbase_from_git(test_base_name,
test_base_info.info.base,
self.config.APPLICATION.test_base.tag)
elif test_base_info.get_sources == "svn":
- svn_user = src.get_cfg_param(test_base_info.info,
+ svn_user = UTS.get_config_key(test_base_info.info,
"svn_user",
self.config.USER.svn_user)
self.prepare_testbase_from_svn(svn_user,
msg = _("An 'APPLICATION.profile' is found in config.")
return RCO.ReturnCode("OK", msg)
-
-def config_has_application(config):
- return 'APPLICATION' in config
-
-def get_cfg_param(config, param_name, default):
+def get_config_key(inConfig, key, default):
"""
- Search for param_name value in config.
- If param_name is not in config, then return default,
+ Search for key value in config node 'inConfig[key]' as 'inConfig.key'
+ If key is not in inCconfig, then return default,
else, return the found value
- :param config: (Config) The config.
- :param param_name: (str) the name of the parameter to get the value
- :param default: (str) The value to return if param_name is not in config
- :return: (str) see initial description of the function
+ :param inConfig: (Config or Mapping etc) The in-Config node.
+ :param key: (str) the name of the parameter to get the value
+ :param default: (str) The value to return if key is not in-Config
+ :return: if supposedly leaf (str),else (in-Config Node)
"""
- if param_name in config:
- return config[param_name]
- return default
+ if check_has_key(inConfig, key).isOk():
+ return inConfig[key]
+ else:
+ return default
def get_base_path(config):
"""Returns the path of the products base.