| Trees | Indices | Help |
|
|---|
|
|
object --+
|
Version
>>> v1 = Version('Zenoss', 0, 22) >>> v2 = Version('Zenoss', 0, 23, 4) >>> v3 = Version('Zenoss', 0, 23, 7) >>> v4 = Version('Zenoss', 1) >>> v5 = Version('Zenoss', 1, 0, 2) >>> v6 = Version('Zenoss', 1, 0, 2) >>> v7 = Version('Zenoss', 1, 0, 2, 15729) >>> v8 = Version('Zenoss', 1, 0, 2, 15730) >>> v9 = Version('Zenoss', 1, 0, 3, 15729)
# test the display methods >>> v9.short() '1.0.3' >>> v9.long() 'Zenoss 1.0.3' >>> v9.full() 'Zenoss 1.0.3 r15729' >>> v2.tuple() (0, 23, 4)
# comparisons >>> v1 > v2 False >>> v3 > v2 True >>> v4 < v3 False >>> v4 > v5 False >>> v6 > v5 False >>> v6 >= v5 True >>> v6 == v5 True
# comparison, one with a revision number >>> v7 > v6 False
# revision number comparisons >>> v7 > v8 False >>> v8 > v9 False
# comparing non-Version objects with Version objects >>> '1.0.4' > v5 True >>> (1,0,1) > v5 False >>> 1 == v4 True >>> v4 == 1.0 True >>> '1.0' == v4 True
# comment/additional info >>> v10 = v9 >>> v10.setComment('A super-secret squirrel release') >>> v10.full() 'Zenoss 1.0.3 r15729 (A super-secret squirrel release)'
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
Inherited from |
|||
|
|||
|
|||
|
|||
|
Inherited from |
|||
|
|||
|
Comparse one verion to another. If the other version supplied is not a Version instance, attempt coercion. The assumption here is that any non-Version object being compared to a Version object represents a verion of the same product with the same name but a different version number. |
|
|
Parse the version info from a string. This method is usable without
having instantiated Version, and returns an instantiation.
The expected form is the following:
software_name W.X.Y rZ
where W, X, and Y represent the major, minor, and micro version numbers
and Z is the subversion revision number.
Only the software name is required.
The version number is expected to have at least a major version number.
Minor and micro version numbers are optional, but if they are provided,
they must be dot-delimited.
Here are some example usages:
>>> v = Version.parse('Zenoss')
>>> repr(v)
'Version(Zenoss, 0, 0, 0,)'
>>> print v
[Zenoss, version 0.0.0]
>>> v = Version.parse('Zenoss 1')
>>> repr(v)
'Version(Zenoss, 1, 0, 0,)'
>>> print v
[Zenoss, version 1.0.0]
>>> v = Version.parse('Zenoss 0.26.4')
>>> repr(v)
'Version(Zenoss, 0, 26, 4,)'
>>> print v
[Zenoss, version 0.26.4]
>>> v = Version.parse('Zenoss 0.32.1 r13667')
>>> repr(v)
'Version(Zenoss, 0, 32, 1, r13667)'
>>> print v
[Zenoss, version 0.32.1 r13667]
|
| Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0beta1 on Thu May 7 11:46:16 2009 | http://epydoc.sourceforge.net |