]> SALOME platform Git repositories - tools/sat.git/commitdiff
Salome HOME
sat package: add option without_commercial
authorSerge Rehbinder <serge.rehbinder@cea.fr>
Wed, 25 Jan 2017 14:31:28 +0000 (15:31 +0100)
committerSerge Rehbinder <serge.rehbinder@cea.fr>
Wed, 25 Jan 2017 14:31:28 +0000 (15:31 +0100)
commands/package.py
src/environment.py

index be3a01a7db280db4fa2b312c0ba7929b774ff7f9..6ae96f8109cc9cd1d43cb342a7d07a08746da77b 100644 (file)
@@ -97,6 +97,8 @@ parser.add_option('n', 'name', 'string', 'name',
     _('Optional: The name or full path of the archive.'), None)
 parser.add_option('', 'add_files', 'list2', 'add_files',
     _('Optional: The list of additional files to add to the archive.'), [])
+parser.add_option('', 'without_commercial', 'boolean', 'with_commercial',
+    _('Optional: do not add commercial licence.'), False)
 
 def add_files(tar, name_archive, d_content, logger):
     '''Create an archive containing all directories and files that are given in
@@ -140,7 +142,8 @@ def produce_relative_launcher(config,
                               logger,
                               file_dir,
                               file_name,
-                              binaries_dir_name):
+                              binaries_dir_name,
+                              with_commercial=True):
     '''Create a specific SALOME launcher for the binary package. This launcher 
        uses relative paths.
     
@@ -179,7 +182,9 @@ def produce_relative_launcher(config,
     launch_file = open(filepath, "w")
     launch_file.write(before)
     # Write
-    writer.write_cfgForPy_file(launch_file, for_package = binaries_dir_name)
+    writer.write_cfgForPy_file(launch_file,
+                               for_package = binaries_dir_name,
+                               with_commercial=with_commercial)
     launch_file.write(after)
     launch_file.close()
     
@@ -305,10 +310,11 @@ def binary_package(config, logger, options, tmp_working_dir):
     if "profile" in config.APPLICATION:
         launcher_name = config.APPLICATION.profile.launcher_name
         launcher_package = produce_relative_launcher(config,
-                                                     logger,
-                                                     tmp_working_dir,
-                                                     launcher_name,
-                                                     binaries_dir_name)
+                                             logger,
+                                             tmp_working_dir,
+                                             launcher_name,
+                                             binaries_dir_name,
+                                             not(options.without_commercial))
     
         d_products["launcher"] = (launcher_package, launcher_name)
     else:
index f74d761f4d4e78e44817859bb3dea53e668178cd..0634ec5a40b5d4159a74ea1a08b9267739b21546 100644 (file)
@@ -167,7 +167,12 @@ class SalomeEnviron:
     """Class to manage the environment of SALOME.
     """
 
-    def __init__(self, cfg, environ, forBuild=False, for_package=None):
+    def __init__(self,
+                 cfg,
+                 environ,
+                 forBuild=False,
+                 for_package=None,
+                 enable_simple_env_script = True):
         '''Initialization.
 
         :param cfg Config: the global config
@@ -182,6 +187,7 @@ class SalomeEnviron:
         self.cfg = cfg
         self.forBuild = forBuild
         self.for_package = for_package
+        self.enable_simple_env_script = enable_simple_env_script
         self.silent = False
 
     def __repr__(self):
@@ -630,6 +636,8 @@ class SalomeEnviron:
         :param script_path str: a path to an environment script
         :param logger Logger: The logger instance to display messages
         """
+        if not self.enable_simple_env_script:
+            return
         # Check that the script exists
         if not os.path.exists(script_path):
             raise src.SatException(_("Environment script not found: %s") % 
@@ -768,7 +776,8 @@ class FileEnvWriter:
     def write_cfgForPy_file(self,
                             filename,
                             additional_env = {},
-                            for_package = None):
+                            for_package = None,
+                            with_commercial = True):
         """Append to current opened aFile a cfgForPy 
            environment (SALOME python launcher).
            
@@ -790,7 +799,8 @@ class FileEnvWriter:
         env = SalomeEnviron(self.config,
                             tmp,
                             forBuild=False,
-                            for_package=for_package)
+                            for_package=for_package,
+                            enable_simple_env_script = with_commercial)
         env.silent = self.silent
 
         if self.env_info is not None: