aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPJ Eby <distutils-sig@python.org>2005-12-06 17:41:36 +0000
committerPJ Eby <distutils-sig@python.org>2005-12-06 17:41:36 +0000
commitbd28408ff49d304ae822acf9f46f0b65bb138c04 (patch)
tree75cecab952c652149b44f488724f06b23a912917
parent45885095198f5ec1d7e80791a73c7385f2620b38 (diff)
downloadexternal_python_setuptools-bd28408ff49d304ae822acf9f46f0b65bb138c04.tar.gz
external_python_setuptools-bd28408ff49d304ae822acf9f46f0b65bb138c04.tar.bz2
external_python_setuptools-bd28408ff49d304ae822acf9f46f0b65bb138c04.zip
Changed ``parse_version()`` to remove dashes before pre-release tags, so
that ``0.2-rc1`` is considered an *older* version than ``0.2``, and is equal to ``0.2rc1``. The idea that a dash *always* meant a post-release version was highly non-intuitive to setuptools users and Python developers, who seem to want to use ``-rc`` version numbers a lot. --HG-- branch : setuptools extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/trunk/setuptools%4041630
-rw-r--r--pkg_resources.py4
-rwxr-xr-xpkg_resources.txt12
-rw-r--r--setuptools/tests/test_resources.py6
3 files changed, 16 insertions, 6 deletions
diff --git a/pkg_resources.py b/pkg_resources.py
index 37995cd0..ba4cf861 100644
--- a/pkg_resources.py
+++ b/pkg_resources.py
@@ -1589,14 +1589,14 @@ def parse_version(s):
parts = []
for part in _parse_version_parts(s.lower()):
if part.startswith('*'):
+ if part<'*final': # remove '-' before a prerelease tag
+ while parts and parts[-1]=='*final-': parts.pop()
# remove trailing zeros from each series of numeric parts
while parts and parts[-1]=='00000000':
parts.pop()
parts.append(part)
return tuple(parts)
-
-
class EntryPoint(object):
"""Object representing an advertised importable object"""
diff --git a/pkg_resources.txt b/pkg_resources.txt
index 31e411bf..b8705d47 100755
--- a/pkg_resources.txt
+++ b/pkg_resources.txt
@@ -1371,7 +1371,11 @@ Parsing Utilities
Strings like "a", "b", "c", "alpha", "beta", "candidate" and so on (that
come before "final" alphabetically) are assumed to be pre-release versions,
- so that the version "2.4" is considered newer than "2.4a1".
+ so that the version "2.4" is considered newer than "2.4a1". Any "-"
+ characters preceding a pre-release indicator are removed. (In versions of
+ setuptools prior to 0.6a9, "-" characters were not removed, leading to the
+ unintuitive result that "0.2-rc1" was considered a newer version than
+ "0.2".)
Finally, to handle miscellaneous cases, the strings "pre", "preview", and
"rc" are treated as if they were "c", i.e. as though they were release
@@ -1518,6 +1522,12 @@ Release Notes/Change History
system-installed egg, without needing to use ``.egg`` directories, zipfiles,
or ``.pth`` manipulation.
+ * Changed ``parse_version()`` to remove dashes before pre-release tags, so
+ that ``0.2-rc1`` is considered an *older* version than ``0.2``, and is equal
+ to ``0.2rc1``. The idea that a dash *always* meant a post-release version
+ was highly non-intuitive to setuptools users and Python developers, who
+ seem to want to use ``-rc`` version numbers a lot.
+
0.6a8
* Fixed a problem with ``WorkingSet.resolve()`` that prevented version
conflicts from being detected at runtime.
diff --git a/setuptools/tests/test_resources.py b/setuptools/tests/test_resources.py
index 076dd53e..15b7acbd 100644
--- a/setuptools/tests/test_resources.py
+++ b/setuptools/tests/test_resources.py
@@ -434,19 +434,19 @@ class ParseTests(TestCase):
self.assertRaises(ValueError,Requirement.parse,"X==1\nY==2")
self.assertRaises(ValueError,Requirement.parse,"#")
-
def testVersionEquality(self):
def c(s1,s2):
p1, p2 = parse_version(s1),parse_version(s2)
self.assertEqual(p1,p2, (s1,s2,p1,p2))
+ c('1.2-rc1', '1.2rc1')
c('0.4', '0.4.0')
c('0.4.0.0', '0.4.0')
c('0.4.0-0', '0.4-0')
c('0pl1', '0.0pl1')
c('0pre1', '0.0c1')
c('0.0.0preview1', '0c1')
- c('0.0c1', '0rc1')
+ c('0.0c1', '0-rc1')
c('1.2a1', '1.2.a.1'); c('1.2...a', '1.2a')
def testVersionOrdering(self):
@@ -470,6 +470,7 @@ class ParseTests(TestCase):
c('0.4', '4.0')
c('0.0.4', '0.4.0')
c('0pl1', '0.4pl1')
+ c('2.1.0-rc1','2.1.0')
torture ="""
0.80.1-3 0.80.1-2 0.80.1-1 0.79.9999+0.80.0pre4-1
@@ -489,4 +490,3 @@ class ParseTests(TestCase):
-