Salome HOME
Updated copyright comment
[modules/kernel.git] / src / KERNEL_PY / salome_version.py
index a6d5e54237164579109bbfbbbae32b7751fde516..f454e560ac0d587ad08c7655f2ea2e2bb7631869 100644 (file)
@@ -1,5 +1,5 @@
 #  -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2024  CEA, EDF, OPEN CASCADE
 #
 # Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -49,7 +49,7 @@ def getVersion( mod = "KERNEL", full = False ):
     global _salome_versions
     mod = mod.upper()
     dev_flag = { True : "dev", False : "" }
-    if not _salome_versions.has_key( mod ):
+    if mod not in _salome_versions:
         _salome_versions[ mod ] = [ None, "" ]
         import os
         root_dir = os.getenv( "%s_ROOT_DIR" % mod )
@@ -70,12 +70,12 @@ def getVersion( mod = "KERNEL", full = False ):
                     elif "version" in key.lower() or mod in key:
                         _salome_versions[ mod ][ 0 ] = val
                     pass
-            except:
+            except Exception:
                 pass
     v = _salome_versions[ mod ][ 0 ]
     if full and v is not None:
         v += _salome_versions[ mod ][ 1 ]
-    return v
+    return v is not None and v or ""
 
 def getVersionMajor( mod = "KERNEL" ):
     """
@@ -87,7 +87,7 @@ def getVersionMajor( mod = "KERNEL" ):
     ver = getVersion( mod )
     try:
         return ver.split( "." )[ 0 ]
-    except:
+    except Exception:
         pass
     return None
 
@@ -101,7 +101,7 @@ def getVersionMinor( mod = "KERNEL" ):
     ver = getVersion( mod )
     try:
         return ver.split( "." )[ 1 ]
-    except:
+    except Exception:
         pass
     return None
 
@@ -115,7 +115,7 @@ def getVersionRelease( mod = "KERNEL" ):
     ver = getVersion( mod )
     try:
         return ver.split( "." )[ 2 ]
-    except:
+    except Exception:
         pass
     return None
 
@@ -128,17 +128,17 @@ def getVersions( mod = "KERNEL" ):
     """
     try:
         major = int( getVersionMajor( mod ) )
-    except:
+    except Exception:
         major = 0
         pass
     try:
         minor = int( getVersionMinor( mod ) )
-    except:
+    except Exception:
         minor = 0
         pass
     try:
         rel = int( getVersionRelease( mod ) )
-    except:
+    except Exception:
         rel = 0
         pass
     return [ major, minor, rel ]