Home | History | Annotate | Download | only in distutils

Lines Matching defs:Version

2 # distutils/version.py
4 # Implements multiple version numbering conventions for the
10 """Provides classes to represent module version numbers (one class for
11 each style of version numbering). There are currently two such classes
14 Every version number class implements the following interface:
16 representation; if the string is an invalid version number,
22 version number instance)
23 * __repr__ generates Python code to recreate the version number instance
32 class Version:
33 """Abstract base class for version numbering classes. Just provides
35 seem to be the same for all version numbering classes.
46 # Interface for version-number classes -- must be implemented
47 # by the following classes (the concrete ones -- Version should
53 # this style of version numbering
58 # __cmp__ (self, other) - compare two version numbers ('other' may
59 # be an unparsed version string, or another
60 # instance of your version class)
63 class StrictVersion (Version):
65 """Version numbering for anal retentives and software idealists.
66 Implements the standard interface for version number classes as
67 described above. A version number consists of two or three
70 followed by a number. If the numeric components of two version
74 The following are valid version numbers (shown in the order that
88 The following are examples of invalid version numbers:
96 The rationale for this version numbering system will be explained
107 raise ValueError, "invalid version number '%s'" % vstring
113 self.version = tuple(map(string.atoi, [major, minor, patch]))
115 self.version = tuple(map(string.atoi, [major, minor]) + [0])
125 if self.version[2] == 0:
126 vstring = string.join(map(str, self.version[0:2]), '.')
128 vstring = string.join(map(str, self.version), '.')
140 compare = cmp(self.version, other.version)
165 # 1) a version number has 1 or more numbers separated by a period or by
172 # The LooseVersion class below implements these rules: a version number
174 # comparison is a simple tuple comparison. This means that version
176 # not necessarily be how people *want* version numbers to behave. There
177 # wouldn't be a problem if people could stick to purely numeric version
179 # However, people insist on putting letters into their version numbers;
181 # - indicating a "pre-release" version
184 # but of course this can't cover all version number schemes, and there's
188 # characters) in a version number. The current implementation does the
194 # However, if letters in a version number imply a pre-release version,
206 # version numbering scheme to its domination. The free-thinking
210 # Perhaps a "moderately strict" version class could be implemented that
212 # assumptions about non-digits in version number strings. This could
223 # complicated, hairy expectations for real-world version numbers. It
226 # have a conception that matches common notions about version numbers.
228 class LooseVersion (Version):
230 """Version numbering for anarchists and software realists.
231 Implements the standard interface for version number classes as
232 described above. A version number consists of a series of numbers,
234 version numbers, the numeric components will be compared
236 are all valid version numbers, in no particular order:
255 In fact, there is no such thing as an invalid version number under
269 # I've given up on thinking I can reconstruct the version string
281 self.version = components
296 return cmp(self.version, other.version)