]> SALOME platform Git repositories - modules/kernel.git/blobdiff - bin/launchConfigureParser.py
Salome HOME
Fix for Bug NPAL16630 (runSalome and runAppli use python option "-i" when it has...
[modules/kernel.git] / bin / launchConfigureParser.py
index 2807e34f19ba9a57877eca8cfeadae2a4e8544c2..575c32061c9d525c61c10dfa56c08e63f2a73d4f 100755 (executable)
@@ -48,6 +48,7 @@ key_nam        = "key"
 interp_nam     = "interp"
 except_nam     = "noexcepthandler"
 terminal_nam   = "terminal"
+pinter_nam     = "pinter"
 
 # values in XML configuration file giving specific module parameters (<module_name> section)
 # which are stored in opts with key <module_name>_<parameter> (eg SMESH_plugins)
@@ -61,7 +62,7 @@ script_nam     = "pyscript"
 
 # values of boolean type (must be '0' or '1').
 # xml_parser.boolValue() is used for correct setting
-boolKeys = ( gui_nam, splash_nam, logger_nam, file_nam, xterm_nam, portkill_nam, killall_nam, except_nam )
+boolKeys = ( gui_nam, splash_nam, logger_nam, file_nam, xterm_nam, portkill_nam, killall_nam, except_nam, pinter_nam )
 intKeys = ( interp_nam, )
 
 # values of list type
@@ -187,31 +188,29 @@ class xml_parser:
     def boolValue( self, str ):
         strloc = str
         if isinstance(strloc, types.UnicodeType):
-            strloc = strloc.encode().strip().lower()
+            strloc = strloc.encode().strip()
         if isinstance(strloc, types.StringType):
-            if strloc in   ("1", "yes", "y", "on", "true", "ok"):
+            strlow = strloc.lower()
+            if strlow in   ("1", "yes", "y", "on", "true", "ok"):
                 return True
-            elif strloc in ("0", "no", "n", "off", "false", "cancel"):
+            elif strlow in ("0", "no", "n", "off", "false", "cancel"):
                 return False
-            else:
-                return None
-        else:
-            return strloc
+        return strloc
         pass
 
     def intValue( self, str ):
         strloc = str
         if isinstance(strloc, types.UnicodeType):
-            strloc = strloc.encode().strip().lower()
+            strloc = strloc.encode().strip()
         if isinstance(strloc, types.StringType):
-            if strloc in   ("1", "yes", "y", "on", "true", "ok"):
+            strlow = strloc.lower()
+            if strlow in   ("1", "yes", "y", "on", "true", "ok"):
                 return 1
-            elif strloc in ("0", "no", "n", "off", "false", "cancel"):
+            elif strlow in ("0", "no", "n", "off", "false", "cancel"):
                 return 0
             else:
                 return string.atoi(strloc)
-        else:
-            return strloc
+        return strloc
         pass
 
     def startElement(self, name, attrs):
@@ -488,6 +487,13 @@ def CreateOptionParser (theAdditionalOptions=[]):
                           dest="save_config", default=True,
                           help=help_str)
 
+    # Launch with interactive python console. Default: False.
+    help_str = "Launch with interactive python console."
+    o_pi = optparse.Option("--pinter",
+                          action="store_true",
+                          dest="pinter",
+                          help=help_str)
+
     # All options
     opt_list = [o_t,o_g, # GUI/Terminal
                 o_d,o_o, # Desktop
@@ -504,7 +510,9 @@ def CreateOptionParser (theAdditionalOptions=[]):
                 o_z,     # Splash
                 o_c,     # Catch exceptions
                 o_a,     # Print free port and exit
-                o_n]     # --nosave-config
+                o_n,     # --nosave-config
+                o_pi]     # Interactive python console
+                
 
     #std_options = ["gui", "desktop", "log_file", "py_scripts", "resources",
     #               "xterm", "modules", "embedded", "standalone",
@@ -669,7 +677,7 @@ def get_env(theAdditionalOptions=[], appname="SalomeApp"):
     # Options: gui, desktop, log_file, py_scripts, resources,
     #          xterm, modules, embedded, standalone,
     #          portkill, killall, interp, splash,
-    #          catch_exceptions
+    #          catch_exceptions, pinter
 
     # GUI/Terminal, Desktop, Splash, STUDY_HDF
     args["session_gui"] = False
@@ -695,7 +703,7 @@ def get_env(theAdditionalOptions=[], appname="SalomeApp"):
         if cmd_opts.log_file == 'CORBA':
             args[logger_nam] = True
         else:
-            args[file_nam] = cmd_opts.log_file
+            args[file_nam] = [cmd_opts.log_file]
 
     # Python scripts
     args[script_nam] = []
@@ -754,6 +762,10 @@ def get_env(theAdditionalOptions=[], appname="SalomeApp"):
     if cmd_opts.save_config is not None:
         args['save_config'] = cmd_opts.save_config
 
+    # Interactive python console
+    if cmd_opts.pinter is not None:
+        args[pinter_nam] = cmd_opts.pinter
+
     ####################################################
     # Add <theAdditionalOptions> values to args
     for add_opt in theAdditionalOptions: