From 19d1736e2a19ccd8ed089f52711997e180564914 Mon Sep 17 00:00:00 2001 From: caremoli Date: Wed, 19 Jan 2011 16:39:35 +0000 Subject: [PATCH] CCAR: remove tabs in python files (do not mix tabs and whitespace in indentation : only whitespace) --- bin/killSalomeWithPort.py | 4 +-- bin/launchConfigureParser.py | 40 ++++++++++++------------ bin/salome_utils.py | 27 +++++++--------- bin/setenv.py | 10 +++--- bin/virtual_salome.py | 60 ++++++++++++++++++------------------ 5 files changed, 68 insertions(+), 73 deletions(-) diff --git a/bin/killSalomeWithPort.py b/bin/killSalomeWithPort.py index 38e0cf710..a1744675d 100755 --- a/bin/killSalomeWithPort.py +++ b/bin/killSalomeWithPort.py @@ -146,9 +146,9 @@ def killMyPort(port): fpid = open(filedict, 'r') # from salome_utils import generateFileName - if sys.platform == "win32": + if sys.platform == "win32": username = os.getenv( "USERNAME" ) - else: + else: username = os.getenv('USER') path = os.path.join('/tmp/logs', username) fpidomniNames = generateFileName(path, diff --git a/bin/launchConfigureParser.py b/bin/launchConfigureParser.py index 07973f56b..f51e521ec 100755 --- a/bin/launchConfigureParser.py +++ b/bin/launchConfigureParser.py @@ -204,7 +204,7 @@ def process_containers_params( standalone, embedded ): # 3. return corrected parameters values return standalone, embedded - + # ----------------------------------------------------------------------------- ### @@ -615,7 +615,7 @@ def CreateOptionParser (theAdditionalOptions=[]): action="store", dest="test_script_file", help=help_str) - + # Reproducing test script with help of TestRecorder. Default: False. help_str = "Reproducing test script with help of TestRecorder." o_play = optparse.Option("--play", @@ -631,14 +631,14 @@ def CreateOptionParser (theAdditionalOptions=[]): action="store_true", dest="gdb_session", default=False, help=help_str) - + # ddd session help_str = "Launch session with ddd" o_ddd = optparse.Option("--ddd-session", action="store_true", dest="ddd_session", default=False, help=help_str) - + # valgrind session help_str = "Launch session with valgrind $VALGRIND_OPTIONS" @@ -659,7 +659,7 @@ def CreateOptionParser (theAdditionalOptions=[]): action="callback", callback=store_boolean, callback_args=('shutdown_servers',), dest="shutdown_servers", help=help_str) - + # All options opt_list = [o_t,o_g, # GUI/Terminal o_d,o_o, # Desktop @@ -723,7 +723,7 @@ def get_env(theAdditionalOptions=[], appname="SalomeApp"): # - The directories which are inspected are checked for files ".xml" # (SalomeApp.xml) which define SALOME configuration # - These directories are analyzed beginning from the last one in the list, - # so the first directory listed in "Config" environment variable + # so the first directory listed in "Config" environment variable # has higher priority: it means that if some configuration options # is found in the next analyzed cofiguration file - it will be replaced # - The last configuration file which is parsed is user configuration file @@ -765,7 +765,7 @@ def get_env(theAdditionalOptions=[], appname="SalomeApp"): sys.exit(0) pass - # set resources variable SalomeAppConfig if it is not set yet + # set resources variable SalomeAppConfig if it is not set yet dirs = [] if os.getenv(config_var): if sys.platform == 'win32': @@ -776,12 +776,12 @@ def get_env(theAdditionalOptions=[], appname="SalomeApp"): gui_available = True if os.getenv("GUI_ROOT_DIR") and os.path.isdir( os.getenv("GUI_ROOT_DIR") + "/share/salome/resources/gui" ): dirs += [os.getenv("GUI_ROOT_DIR") + "/share/salome/resources/gui"] - pass + pass else: - gui_available = False - if os.getenv("KERNEL_ROOT_DIR") and os.path.isdir( os.getenv("KERNEL_ROOT_DIR") + "/bin/salome/appliskel" ): - dirs += [os.getenv("KERNEL_ROOT_DIR") + "/bin/salome/appliskel"] - pass + gui_available = False + if os.getenv("KERNEL_ROOT_DIR") and os.path.isdir( os.getenv("KERNEL_ROOT_DIR") + "/bin/salome/appliskel" ): + dirs += [os.getenv("KERNEL_ROOT_DIR") + "/bin/salome/appliskel"] + pass os.environ[config_var] = separator.join(dirs) dirs.reverse() # reverse order, like in "path" variable - FILO-style processing @@ -790,7 +790,7 @@ def get_env(theAdditionalOptions=[], appname="SalomeApp"): dirs.remove('') # to remove empty dirs if the variable terminate by ":" or if there are "::" inside except: pass - + _opts = {} # associative array of options to be filled # parse SalomeApp.xml files in directories specified by SalomeAppConfig env variable @@ -880,8 +880,8 @@ def get_env(theAdditionalOptions=[], appname="SalomeApp"): args[batch_nam] = True if not gui_available: - args[gui_nam] = False - + args[gui_nam] = False + if args[gui_nam]: args["session_gui"] = True if cmd_opts.desktop is not None: @@ -910,9 +910,9 @@ def get_env(theAdditionalOptions=[], appname="SalomeApp"): if cmd_opts.py_scripts is not None: listlist = cmd_opts.py_scripts for listi in listlist: - if os.sys.platform == 'win32': + if os.sys.platform == 'win32': args[script_nam] += re.split( "[;,]", listi) - else: + else: args[script_nam] += re.split( "[:;,]", listi) for arg in cmd_args: if arg[-3:] == ".py": @@ -973,7 +973,7 @@ def get_env(theAdditionalOptions=[], appname="SalomeApp"): # Interactive python console if cmd_opts.pinter is not None: args[pinter_nam] = cmd_opts.pinter - + # Gdb session in xterm if cmd_opts.gdb_session is not None: args[gdb_session_nam] = cmd_opts.gdb_session @@ -992,7 +992,7 @@ def get_env(theAdditionalOptions=[], appname="SalomeApp"): else: args[shutdown_servers_nam] = cmd_opts.shutdown_servers pass - + #################################################### # Add values to args for add_opt in theAdditionalOptions: @@ -1027,7 +1027,7 @@ def get_env(theAdditionalOptions=[], appname="SalomeApp"): args[test_nam] = [] filename = cmd_opts.test_script_file args[test_nam] += re.split( "[:;,]", filename ) - + # Play if cmd_opts.play_script_file is not None: args[play_nam] = [] diff --git a/bin/salome_utils.py b/bin/salome_utils.py index 63c36ff80..7195585e2 100644 --- a/bin/salome_utils.py +++ b/bin/salome_utils.py @@ -367,23 +367,18 @@ def makeTmpDir( path, mode=0777 ): os.system( "mkdir " + '"' + path + '"' ) else: os.system( "rm -rf " + path + "/*" ) - pass - pass else: - dirs = path.split("/") - shift1 = shift2 = 0 - if not dirs[0]: shift1 = 1 - if dirs[-1]: shift2 = 1 - for i in range(1+shift1,len(dirs)+shift2): - p = "/".join(dirs[:i]) - try: - os.mkdir(p, mode) - os.chmod(p, mode) - except: - pass - pass - pass - pass + dirs = path.split("/") + shift1 = shift2 = 0 + if not dirs[0]: shift1 = 1 + if dirs[-1]: shift2 = 1 + for i in range(1+shift1,len(dirs)+shift2): + p = "/".join(dirs[:i]) + try: + os.mkdir(p, mode) + os.chmod(p, mode) + except: + pass # --- diff --git a/bin/setenv.py b/bin/setenv.py index 59fa58528..183b57b03 100755 --- a/bin/setenv.py +++ b/bin/setenv.py @@ -157,10 +157,10 @@ def set_env(args, modules_list, modules_root_dir, silent=False): # create temporary directory for environment files needed by modules from the list port = getPortNumber(False) if port: - tmp_dir = getTmpDir() - env_dir = generateFileName(tmp_dir, prefix="env", with_port=True) - makeTmpDir(env_dir) - pass + tmp_dir = getTmpDir() + env_dir = generateFileName(tmp_dir, prefix="env", with_port=True) + makeTmpDir(env_dir) + pass python_version="python%d.%d" % sys.version_info[0:2] modules_root_dir_list = [] @@ -206,7 +206,7 @@ def set_env(args, modules_list, modules_root_dir, silent=False): salome_subdir, "shared_modules"), "PYTHONPATH") - + # set environment by modules from the list if port: try: diff --git a/bin/virtual_salome.py b/bin/virtual_salome.py index f20685a43..836497e03 100644 --- a/bin/virtual_salome.py +++ b/bin/virtual_salome.py @@ -21,7 +21,7 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -"""Create a virtual Salome installation +"""Create a virtual Salome installation Based on a script created by Ian Bicking. @@ -100,8 +100,8 @@ def link_module(options): if not options.module: print "Option module is mandatory" - return - + return + module_dir=os.path.abspath(options.module) if not os.path.exists(module_dir): print "Module %s does not exist" % module_dir @@ -167,7 +167,7 @@ def link_module(options): rmtree(doc_dir) rmtree(sharedoc_dir) pass - + #directory bin/salome : create it and link content if os.path.exists(module_bin_dir): mkdir(bin_dir) @@ -178,8 +178,8 @@ def link_module(options): else: if verbose: print module_bin_dir, " doesn't exist" - pass - + pass + #directory idl/salome : create it and link content if os.path.exists(module_idl_dir): mkdir(idl_dir) @@ -199,41 +199,41 @@ def link_module(options): else: if verbose: print module_lib_dir, " doesn't exist" - pass - + pass + #directory lib/pyversio/site-packages/salome : create it and link content if not os.path.exists(module_lib_py_dir): print "Python directory %s does not exist" % module_lib_py_dir else: - # __GBO__ specific action for the package salome - module_lib_pypkg_dir=os.path.join(module_lib_py_dir,"salome") - lib_pypkg_dir=os.path.join(lib_py_dir,"salome") - mkdir(lib_pypkg_dir) - # __GBO__ + # __GBO__ specific action for the package salome + module_lib_pypkg_dir=os.path.join(module_lib_py_dir,"salome") + lib_pypkg_dir=os.path.join(lib_py_dir,"salome") + mkdir(lib_pypkg_dir) + # __GBO__ mkdir(lib_py_shared_dir) for fn in os.listdir(module_lib_py_dir): if fn == "shared_modules": continue - # __GBO__ - if fn == "salome": continue - # __GBO__ + # __GBO__ + if fn == "salome": continue + # __GBO__ symlink(os.path.join(module_lib_py_dir, fn), os.path.join(lib_py_dir, fn)) - pass + pass if os.path.exists(module_lib_py_shared_dir): for fn in os.listdir(module_lib_py_shared_dir): symlink(os.path.join(module_lib_py_shared_dir, fn), os.path.join(lib_py_shared_dir, fn)) pass pass - # __GBO__ - if os.path.exists(module_lib_pypkg_dir): - for fn in os.listdir(module_lib_pypkg_dir): - symlink(os.path.join(module_lib_pypkg_dir, fn), os.path.join(lib_pypkg_dir, fn)) - pass - pass - # __GBO__ + # __GBO__ + if os.path.exists(module_lib_pypkg_dir): + for fn in os.listdir(module_lib_pypkg_dir): + symlink(os.path.join(module_lib_pypkg_dir, fn), os.path.join(lib_pypkg_dir, fn)) + pass + pass + # __GBO__ else: if verbose: print module_lib_py_shared_dir, " doesn't exist" - pass + pass #directory share/doc/salome (KERNEL doc) : create it and link content if os.path.exists(module_sharedoc_dir): @@ -252,7 +252,7 @@ def link_module(options): symlink(os.path.join(module_sharedoc_gui_dir, fn), os.path.join(sharedoc_gui_dir, fn)) pass pass - + #directory share/doc/salome/tui : create it and link content if os.path.exists(module_sharedoc_tui_dir): mkdir(sharedoc_tui_dir) @@ -286,7 +286,7 @@ def link_module(options): symlink(os.path.join(module_doc_dir, fn), os.path.join(doc_dir, fn)) pass pass - + #directory doc/salome/gui : create it and link content if os.path.exists(module_doc_gui_dir): mkdir(doc_gui_dir) @@ -294,7 +294,7 @@ def link_module(options): symlink(os.path.join(module_doc_gui_dir, fn), os.path.join(doc_gui_dir, fn)) pass pass - + #directory doc/salome/tui : create it and link content if os.path.exists(module_doc_tui_dir): mkdir(doc_tui_dir) @@ -318,7 +318,7 @@ Typical use is: parser.add_option('--prefix', dest="prefix", default='.', help="The base directory to install to (default .)") - parser.add_option('--module', dest="module", + parser.add_option('--module', dest="module", help="The module directory to install in (mandatory)") parser.add_option('--clear', dest='clear', action='store_true', @@ -327,7 +327,7 @@ Typical use is: options, args = parser.parse_args() link_module(options) pass - + # ----------------------------------------------------------------------------- if __name__ == '__main__': -- 2.39.2