]> SALOME platform Git repositories - tools/sat.git/blobdiff - src/product.py
Salome HOME
correction bug introduit par 6cb6aac483a7d637f972f70e10500411e4cecfaf
[tools/sat.git] / src / product.py
index 04ade2e8a6ad1e021eaa6fc2537cdc0c4019e44c..7ce6866b9b22172908a7c585b8a3ff4bed32c4fc 100644 (file)
@@ -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:
@@ -470,19 +485,23 @@ def add_compile_config_file(p_info, config):
     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):
     """\
@@ -651,27 +670,6 @@ def get_products_list(options, cfg, logger):
     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