Salome HOME
spns #40790: on Debian distributions, use dpkg-query instead of apt to check system...
[tools/sat.git] / src / compilation.py
index b8b8ce0cf8150b24ff76340da35da6ebbb019baf..751fe73b911891c94f4de45f3fa9d46768d169be 100644 (file)
@@ -38,12 +38,14 @@ class Builder:
     def __init__(self,
                  config,
                  logger,
+                 product_name,
                  product_info,
                  options = src.options.OptResult(),
                  check_src=True):
         self.config = config
         self.logger = logger
         self.options = options
+        self.product_name = product_name
         self.product_info = product_info
         self.build_dir = src.Path(self.product_info.build_dir)
         self.source_dir = src.Path(self.product_info.source_dir)
@@ -71,7 +73,7 @@ class Builder:
     ##
     # Prepares the environment.
     # Build two environment: one for building and one for testing (launch).
-    def prepare(self):
+    def prepare(self, add_env_launch=False):
 
         if not self.build_dir.exists():
             # create build dir
@@ -83,6 +85,7 @@ class Builder:
 
         # add products in depend and opt_depend list recursively
         environ_info = src.product.get_product_dependencies(self.config,
+                                                            self.product_name,
                                                             self.product_info)
         #environ_info.append(self.product_info.name)
 
@@ -93,12 +96,13 @@ class Builder:
         self.build_environ.silent = (self.config.USER.output_verbose_level < 5)
         self.build_environ.set_full_environ(self.logger, environ_info)
         
+        if add_env_launch:
         # create runtime environment
-        self.launch_environ = src.environment.SalomeEnviron(self.config,
+            self.launch_environ = src.environment.SalomeEnviron(self.config,
                                       src.environment.Environ(dict(os.environ)),
                                       False)
-        self.launch_environ.silent = True # no need to show here
-        self.launch_environ.set_full_environ(self.logger, environ_info)
+            self.launch_environ.silent = True # no need to show here
+            self.launch_environ.set_full_environ(self.logger, environ_info)
 
         for ee in C_COMPILE_ENV_LIST:
             vv = self.build_environ.get(ee)
@@ -467,6 +471,11 @@ CC=\\"hack_libtool\\"%g" libtool'''
         # in order for the compilation script to take it into account
         if src.product.product_is_hpc(self.product_info):
             self.build_environ.set("SAT_HPC", "1")
+        if self.debug_mode:
+            self.build_environ.set("SAT_DEBUG", "1")
+        if self.verbose_mode:
+            self.build_environ.set("SAT_VERBOSE", "1")
+
 
     def do_batch_script_build(self, script, nb_proc):