From: vsr Date: Tue, 3 Oct 2006 08:01:20 +0000 (+0000) Subject: Fix PAL13553 : bug in launchConfigureParser.py when GUI_ROOT_DIR is bad defined X-Git-Tag: V3_2_3pre1~13 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=05c2dd5b2fccdb3f7b201482aec84c323f0eab0a;p=modules%2Fkernel.git Fix PAL13553 : bug in launchConfigureParser.py when GUI_ROOT_DIR is bad defined --- diff --git a/bin/launchConfigureParser.py b/bin/launchConfigureParser.py index 981c51590..c05e8ba0f 100755 --- a/bin/launchConfigureParser.py +++ b/bin/launchConfigureParser.py @@ -64,13 +64,21 @@ listKeys = ( containers_nam, embedded_nam, key_nam, modules_nam, standalone_nam, # return application version (uses GUI_ROOT_DIR (or KERNEL_ROOT_DIR in batch mode) +/bin/salome/VERSION) def version(): - root_dir = os.environ.get( 'KERNEL_ROOT_DIR', '' ) # KERNEL_ROOT_DIR or "" if not found - root_dir = os.environ.get( 'GUI_ROOT_DIR', root_dir ) # GUI_ROOT_DIR or KERNEL_ROOT_DIR or "" if both not found - filename = root_dir+'/bin/salome/VERSION' - str = open( filename, "r" ).readline() # str = "THIS IS SALOME - SALOMEGUI VERSION: 3.0.0" - match = re.search( r':\s+([a-zA-Z0-9.]+)\s*$', str ) - if match : - return match.group( 1 ) + try: + filename = None + root_dir = os.environ.get( 'KERNEL_ROOT_DIR', '' ) # KERNEL_ROOT_DIR or "" if not found + if root_dir and os.path.exists( root_dir + "/bin/salome/VERSION" ): + filename = root_dir + "/bin/salome/VERSION" + root_dir = os.environ.get( 'GUI_ROOT_DIR', '' ) # GUI_ROOT_DIR "" if not found + if root_dir and os.path.exists( root_dir + "/bin/salome/VERSION" ): + filename = root_dir + "/bin/salome/VERSION" + if filename: + str = open( filename, "r" ).readline() # str = "THIS IS SALOME - SALOMEGUI VERSION: 3.0.0" + match = re.search( r':\s+([a-zA-Z0-9.]+)\s*$', str ) + if match : + return match.group( 1 ) + except: + pass return '' # calculate and return configuration file id in order to unically identify it @@ -231,7 +239,7 @@ config_var = appname+'Config' dirs = [] if os.getenv(config_var): dirs += re.split('[;|:]', os.getenv(config_var)) -if os.getenv("GUI_ROOT_DIR"): +if os.getenv("GUI_ROOT_DIR") and os.path.exists( os.getenv("GUI_ROOT_DIR") + "/share/salome/resources/gui" ): dirs += [os.getenv("GUI_ROOT_DIR") + "/share/salome/resources/gui"] os.environ[config_var] = ":".join(dirs)