Coverage for ion/core/_version : 91.04%
Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
|
#!/usr/bin/env python
@file ion/core/_version.py @author Dorian Raymer @author Michael Meisinger @brief Version-handling for ION classes @note From twisted.python.versions """
""" An object that is bigger than all other objects. """ """ @param other: Another object. @type other: any
@return: 0 if other is inf, 1 otherwise. @rtype: C{int} """
""" Two versions could not be compared. """
"""look for git commit to include in the version number.
An object that represents a three-part version number. @note Taken from twisted python (twisted.python.versions) """
""" @param package: Name of the package that this is a version of. @type package: C{str} @param major: The major version number. @type major: C{int} @param minor: The minor version number. @type minor: C{int} @param micro: The micro version number. @type micro: C{int} @param prerelease: The prerelease number. @type prerelease: C{int} """
""" Return a string in canonical short version format, <major>.<minor>.<micro>[+rSVNVer]. """ s += '+git:' + str(gitcommit)
""" Like L{short}, but without the +git. """ else: self.minor, self.micro, pre)
def __repr__(self): gitcommit = self._formatGitCommit() if gitcommit: gitcommit = ' #' + gitcommit if self.prerelease is None: prerelease = "" else: prerelease = ", prerelease=%r" % (self.prerelease,) return '%s(%r, %d, %d, %d%s)%s' % ( self.__class__.__name__, self.package, self.major, self.minor, self.micro, prerelease, gitcommit)
self.package, self.short())
""" Compare two versions, considering major versions, minor versions, micro versions, then prereleases.
A version with a prerelease is always less than a version without a prerelease. If both versions have prereleases, they will be included in the comparison.
@param other: Another version. @type other: L{Version}
@return: NotImplemented when the other object is not a Version, or one of -1, 0, or 1.
@raise IncomparableVersions: when the package names of the versions differ. """ return NotImplemented % (self.package, other.package))
else:
else:
self.minor, self.micro, prerelease), (other.major, other.minor, other.micro, otherpre))
# It's not an git working copy return None
else: return 'Unknown' else: # this indicates a non named ref is checked out return versplit[0] else: return 'Unknown'
|