Salome HOME
bug fix in clean command
[tools/sat.git] / commands / clean.py
index 4484cb0656f5dd56c98958eb16da04a8c78eff82..03b934291fe3533b84b52e264358ab7a83937bf4 100644 (file)
@@ -143,13 +143,14 @@ def run(args, runner, logger):
     # check that the command has been called with an application
     src.check_config_has_application( runner.cfg )
 
+    # Get the list of products to threat
     products_infos = prepare.get_products_list(options, runner.cfg, logger)
 
     # Construct the list of directories to suppress
     l_dir_to_suppress = []
     if options.all:
         l_dir_to_suppress += (get_source_directories(products_infos, 
-                                                options.sources_without_dev) +
+                                            options.sources_without_dev) +
                              get_build_directories(products_infos) + 
                              get_install_directories(products_infos))
     else:
@@ -159,10 +160,14 @@ def run(args, runner, logger):
         if options.build:
             l_dir_to_suppress += get_build_directories(products_infos)
             
-        if options.source:
+        if options.source or options.sources_without_dev:
             l_dir_to_suppress += get_source_directories(products_infos, 
                                                 options.sources_without_dev)
     
+    if len(l_dir_to_suppress) == 0:
+        logger.write(src.printcolors.printcWarning(_("Nothing to suppress\n")))
+        return
+    
     # Check with the user if he really wants to suppress the directories
     if not runner.options.batch:
         logger.write(_("Remove the following directories ?\n"), 1)
@@ -175,4 +180,4 @@ def run(args, runner, logger):
     # Suppress the list of paths
     suppress_directories(l_dir_to_suppress, logger)
     
-    return 
\ No newline at end of file
+    return 0
\ No newline at end of file