Salome HOME
bug fix for options in job
authorSerge Rehbinder <serge.rehbinder@cea.fr>
Wed, 30 Nov 2016 09:56:22 +0000 (10:56 +0100)
committerSerge Rehbinder <serge.rehbinder@cea.fr>
Wed, 30 Nov 2016 09:56:22 +0000 (10:56 +0100)
commands/job.py
salomeTools.py
src/__init__.py

index c15afdb42988ef8288d48b31f773e45d742136e3..53a7751b570f723541040e4561cbb234106c1420 100644 (file)
@@ -118,7 +118,8 @@ def run(args, runner, logger):
         if cmd_exe == "sat":
             # use the salomeTools parser to get the options of the command
             sat_parser = salomeTools.parser
-            (options, argus) = sat_parser.parse_args(command.split(' ')[1:])
+            input_parser = src.remove_item_from_list(command.split(' ')[1:], "")
+            (options, argus) = sat_parser.parse_args(input_parser)
             # Verify if there is a changed option
             for attr in dir(options):
                 if attr.startswith("__"):
@@ -135,8 +136,9 @@ def run(args, runner, logger):
         if not(specific_option):
             options = None
 
-        # Get dynamically the command function to call 
+        # Get dynamically the command function to call
         sat_command = runner.__getattr__(sat_command_name)
+
         logger.write("Executing " + 
                      src.printcolors.printcLabel(command) + " ", 3)
         logger.write("." * (len_max_command - len(command)) + " ", 3)
index 069a3245ae8228b775a03ff8d41278a900707cf3..58cf96f4daa4028ded0daaf290e0d5da857b60bb 100755 (executable)
@@ -251,6 +251,7 @@ class Sat(object):
                                              str(e)))
                         self.options.logs_paths_in_file = None
                 
+                options_launched = ""
                 try:
                     res = None
                     # Execute the hooks (if there is any) 
@@ -264,7 +265,6 @@ class Sat(object):
                         res = 0
                     
                     # come back to the original global options
-                    options_launched = ""
                     if options:
                         options_launched = get_text_from_options(self.options)
                         self.options = options_save
index fb5316936c1d56348647adfde5c5f649821eef05..d34d206f18e80278b976070829ef0ab6e83944aa 100644 (file)
@@ -322,6 +322,20 @@ def deepcopy_list(input_list):
         res.append(elem)
     return res
 
+def remove_item_from_list(input_list, item):
+    """ Remove all occurences of item from input_list
+    
+    :param input_list List: The list to modify
+    :return: The without any item
+    :rtype: List
+    """
+    res = []
+    for elem in input_list:
+        if elem == item:
+            continue
+        res.append(elem)
+    return res
+
 def parse_date(date):
     """Transform YYYYMMDD_hhmmss into YYYY-MM-DD hh:mm:ss.