Skip to content

Commit

Permalink
Merge pull request #37 from xavfernandez/normalize_post_release
Browse files Browse the repository at this point in the history
Normalize r/rev post release spelling to post
  • Loading branch information
dstufft committed Aug 2, 2015
2 parents cd14425 + 7754f0e commit 4628567
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Changelog

.. note:: This version is not yet released and is under active development.

* Normalize post-release spellings for rev/r prefixes. :issue:`35`


15.2 - 2015-05-13
~~~~~~~~~~~~~~~~~
Expand Down
5 changes: 5 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.doctest",
"sphinx.ext.extlinks",
"sphinx.ext.intersphinx",
"sphinx.ext.viewcode",
]
Expand Down Expand Up @@ -71,6 +72,10 @@
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = "sphinx"

extlinks = {
'issue': ('https://github.com/pypa/packaging/issues/%s', '#'),
'pull': ('https://github.com/pypa/packaging/pull/%s', 'PR #'),
}
# -- Options for HTML output --------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
Expand Down
2 changes: 2 additions & 0 deletions packaging/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,8 @@ def _parse_letter_version(letter, number):
letter = "b"
elif letter in ["c", "pre", "preview"]:
letter = "rc"
elif letter in ["rev", "r"]:
letter = "post"

return letter, int(number)
if not letter and number:
Expand Down
11 changes: 9 additions & 2 deletions tests/test_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,16 @@ def test_parse(version, klass):
"1.0b2-346", "1.0c1.dev456", "1.0c1", "1.0rc2", "1.0c3", "1.0",
"1.0.post456.dev34", "1.0.post456", "1.1.dev1", "1.2+123abc",
"1.2+123abc456", "1.2+abc", "1.2+abc123", "1.2+abc123def", "1.2+1234.abc",
"1.2+123456",
"1.2+123456", "1.2.r32+123456", "1.2.rev33+123456",

# Explicit epoch of 1
"1!1.0.dev456", "1!1.0a1", "1!1.0a2.dev456", "1!1.0a12.dev456", "1!1.0a12",
"1!1.0b1.dev456", "1!1.0b2", "1!1.0b2.post345.dev456", "1!1.0b2.post345",
"1!1.0b2-346", "1!1.0c1.dev456", "1!1.0c1", "1!1.0rc2", "1!1.0c3", "1!1.0",
"1!1.0.post456.dev34", "1!1.0.post456", "1!1.1.dev1", "1!1.2+123abc",
"1!1.2+123abc456", "1!1.2+abc", "1!1.2+abc123", "1!1.2+abc123def",
"1!1.2+1234.abc", "1!1.2+123456",
"1!1.2+1234.abc", "1!1.2+123456", "1!1.2.r32+123456", "1!1.2.rev33+123456",

]


Expand Down Expand Up @@ -172,10 +173,16 @@ def test_invalid_versions(self, version):
("1.0.POST", "1.0.post0"),
("1.0POST1", "1.0.post1"),
("1.0POST", "1.0.post0"),
("1.0r", "1.0.post0"),
("1.0rev", "1.0.post0"),
("1.0.POST1", "1.0.post1"),
("1.0.r1", "1.0.post1"),
("1.0.rev1", "1.0.post1"),
("1.0-POST", "1.0.post0"),
("1.0-POST1", "1.0.post1"),
("1.0-5", "1.0.post5"),
("1.0-r5", "1.0.post5"),
("1.0-rev5", "1.0.post5"),
# Local version case insensitivity
("1.0+AbC", "1.0+abc"),
Expand Down

0 comments on commit 4628567

Please sign in to comment.