/usr/lib/python2.7/dist-packages/dogtail/version.py is in python-dogtail 0.9.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | """Handles versioning of software packages
Author: Dave Malcolm <dmalcolm@redhat.com>"""
__author__ = 'Dave Malcolm <dmalcolm@redhat.com>'
class Version(object):
"""
Class representing a version of a software package.
Stored internally as a list of subversions, from major to minor.
Overloaded comparison operators ought to work sanely.
"""
def __init__(self, versionList):
self.versionList = versionList
def fromString(versionString):
"""
Parse a string of the form number.number.number
"""
return Version(map(int, versionString.split(".")))
fromString = staticmethod(fromString)
def __str__(self):
return ".".join(map(str, self.versionList))
def __getNum(self):
tmpList = list(self.versionList)
while len(tmpList) < 5:
tmpList += [0]
num = 0
for i in range(len(tmpList)):
num *= 1000
num += tmpList[i]
return num
def __lt__(self, other):
return self.__getNum() < other.__getNum()
def __le__(self, other):
return self.__getNum() <= other.__getNum()
def __eq__(self, other):
return self.__getNum() == other.__getNum()
def __ne__(self, other):
return self.__getNum() != other.__getNum()
def __gt__(self, other):
return self.__getNum() > other.__getNum()
def __ge__(self, other):
return self.__getNum() >= other.__getNum()
|