Skip to content

Commit

Permalink
#21: Relaxed tag pattern for bases without exactly three parts
Browse files Browse the repository at this point in the history
  • Loading branch information
mtkennerly committed Aug 9, 2021
1 parent 14a9891 commit eb6d8e1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## Unreleased

* Fixed an oversight where the default version tag pattern would only find
tags with exactly three parts in the base (e.g., `v1.0.0` and `v1.2.3`).
This is now relaxed so that `v1`, `v1.2.3.4`, and so on are also recognized.
* Added support for execution via `python -m dunamai`.
([Contributed by jstriebel](https://github.com/mtkennerly/dunamai/pull/19))

## v1.5.5 (2021-04-26)

* Fixed handling of Git tags that contain slashes.
Expand Down
2 changes: 1 addition & 1 deletion dunamai/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

_VERSION_PATTERN = r"""
(?x) (?# ignore whitespace)
^v(?P<base>\d+\.\d+\.\d+) (?# v1.2.3)
^v(?P<base>\d+(\.\d+)*) (?# v1.2.3)
(-?((?P<stage>[a-zA-Z]+)\.?(?P<revision>\d+)?))? (?# b0)
(\+(?P<tagged_metadata>.+))?$ (?# +linux)
""".strip()
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/test_dunamai.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,9 @@ def check_re(

check_re("v0.1.0rc.4+specifier", "0.1.0", "rc", "4", tagged_metadata="specifier")

check_re("v1", "1")
check_re("v1b2", "1", "b", "2")


def test__serialize_pep440():
assert serialize_pep440("1.2.3") == "1.2.3"
Expand Down

0 comments on commit eb6d8e1

Please sign in to comment.