From 9eb62e60f4c2b23cc72e415725a6690b62ec2dbc Mon Sep 17 00:00:00 2001 From: crouzet Date: Mon, 7 Jan 2019 11:30:26 +0100 Subject: [PATCH] add globals for dev, debug, verbose --- src/product.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/product.py b/src/product.py index 627e82a..3eadca1 100644 --- a/src/product.py +++ b/src/product.py @@ -49,9 +49,6 @@ def get_product_config(config, product_name, with_install_dir=True): # 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 @@ -61,6 +58,18 @@ def get_product_config(config, product_name, with_install_dir=True): 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 @@ -72,14 +81,20 @@ def get_product_config(config, product_name, with_install_dir=True): # 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: -- 2.39.2