]> SALOME platform Git repositories - tools/sat.git/commitdiff
Salome HOME
fix #10569
authorChristian Van Wambeke <christian.van-wambeke@cea.fr>
Thu, 22 Mar 2018 09:49:18 +0000 (10:49 +0100)
committerChristian Van Wambeke <christian.van-wambeke@cea.fr>
Thu, 22 Mar 2018 09:49:18 +0000 (10:49 +0100)
commands/clean.py
commands/prepare.py
src/product.py

index 07239bc4a8a384f9dec1944e6ab61395ddf45f1a..805fa9a3a10a69d9c00b532e3f6dade36a796cd0 100644 (file)
@@ -226,11 +226,10 @@ def run(args, runner, logger):
     
     if len(l_dir_to_suppress) == 0:
         logger.write(src.printcolors.printcWarning(_("Nothing to suppress\n")))
-        sat_command = (runner.cfg.VARS.salometoolsway +
-                       runner.cfg.VARS.sep +
-                       "sat -h clean") 
-        logger.write(_("Please specify what you want to suppress: "
-                       "tap \"%s\"\n" % sat_command))
+        logger.write(_("""\
+Please specify what you want to suppress:
+try 'sat --help clean' and 'sat clean ... --products ... --sources --build --install
+"""))
         return
     
     # Check with the user if he really wants to suppress the directories
@@ -245,4 +244,4 @@ def run(args, runner, logger):
     # Suppress the list of paths
     suppress_directories(l_dir_to_suppress, logger)
     
-    return 0
\ No newline at end of file
+    return 0
index bdacf4fe486d0396c8b2fc5a702f3cff62b23e71..ddd0de3d82536243644ae9b5f40941eb236b44e8 100644 (file)
@@ -20,6 +20,7 @@ import re
 import os
 
 import src
+import src.debug as DBG
 
 # Define all possible option for prepare command :  sat prepare <options>
 parser = src.options.Options()
@@ -72,14 +73,23 @@ def remove_products(arguments, l_products_info, logger):
     :return: The updated arguments.
     :rtype: str
     '''
-    args = arguments
-    for i, (product_name, __) in enumerate(l_products_info):
-        args = args.replace(',' + product_name, '')
-        end_text = ', '
-        if i+1 == len(l_products_info):
-            end_text = '\n'            
-        logger.write(product_name + end_text, 1)
-    return args
+    args = str(arguments) #copy of "--products ,XDATA,TESSCODE,cmake" for example
+    largs = args.split(',')
+    DBG.write("largs", largs)
+    toRemove = [name for name,_ in l_products_info]
+    DBG.write("remove_products", toRemove)
+    removed = []
+    notRemoved = []
+    for name in largs[1:]: # skip largs[0] as "--products "
+      if name in toRemove:
+        removed.append(name)
+      else:
+        notRemoved.append(name)
+    # DBG.write(removed, removed, True)
+    logger.write("  %s\n" % ",".join(removed), 1)
+    DBG.write("notRemoved", notRemoved)
+    res = largs[0] + ",".join(notRemoved)
+    return res
 
 def find_products_already_getted(l_products):
     '''function that returns the list of products that have an existing source 
@@ -149,9 +159,10 @@ def run(args, runner, logger):
     if not options.force and len(ldev_products) > 0:
         l_products_not_getted = find_products_already_getted(ldev_products)
         if len(l_products_not_getted) > 0:
-            msg = _("Do not get the source of the following products "
-                    "in development mode\nUse the --force option to"
-                    " overwrite it.\n")
+            msg = _("""\
+Do not get the source of the following products in development mode
+Use the --force option to overwrite it.
+""")
             logger.write(src.printcolors.printcWarning(msg), 1)
             args_product_opt_clean = remove_products(args_product_opt_clean,
                                                      l_products_not_getted,
@@ -163,9 +174,10 @@ def run(args, runner, logger):
     if not options.force_patch and len(ldev_products) > 0:
         l_products_with_patchs = find_products_with_patchs(ldev_products)
         if len(l_products_with_patchs) > 0:
-            msg = _("do not patch the following products "
-                    "in development mode\nUse the --force_patch option to"
-                    " overwrite it.\n")
+            msg = _("""\
+do not patch the following products in development mode
+Use the --force_patch option to overwrite it.
+""")
             logger.write(src.printcolors.printcWarning(msg), 1)
             args_product_opt_patch = remove_products(args_product_opt_patch,
                                                      l_products_with_patchs,
@@ -220,4 +232,4 @@ def run(args, runner, logger):
         else:
             logger.write('%s\n' % src.printcolors.printc(src.KO_STATUS), 5)
     
-    return res_clean + res_source + res_patch
\ No newline at end of file
+    return res_clean + res_source + res_patch
index a7acab6ca4b1426332d10c2a228d59d3f1b2732d..3591f259513fbf87bfb8fc8259a88156f82bc692 100644 (file)
@@ -233,20 +233,23 @@ Please provide a 'compil_script' key in its definition.""") % product_name
     # Get the full paths of all the patches
     if product_has_patches(prod_info):
         patches = []
-        for patch in prod_info.patches:
-            patch_path = patch
-            # If only a filename, then search for the patch in the PRODUCTPATH
-            if os.path.basename(patch_path) == patch_path:
-                # Search in the PRODUCTPATH/patches
-                patch_path = src.find_file_in_lpath(patch,
-                                                    config.PATHS.PRODUCTPATH,
-                                                    "patches")
-                if not patch_path:
-                    msg = _("Patch %(patch_name)s for %(prod_name)s not found:"
-                            "\n" % {"patch_name" : patch,
-                                     "prod_name" : prod_info.name}) 
-                    raise src.SatException(msg)
-            patches.append(patch_path)
+        try:
+          for patch in prod_info.patches:
+              patch_path = patch
+              # If only a filename, then search for the patch in the PRODUCTPATH
+              if os.path.basename(patch_path) == patch_path:
+                  # Search in the PRODUCTPATH/patches
+                  patch_path = src.find_file_in_lpath(patch,
+                                                      config.PATHS.PRODUCTPATH,
+                                                      "patches")
+                  if not patch_path:
+                      msg = _("Patch %(patch_name)s for %(prod_name)s not found:"
+                              "\n" % {"patch_name" : patch,
+                                       "prod_name" : prod_info.name}) 
+                      raise src.SatException(msg)
+              patches.append(patch_path)
+        except:
+          DBG.tofix("problem in prod_info.patches", prod_info)
         prod_info.patches = patches
 
     # Get the full paths of the environment scripts
@@ -621,7 +624,10 @@ def product_is_dev(product_info):
     :rtype: boolean
     '''
     dev = product_info.dev
-    return dev.lower() == 'yes'
+    res = (dev.lower() == 'yes')
+    DBG.write('product_is_dev %s' % product_info.name, res)
+    # if product_info.name == "XDATA": return True #test #10569
+    return res
 
 def product_is_debug(product_info):
     '''Know if a product is in debug mode
@@ -734,8 +740,11 @@ def product_has_patches(product_info):
                                the product
     :return: True if the product has one or more patches
     :rtype: boolean
-    '''
-    return "patches" in product_info and len(product_info.patches) > 0
+    '''   
+    res = ( "patches" in product_info and len(product_info.patches) > 0 )
+    DBG.write('product_has_patches %s' % product_info.name, res)
+    # if product_info.name == "XDATA": return True #test #10569
+    return res
 
 def product_has_logo(product_info):
     '''Know if a product has a logo (YACSGEN generate)