1 # Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 # See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
20 # File : salome_version.py
21 # Author : Vadim SANDLER
26 def getVersion( mod = "KERNEL" ):
28 Get SALOME module version number
29 Returns: version number string or None if VERSION file is not found
31 global _salome_versions
33 if not _salome_versions.has_key( mod ):
34 _salome_versions[ mod ] = None
36 root_dir = os.getenv( "%s_ROOT_DIR" % mod )
39 filename = root_dir + "/bin/salome/VERSION"
40 if not os.path.exists( filename ):
41 filename = root_dir + "/bin/VERSION"
42 file = open( filename )
45 _salome_versions[ mod ] = ver.split( ":" )[ -1 ].strip()
48 return _salome_versions[ mod ]
50 def getVersionMajor( mod = "KERNEL" ):
52 Get SALOME module major version number
53 Returns: version major number string or None if VERSION file is not found
55 ver = getVersion( mod )
57 return ver.split( "." )[ 0 ]
62 def getVersionMinor( mod = "KERNEL" ):
64 Get SALOME module minor version number
65 Returns: version minor number string or None if VERSION file is not found
67 ver = getVersion( mod )
69 return ver.split( "." )[ 1 ]
74 def getVersionRelease( mod = "KERNEL" ):
76 Get SALOME module release version number
77 Returns: version release number string or None if VERSION file is not found
79 ver = getVersion( mod )
81 return ver.split( "." )[ 2 ]