From 7fc497ede4c9d2e94f72962b25e001087346fcb7 Mon Sep 17 00:00:00 2001 From: Serge Rehbinder Date: Wed, 30 Nov 2016 10:56:22 +0100 Subject: [PATCH] bug fix for options in job --- commands/job.py | 6 ++++-- salomeTools.py | 2 +- src/__init__.py | 14 ++++++++++++++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/commands/job.py b/commands/job.py index c15afdb..53a7751 100644 --- a/commands/job.py +++ b/commands/job.py @@ -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) diff --git a/salomeTools.py b/salomeTools.py index 069a324..58cf96f 100755 --- a/salomeTools.py +++ b/salomeTools.py @@ -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 diff --git a/src/__init__.py b/src/__init__.py index fb53169..d34d206 100644 --- a/src/__init__.py +++ b/src/__init__.py @@ -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. -- 2.39.2