Salome HOME
fix the generate command
[tools/sat.git] / commands / clean.py
index 7bf04c3d721438f0eccb672b7fbb6a1465314596..9d7b05b0e402af61933ed18a28bf70b645a8c99a 100644 (file)
@@ -32,7 +32,7 @@ parser = src.options.Options()
 parser.add_option('p', 'products', 'list2', 'products',
     _('products to clean. This option can be'
     ' passed several time to clean several products.'))
-parser.add_option('s', 'source', 'boolean', 'source', 
+parser.add_option('s', 'sources', 'boolean', 'sources', 
     _("Clean the product source directories."))
 parser.add_option('b', 'build', 'boolean', 'build', 
     _("Clean the product build directories."))
@@ -143,6 +143,7 @@ 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
@@ -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.sources 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)
@@ -170,7 +175,7 @@ def run(args, runner, logger):
             logger.write("  %s\n" % directory, 1)
         rep = input(_("Are you sure you want to continue? [Yes/No] "))
         if rep.upper() != _("YES"):
-            return
+            return 0
     
     # Suppress the list of paths
     suppress_directories(l_dir_to_suppress, logger)