summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/version.py
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2007-04-17 08:48:32 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2007-04-17 08:48:32 (GMT)
commit9d72bb452bced3a100f07f8a9e30c4495a9ec41a (patch)
treec39762a764fcc16f2cfc42e2504e58ff31e159e6 /Lib/distutils/version.py
parentff11334927ee616d765b54a3851016b76a20bcec (diff)
downloadcpython-9d72bb452bced3a100f07f8a9e30c4495a9ec41a.zip
cpython-9d72bb452bced3a100f07f8a9e30c4495a9ec41a.tar.gz
cpython-9d72bb452bced3a100f07f8a9e30c4495a9ec41a.tar.bz2
Remove functions in string module that are also string methods. Also remove:
* all calls to functions in the string module (except maketrans) * everything from stropmodule except for maketrans() which is still used
Diffstat (limited to 'Lib/distutils/version.py')
-rw-r--r--Lib/distutils/version.py17
1 files changed, 8 insertions, 9 deletions
diff --git a/Lib/distutils/version.py b/Lib/distutils/version.py
index 2cd3636..2db6b18 100644
--- a/Lib/distutils/version.py
+++ b/Lib/distutils/version.py
@@ -26,8 +26,7 @@ Every version number class implements the following interface:
of the same class, thus must follow the same rules)
"""
-import string, re
-from types import StringType
+import re
class Version:
"""Abstract base class for version numbering classes. Just provides
@@ -147,12 +146,12 @@ class StrictVersion (Version):
match.group(1, 2, 4, 5, 6)
if patch:
- self.version = tuple(map(string.atoi, [major, minor, patch]))
+ self.version = tuple(map(int, [major, minor, patch]))
else:
- self.version = tuple(map(string.atoi, [major, minor]) + [0])
+ self.version = tuple(map(int, [major, minor]) + [0])
if prerelease:
- self.prerelease = (prerelease[0], string.atoi(prerelease_num))
+ self.prerelease = (prerelease[0], int(prerelease_num))
else:
self.prerelease = None
@@ -160,9 +159,9 @@ class StrictVersion (Version):
def __str__ (self):
if self.version[2] == 0:
- vstring = string.join(map(str, self.version[0:2]), '.')
+ vstring = '.'.join(map(str, self.version[0:2]))
else:
- vstring = string.join(map(str, self.version), '.')
+ vstring = '.'.join(map(str, self.version))
if self.prerelease:
vstring = vstring + self.prerelease[0] + str(self.prerelease[1])
@@ -171,7 +170,7 @@ class StrictVersion (Version):
def __cmp__ (self, other):
- if isinstance(other, StringType):
+ if isinstance(other, str):
other = StrictVersion(other)
compare = cmp(self.version, other.version)
@@ -327,7 +326,7 @@ class LooseVersion (Version):
def __cmp__ (self, other):
- if isinstance(other, StringType):
+ if isinstance(other, str):
other = LooseVersion(other)
return cmp(self.version, other.version)