diff --git a/CHANGELOG.md b/CHANGELOG.md index a370994..88aac51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/dunamai/__init__.py b/dunamai/__init__.py index 254b1b2..cc22260 100644 --- a/dunamai/__init__.py +++ b/dunamai/__init__.py @@ -25,7 +25,7 @@ _VERSION_PATTERN = r""" (?x) (?# ignore whitespace) - ^v(?P\d+\.\d+\.\d+) (?# v1.2.3) + ^v(?P\d+(\.\d+)*) (?# v1.2.3) (-?((?P[a-zA-Z]+)\.?(?P\d+)?))? (?# b0) (\+(?P.+))?$ (?# +linux) """.strip() diff --git a/tests/unit/test_dunamai.py b/tests/unit/test_dunamai.py index b8992d3..398e9f2 100644 --- a/tests/unit/test_dunamai.py +++ b/tests/unit/test_dunamai.py @@ -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"