1. Tarek Ziadé
  2. distutils.version

Commits

tarek  committed 7eea3db

added the Tcl/Tk case

  • Participants
  • Parent commits 22a8cdc
  • Branches default

Comments (0)

Files changed (2)

File test_verlib.py

View file
  • Ignore whitespace
         self.assertEquals(suggest('0.1dev'), '0.1.dev0')
         self.assertEquals(suggest('0.1.dev'), '0.1.dev0')
 
+        # we want to be able to parse Twisted
+        # development versions are like post releases in Twisted
+        self.assertEquals(suggest('9.0.0+r2363'), '9.0.0.post2363')
+
+        # pre-releases are using markers like "pre1"
+        self.assertEquals(suggest('9.0.0pre1'), '9.0.0c1')
+
+        # we want to be able to parse Tcl-TK
+        # they us "p1" "p2" for post releases
+        self.assertEquals(suggest('1.4p1'), '1.4.post1')
+
 def test_suite():
     #README = os.path.join(os.path.dirname(__file__), 'README.txt')
     #suite = [doctest.DocFileSuite(README), unittest.makeSuite(VersionTestCase)]

File verlib.py

View file
  • Ignore whitespace
     # a terminal "final" or "stable" can be removed
     rs = re.sub(r"(final|stable)$", "", rs)
 
+    # Tcl/Tk uses "px" for their post release markers
+    rs = re.sub(r"p(\d+)$", r".post\1", rs)
+
     try:
         NormalizedVersion(rs)
         return rs   # already rational