_("Optional: print the debugging mode value of CONFIG_VARIABLE."))
parser.add_option('e', 'edit', 'boolean', 'edit',
_("Optional: edit the product configuration file."))
-parser.add_option('i', 'info', 'string', 'info',
+parser.add_option('i', 'info', 'list2', 'info',
_("Optional: get information on a product."))
parser.add_option('l', 'list', 'boolean', 'list',
_("Optional: list all available applications."))
'''
oneOrMore = False
for product in sorted(config.APPLICATION.products):
- product_info = src.product.get_product_config(config, product)
- if src.product.product_has_patches(product_info):
- oneOrMore = True
- logger.write("%s:\n" % product, 1)
- for i in product_info.patches:
- logger.write(src.printcolors.printcInfo(" %s\n" % i), 1)
+ try:
+ product_info = src.product.get_product_config(config, product)
+ if src.product.product_has_patches(product_info):
+ oneOrMore = True
+ logger.write("%s:\n" % product, 1)
+ for i in product_info.patches:
+ logger.write(src.printcolors.printcInfo(" %s\n" % i), 1)
+ except Exception as e:
+ msg = "problem on product %s\n%s\n" % (product, str(e))
+ logger.error(msg)
+
if oneOrMore:
logger.write("\n", 1)
else:
'''
oneOrMore = False
for product in sorted(config.APPLICATION.products):
- product_info = src.product.get_product_config(config, product)
- done = False
try:
- for i in product_info.properties:
- if not done:
- logger.write("%s:\n" % product, 1)
- done = True
- oneOrMore = True
- logger.write(src.printcolors.printcInfo(" %s\n" % i), 1)
- except:
+ product_info = src.product.get_product_config(config, product)
+ done = False
+ try:
+ for i in product_info.properties:
+ if not done:
+ logger.write("%s:\n" % product, 1)
+ done = True
+ oneOrMore = True
+ logger.write(src.printcolors.printcInfo(" %s\n" % i), 1)
+ except Exception as e:
+ pass
+ except Exception as e:
# logger.write(src.printcolors.printcInfo(" %s\n" % "no properties"), 1)
- pass
+ msg = "problem on product %s\n%s\n" % (product, e)
+ logger.error(msg)
+
if oneOrMore:
logger.write("\n", 1)
else:
src.system.show_in_editor(editor, pyconf_path, logger)
break
- # case : give information about the product in parameter
+ # case : give information about the product(s) in parameter
if options.info:
- src.check_config_has_application(runner.cfg)
- if options.info in runner.cfg.APPLICATION.products:
- show_product_info(runner.cfg, options.info, logger)
- # return
+ # DBG.write("products", sorted(runner.cfg.APPLICATION.products.keys()), True)
+ src.check_config_has_application(runner.cfg)
+ taggedProducts = src.getProductNames(runner.cfg, options.info, logger)
+ DBG.write("tagged products", sorted(taggedProducts))
+ for prod in sorted(taggedProducts):
+ if prod in runner.cfg.APPLICATION.products:
+ try:
+ if len(taggedProducts) > 1:
+ logger.write("#################### ", 2)
+ show_product_info(runner.cfg, prod, logger)
+ except Exception as e:
+ msg = "problem on product %s\n%s\n" % (prod, str(e))
+ logger.error(msg)
+ # return
else:
- msg = _("%s is not a product of %s.") % \
- (options.info, runner.cfg.VARS.application)
- raise Exception(msg)
+ msg = _("%s is not a product of %s.\n") % \
+ (prod, runner.cfg.VARS.application)
+ logger.warning(msg)
+ #raise Exception(msg)
# case : copy an existing <application>.pyconf
# to ~/.salomeTools/Applications/LOCAL_<application>.pyconf
+++ /dev/null
-../../../../src/custom.css
\ No newline at end of file
--- /dev/null
+/* This file is for theme alabaster custom. */
+
+/*
+http://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html
+set backquotes: ``text`` for code samples more color red
+*/
+tt, code {
+ background-color: #ecf0f3;
+ color: #842;
+ /* padding: 1px 2px; */
+}
+
+/*
+set 'Note:' etc size less than titles
+*/
+div.admonition p.admonition-title {
+ font-family: {{ theme_head_font_family }};
+ font-weight: normal;
+ font-size: 16px;
+ margin: 0 0 10px 0;
+ padding: 0;
+ line-height: 1;
+}
+
+
import shutil
import errno
import stat
+import fnmatch
from . import pyconf
from . import architecture
return config[param_name]
return default
+
+def getProductNames(cfg, wildcards, logger):
+ """get products names using * or ? as wildcards like shell Linux"""
+ res = []
+ if type(wildcards) is list:
+ wilds = wildcards
+ else:
+ wilds = [wildcards]
+ products = cfg.APPLICATION.products.keys()
+ for prod in products:
+ for wild in wildcards:
+ filtered = fnmatch.filter([prod], wild)
+ # print("filtered", prod, wild, filtered)
+ if len(filtered) > 0:
+ res.append(prod)
+ break
+ if len(res) == 0:
+ logger.warning("Empty list of products, from %s" % wilds)
+ return res
+
+
def print_info(logger, info):
"""\
Prints the tuples that are in info variable in a formatted way.
if not prod_pyconf_path:
msg = _("""\
No definition found for the product %(1)s.
-Please create a %(2)s.pyconf file somewhere in:
-%(3)s""") % {
- "1": product_name,
- "2": product_name,
- "3": config.PATHS.PRODUCTPATH }
+Please create a %(1)s.pyconf file somewhere in:
+ %(2)s""") % {
+ "1": product_name,
+ "2": PP.pformat(config.PATHS.PRODUCTPATH) }
else:
msg = _("""\
No definition corresponding to the version %(1)s was found in the file:
# if section is not None, try to get the corresponding section
aProd = config.PRODUCTS[product_name]
- versionMMP = VMMP.MinorMajorPatch(version)
+ try:
+ versionMMP = VMMP.MinorMajorPatch(version)
+ except: # example setuptools raise "minor in major_minor_patch is not integer: '0_6c11'"
+ versionMMP = None
DBG.write("get_product_section for product %s '%s' as '%s'" % (product_name, version, versionMMP),
(section, aProd.keys()), verbose)
# DBG.write("yoo1", aProd, True)
# Else, check if there is a description for multiple versions
l_section_names = aProd.keys()
l_section_ranges = []
+ tagged = []
for name in l_section_names:
# DBG.write("name", name,True)
aRange = VMMP.getRange_majorMinorPatch(name)
l_section_ranges.append((name, aRange))
if len(l_section_ranges) > 0:
- tagged = []
for name, (vmin, vmax) in l_section_ranges:
if versionMMP >= vmin and versionMMP <= vmax:
tagged.append((name, [vmin, vmax]))
prod_info.from_file = aProd.from_file
return prod_info
- """
- l_section_name = aProd.keys()
- l_section_ranges = [section_name for section_name in l_section_name
- if VERSION_DELIMITER in section_name]
- for section_range in l_section_ranges:
- minimum, maximum = section_range.split(VERSION_DELIMITER)
- if (src.only_numbers(version) >= src.only_numbers(minimum)
- and src.only_numbers(version) <= src.only_numbers(maximum)):
- # returns specific information for the versions
- prod_info = aProd[section_range]
- prod_info.section = section_range
- prod_info.from_file = aProd.from_file
- return prod_info
- """
-
# Else, get the standard informations
if "default" in aProd:
# returns the generic information (given version not found)
else:
# if option --products, check that all products of the command line
# are present in the application.
- products = options.products
+ """products = options.products
for p in products:
if p not in cfg.APPLICATION.products:
raise src.SatException(_("Product %(product)s "
"not defined in application %(application)s") %
- { 'product': p, 'application': cfg.VARS.application} )
+ { 'product': p, 'application': cfg.VARS.application} )"""
+
+ products = src.getProductNames(cfg, options.products, logger)
# Construct the list of tuple containing
# the products name and their definition