Salome HOME
Mise à jour du template PythonComponent
[tools/sat.git] / commands / generate.py
index c1c66c756fe9b1c42c550726fdb1ea151ac9d2cd..b34b0b6b684cdca138aedda1f6c45e41382ccce9 100644 (file)
@@ -23,6 +23,7 @@ import imp
 import subprocess
 
 import src
+import src.debug as DBG
 
 parser = src.options.Options()
 parser.add_option('p', 'products', 'list2', 'products',
@@ -270,7 +271,7 @@ def check_yacsgen(config, directory, logger):
         yacsgen_info = src.product.get_product_config(config, 'YACSGEN')
         yacsgen_dir = yacsgen_info.install_dir
         yacs_src = _("Using YACSGEN from application")
-    elif os.environ.has_key("YACSGEN_ROOT_DIR"):
+    elif "YACSGEN_ROOT_DIR" in os.environ:
         yacsgen_dir = os.getenv("YACSGEN_ROOT_DIR")
         yacs_src = _("Using YACSGEN from environment")
 
@@ -368,6 +369,15 @@ def run(args, runner, logger):
             logger.write(_("not a generated product\n"), 3, False)
             continue
 
+        logger.write(_("\nCleaning generated directories\n"), 3, False)
+        # clean source, build and install directories of the generated product
+        # no verbosity to avoid warning at the first generation, for which dirs don't exist
+        runner.clean(runner.cfg.VARS.application + 
+                  " --products " + pi.name + 
+                  " --generated",
+                  batch=True,
+                  verbose=0,
+                  logger_add_link = logger)
         nbgen += 1
         try:
             result = generate_component_list(runner.cfg,