Back to index

salome-kernel  6.5.0
Functions | Variables
KERNEL_PY.salome_version Namespace Reference

Functions

def getVersion
def getVersionMajor
def getVersionMinor
def getVersionRelease
def getVersions
def getXVersion
def isDevelopmentVersion

Variables

list __ALL__
dictionary _salome_versions = {}

Function Documentation

def KERNEL_PY.salome_version.getVersion (   mod = "KERNEL",
  full = False 
)
Get SALOME module version number
Parameters:
- mod  : SALOME module name, default is 'KERNEL'
- full : take into account development marker (in this case 'dev' is added
         to the end of version value for development version), False by default
Returns: version number string or None if VERSION file is not found

Definition at line 40 of file salome_version.py.

00040 
00041 def getVersion( mod = "KERNEL", full = False ):
00042     """
00043     Get SALOME module version number
00044     Parameters:
00045     - mod  : SALOME module name, default is 'KERNEL'
00046     - full : take into account development marker (in this case 'dev' is added
00047              to the end of version value for development version), False by default
00048     Returns: version number string or None if VERSION file is not found
00049     """
00050     global _salome_versions
00051     mod = mod.upper()
00052     dev_flag = { True : "dev", False : "" }
00053     if not _salome_versions.has_key( mod ):
00054         _salome_versions[ mod ] = [ None, "" ]
00055         import os
00056         root_dir = os.getenv( "%s_ROOT_DIR" % mod )
00057         if root_dir:
00058             try:
00059                 filename = root_dir + "/bin/salome/VERSION"
00060                 if not os.path.exists( filename ):
00061                     filename = root_dir + "/bin/VERSION"
00062                 f = open( filename )
00063                 data = f.readlines()
00064                 f.close()
00065                 for l in data:
00066                     if l.strip().startswith("#") or ":" not in l: continue
00067                     key = ":".join( l.split( ":" )[ :-1 ] ).strip()
00068                     val = l.split( ":" )[ -1 ].strip()
00069                     if "development" in key.lower():
00070                         _salome_versions[ mod ][ 1 ] = dev_flag[ val == "1" ]
00071                     elif "version" in key.lower() or mod in key:
00072                         _salome_versions[ mod ][ 0 ] = val
00073                     pass
00074             except:
00075                 pass
00076     v = _salome_versions[ mod ][ 0 ]
00077     if full and v is not None:
00078         v += _salome_versions[ mod ][ 1 ]
00079     return v

Here is the caller graph for this function:

def KERNEL_PY.salome_version.getVersionMajor (   mod = "KERNEL")
Get SALOME module major version number
Parameters:
- mod  : SALOME module name, default is 'KERNEL'
Returns: version major number string or None if VERSION file is not found

Definition at line 80 of file salome_version.py.

00080 
00081 def getVersionMajor( mod = "KERNEL" ):
00082     """
00083     Get SALOME module major version number
00084     Parameters:
00085     - mod  : SALOME module name, default is 'KERNEL'
00086     Returns: version major number string or None if VERSION file is not found
00087     """
00088     ver = getVersion( mod )
00089     try:
00090         return ver.split( "." )[ 0 ]
00091     except:
00092         pass
00093     return None

Here is the call graph for this function:

Here is the caller graph for this function:

def KERNEL_PY.salome_version.getVersionMinor (   mod = "KERNEL")
Get SALOME module minor version number
Parameters:
- mod  : SALOME module name, default is 'KERNEL'
Returns: version minor number string or None if VERSION file is not found

Definition at line 94 of file salome_version.py.

00094 
00095 def getVersionMinor( mod = "KERNEL" ):
00096     """
00097     Get SALOME module minor version number
00098     Parameters:
00099     - mod  : SALOME module name, default is 'KERNEL'
00100     Returns: version minor number string or None if VERSION file is not found
00101     """
00102     ver = getVersion( mod )
00103     try:
00104         return ver.split( "." )[ 1 ]
00105     except:
00106         pass
00107     return None

Here is the call graph for this function:

Here is the caller graph for this function:

Get SALOME module release version number
Parameters:
- mod  : SALOME module name, default is 'KERNEL'
Returns: version release number string or None if VERSION file is not found

Definition at line 108 of file salome_version.py.

00108 
00109 def getVersionRelease( mod = "KERNEL" ):
00110     """
00111     Get SALOME module release version number
00112     Parameters:
00113     - mod  : SALOME module name, default is 'KERNEL'
00114     Returns: version release number string or None if VERSION file is not found
00115     """
00116     ver = getVersion( mod )
00117     try:
00118         return ver.split( "." )[ 2 ]
00119     except:
00120         pass
00121     return None

Here is the call graph for this function:

Here is the caller graph for this function:

def KERNEL_PY.salome_version.getVersions (   mod = "KERNEL")
Get SALOME module version as list of [major, minor, release] numbers
Parameters:
- mod  : SALOME module name, default is 'KERNEL'
Returns: version numbers list

Definition at line 122 of file salome_version.py.

00122 
00123 def getVersions( mod = "KERNEL" ):
00124     """
00125     Get SALOME module version as list of [major, minor, release] numbers
00126     Parameters:
00127     - mod  : SALOME module name, default is 'KERNEL'
00128     Returns: version numbers list
00129     """
00130     try:
00131         major = int( getVersionMajor( mod ) )
00132     except:
00133         major = 0
00134         pass
00135     try:
00136         minor = int( getVersionMinor( mod ) )
00137     except:
00138         minor = 0
00139         pass
00140     try:
00141         rel = int( getVersionRelease( mod ) )
00142     except:
00143         rel = 0
00144         pass
00145     return [ major, minor, rel ]
    

Here is the call graph for this function:

Here is the caller graph for this function:

def KERNEL_PY.salome_version.getXVersion (   mod = "KERNEL")
Get SALOME module version as list of [major, minor, release] numbers
Parameters:
- mod  : SALOME module name, default is 'KERNEL'
Returns: version numbers list

Definition at line 146 of file salome_version.py.

00146 
00147 def getXVersion( mod = "KERNEL" ):
00148     """
00149     Get SALOME module version as list of [major, minor, release] numbers
00150     Parameters:
00151     - mod  : SALOME module name, default is 'KERNEL'
00152     Returns: version numbers list
00153     """
00154     major, minor, rel = getVersions( mod )
00155     return hex( (major<<16) + (minor<<8) + rel )

Here is the call graph for this function:

Checks if the version of SALOME module is marked as development one
Parameters:
- mod  : SALOME module name, default is 'KERNEL'
Returns: Return True for delopment version of module or False otherwise

Definition at line 156 of file salome_version.py.

00156 
00157 def isDevelopmentVersion( mod = "KERNEL" ):
00158     """
00159     Checks if the version of SALOME module is marked as development one
00160     Parameters:
00161     - mod  : SALOME module name, default is 'KERNEL'
00162     Returns: Return True for delopment version of module or False otherwise
00163     """
00164     ver = getVersion( mod, True )
00165     return ver.endswith( "dev" )

Here is the call graph for this function:


Variable Documentation

Initial value:
00001 [
00002     "getVersion",
00003     "getVersionMajor",
00004     "getVersionMinor",
00005     "getVersionRelease",
00006     "getVersions",
00007     "getXVersion",
00008     "isDevelopmentVersion",
00009     ]

Definition at line 28 of file salome_version.py.

Definition at line 38 of file salome_version.py.