Package ZenUtils :: Module Version
[hide private]
[frames] | no frames]

Module Version

source code

Zenoss versioning module.

Classes [hide private]
  VersionError
  IncomparableVersions
  ComponentVersionError
  VersionNotSupported
  Version
A class for obtaining and manipulating version numbers as well as creating the necessary version files Zenoss utilizes.
Functions [hide private]
 
getVersionTupleFromString(versionString)
A utility function for parsing dot-delimited stings as a version tuple.
source code
 
_test() source code
Function Details [hide private]

getVersionTupleFromString(versionString)

source code 

A utility function for parsing dot-delimited stings as a version tuple.

# test some simple version formats >>> version = '1' >>> getVersionTupleFromString(version) (1, 0, 0) >>> version = '1.0' >>> getVersionTupleFromString(version) (1, 0, 0) >>> version = '1.0.0' >>> getVersionTupleFromString(version) (1, 0, 0) >>> version = '1.0.2' >>> getVersionTupleFromString(version) (1, 0, 2)

# here's one for Fedora >>> version = '2.6.17-1.2174_FC5' >>> getVersionTupleFromString(version) (2, 6, 17)

# here's a bizzare one >>> version = '1a.23zzX.abs' >>> getVersionTupleFromString(version) (1, 23, 0)

# checks against ints and floats being passed instead of strings >>> version = 1 >>> getVersionTupleFromString(version) (1, 0, 0) >>> version = 1.0 >>> getVersionTupleFromString(version) (1, 0, 0) >>> version = 0 >>> getVersionTupleFromString(version) (0, 0, 0) >>> version = 'a.1.2' >>> getVersionTupleFromString(version) (0, 1, 2) >>> version = '' >>> getVersionTupleFromString(version) (0, 0, 0)