From 3bd2eeda2384239d49606b8dbbcc50d9aea74c02 Mon Sep 17 00:00:00 2001 From: ?ric Araujo Date: Sat, 27 Oct 2012 11:58:05 -0400 Subject: Fix stringification of final versions (#16107). Report and patch by Richard Jones. --- CHANGES.txt | 1 + CONTRIBUTORS.txt | 1 + distutils2/tests/test_version.py | 4 +++- distutils2/version.py | 3 +++ 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index 2a00895..27409cf 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -21,6 +21,7 @@ CONTRIBUTORS.txt for full names. Bug numbers refer to http://bugs.python.org/. - #10374: Recreate scripts everytime build_scripts is called [pierre paul] - #14733: Have pysetup read setup.cfg early enough to find custom commands [éric, janusz] +- #16107: Fix trailing '.z' in str('1.0.post1') result [richard] 1.0a4 - 2012-03-13 ------------------ diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 8f8e059..40bd735 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -42,6 +42,7 @@ Thanks to: - Preston Holmes - Christian Hudon - Julien Jehannet +- Richard Jones - Jeremy Kloth - Amos Latteier - Mathieu Leduc-Hamel diff --git a/distutils2/tests/test_version.py b/distutils2/tests/test_version.py index d2d43ce..849ad5a 100644 --- a/distutils2/tests/test_version.py +++ b/distutils2/tests/test_version.py @@ -21,7 +21,9 @@ class VersionTestCase(unittest.TestCase): (V('1.2.3.4.0b3', drop_trailing_zeros=True), '1.2.3.4b3'), (V('1.2.0.0.0', drop_trailing_zeros=True), '1.2'), (V('1.0.dev345'), '1.0.dev345'), - (V('1.0.post456.dev623'), '1.0.post456.dev623')) + (V('1.0.post456.dev623'), '1.0.post456.dev623'), + (V('1.0.post1'), '1.0.post1'), + ) def test_repr(self): diff --git a/distutils2/version.py b/distutils2/version.py index 7f49a2e..3bd0fb1 100644 --- a/distutils2/version.py +++ b/distutils2/version.py @@ -174,6 +174,9 @@ class NormalizedVersion(object): if postdev and postdev is not _FINAL_MARKER: if postdev[0] == _FINAL_MARKER[0]: postdev = postdev[1:] + # remove trailing '.z' + if postdev[-1] == _FINAL_MARKER[0]: + postdev = postdev[:-1] i = 0 while i < len(postdev): if i % 2 == 0: -- cgit v1.2.1