StrictVersion¶
- class audeer.StrictVersion(version=None)[source]¶
Version numbering for anal retentives and software idealists.
This implementation was originally part of
distutilsasversion.StrictVersion.A version number consists of two or three dot-separated numeric components, with an optional “pre-release” tag on the end. The pre-release tag consists of the letter ‘a’ or ‘b’ followed by a number. If the numeric components of two version numbers are equal, then one with a pre-release tag will always be deemed earlier (lesser) than one without.
The following are valid version numbers (shown in the order that would be obtained by sorting according to the supplied cmp function):
'0.4','0.4.1','0.5a1','0.5b3','0.5','0.9.6','1.0','1.0.4a3','1.0.4b1','1.0.4'.The following are examples of invalid version numbers:
'1','2.7.2.2','1.3.a4','1.3pl1','1.3c4'.- Parameters:
version – version string
- Raises:
ValueError – if
versiondoes not match theStrictVersion.version_repattern
Examples
>>> v1 = audeer.StrictVersion("1.17.2a1") >>> v1 StrictVersion ('1.17.2a1') >>> v1.version (1, 17, 2) >>> v1.prerelease ('a', 1) >>> v2 = audeer.StrictVersion("1.17.2") >>> v1 < v2 True
__eq__()¶
- StrictVersion.__eq__(other)¶
Check if version equals another version.
__ge__()¶
- StrictVersion.__ge__(other)¶
Check if version is greater or equal another version.
__gt__()¶
- StrictVersion.__gt__(other)¶
Check if version is greater than another version.
__le__()¶
- StrictVersion.__le__(other)¶
Check if version is less or equal another version.
__lt__()¶
- StrictVersion.__lt__(other)¶
Check if version is less than another version.
__repr__()¶
- StrictVersion.__repr__()¶
Python code to recreate instance.
__str__()¶
parse()¶
prerelease¶
- StrictVersion.prerelease¶
Parsed prerelease part of version.
version¶
- StrictVersion.version¶
Parsed version.
version_re¶
- StrictVersion.version_re = re.compile('^(\\d+) \\. (\\d+) (\\. (\\d+))? ([ab](\\d+))?$', re.VERBOSE|re.ASCII)¶
Version regexp pattern.
The regexp pattern is used to split the version into major, minor, patch, prerelease, prerelease number when parsing it.