Salome HOME
begin to fix 8596, 8908, 8605, 8638, 10458, 8646, 8576
[tools/sat.git] / src / product.py
index 3ee4847b2e3f4deaeb07a5626e9a96c992c47db5..81ad048a261fc04f14236e95b431a40b0b7298bc 100644 (file)
@@ -145,13 +145,18 @@ def get_product_config(config, product_name, with_install_dir=True):
         prod_pyconf_path = src.find_file_in_lpath(product_name + ".pyconf",
                                                   config.PATHS.PRODUCTPATH)
         if not prod_pyconf_path:
-            msg = _("No definition found for the product %s\n"
-               "Please create a %s.pyconf file." % (product_name, product_name))
+            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 }
         else:
-            msg = _("No definition corresponding to the version %(version)s was"
-                    " found in the file %(prod_file_path)s.\nPlease add a "
-                    "section in it." % {"version" : vv,
-                                        "prod_file_path" : prod_pyconf_path} )
+            msg = _("""\
+No definition corresponding to the version %(1)s was found in the file:
+  %(2)s.
+Please add a section in it.""") % {"1" : vv, "2" : prod_pyconf_path}
         raise src.SatException(msg)
     
     # Set the debug, dev and version keys
@@ -170,9 +175,8 @@ def get_product_config(config, product_name, with_install_dir=True):
             arch_path = src.find_file_in_lpath(arch_name,
                                                config.PATHS.ARCHIVEPATH)
             if not arch_path:
-                msg = _("Archive %(arch_name)s for %(prod_name)s not found:"
-                            "\n" % {"arch_name" : arch_name,
-                                     "prod_name" : prod_info.name}) 
+                msg = _("Archive %(1)s for %(2)s not found.\n") % \
+                       {"1" : arch_name, "2" : prod_info.name}
                 raise src.SatException(msg)
             prod_info.archive_info.archive_name = arch_path
         else:
@@ -183,9 +187,8 @@ def get_product_config(config, product_name, with_install_dir=True):
                                             arch_name,
                                             config.PATHS.ARCHIVEPATH)
                 if not arch_path:
-                    msg = _("Archive %(arch_name)s for %(prod_name)s not found:"
-                                "\n" % {"arch_name" : arch_name,
-                                         "prod_name" : prod_info.name}) 
+                    msg = _("Archive %(1)s for %(2)s not found:\n") % \
+                           {"1" : arch_name, "2" : prod_info.name}
                     raise src.SatException(msg)
                 prod_info.archive_info.archive_name = arch_path
         
@@ -194,9 +197,9 @@ def get_product_config(config, product_name, with_install_dir=True):
     if product_has_script(prod_info):
         # Check the compil_script key existence
         if "compil_script" not in prod_info:
-            msg = _("No compilation script found for the product %s\n"
-                "Please provide a \"compil_script\" key in its definition." 
-                % (product_name))
+            msg = _("""\
+No compilation script found for the product %s.
+Please provide a 'compil_script' key in its definition.""") % product_name
             raise src.SatException(msg)
         
         # Get the path of the script
@@ -208,17 +211,18 @@ def get_product_config(config, product_name, with_install_dir=True):
                                                  config.PATHS.PRODUCTPATH,
                                                  "compil_scripts")
             if not script_path:
-                raise src.SatException(_("Compilation script not found: %s") % 
-                                   script_name)
+                raise src.SatException(
+                    _("Compilation script not found: %s") % script_name)
             prod_info.compil_script = script_path
             if src.architecture.is_windows():
                 prod_info.compil_script = prod_info.compil_script[:-len(".sh")] + ".bat"
        
         # Check that the script is executable
         if not os.access(prod_info.compil_script, os.X_OK):
-            raise src.SatException(
-                    _("Compilation script cannot be executed: %s") % 
-                    prod_info.compil_script)
+            #raise src.SatException(
+            #        _("Compilation script cannot be executed: %s") % 
+            #        prod_info.compil_script)
+            print("WARNING: Compilation script cannot be executed:\n         %s" % prod_info.compil_script)
     
     # Get the full paths of all the patches
     if product_has_patches(prod_info):
@@ -295,6 +299,7 @@ def get_product_section(config, product_name, version, section=None):
         # returns specific information for the given version
         prod_info = config.PRODUCTS[product_name][section]
         prod_info.section = section
+        prod_info.from_file = config.PRODUCTS[product_name].from_file
         return prod_info
 
     # If it exists, get the information of the product_version
@@ -302,6 +307,7 @@ def get_product_section(config, product_name, version, section=None):
         # returns specific information for the given version
         prod_info = config.PRODUCTS[product_name]["version_" + version]
         prod_info.section = "version_" + version
+        prod_info.from_file = config.PRODUCTS[product_name].from_file
         return prod_info
     
     # Else, check if there is a description for multiple versions
@@ -315,6 +321,7 @@ def get_product_section(config, product_name, version, section=None):
             # returns specific information for the versions
             prod_info = config.PRODUCTS[product_name][section_range]
             prod_info.section = section_range
+            prod_info.from_file = config.PRODUCTS[product_name].from_file
             return prod_info
     
     # Else, get the standard informations
@@ -322,6 +329,7 @@ def get_product_section(config, product_name, version, section=None):
         # returns the generic information (given version not found)
         prod_info = config.PRODUCTS[product_name].default
         prod_info.section = "default"
+        prod_info.from_file = config.PRODUCTS[product_name].from_file
         return prod_info
     
     # if noting was found, return None
@@ -545,18 +553,16 @@ def product_is_sample(product_info):
         return False
 
 def product_is_salome(product_info):
-    '''Know if a product is of type salome
+    '''Know if a product is a SALOME module
     
     :param product_info Config: The configuration specific to 
                                the product
-    :return: True if the product is salome, else False
+    :return: True if the product is a SALOME module, else False
     :rtype: boolean
     '''
-    if 'type' in product_info:
-        ptype = product_info.type
-        return ptype.lower() == 'salome'
-    else:
-        return False
+    return ("properties" in product_info and
+            "is_SALOME_module" in product_info.properties and
+            product_info.properties.is_SALOME_module == "yes")
 
 def product_is_fixed(product_info):
     '''Know if a product is fixed
@@ -634,18 +640,6 @@ def product_is_vcs(product_info):
     '''
     return product_info.get_source in AVAILABLE_VCS
 
-def product_is_SALOME(product_info):
-    '''Know if a product is a SALOME module
-    
-    :param product_info Config: The configuration specific to 
-                               the product
-    :return: True if the product is a SALOME module, else False
-    :rtype: boolean
-    '''
-    return ("properties" in product_info and
-            "is_SALOME_module" in product_info.properties and
-            product_info.properties.is_SALOME_module == "yes")
-
 def product_is_smesh_plugin(product_info):
     '''Know if a product is a SMESH plugin
     
@@ -784,4 +778,4 @@ def get_product_components(product_info):
         if isinstance(compo_list, str):
             compo_list = [ compo_list ]
 
-    return compo_list
\ No newline at end of file
+    return compo_list