From b924c8df1f78ceb008392b2a8bb2665674d9c565 Mon Sep 17 00:00:00 2001 From: Danila Vershinin Date: Mon, 25 Sep 2023 22:29:38 +0700 Subject: [PATCH] Addressing #110 --- CHANGELOG.md | 4 ++++ lastversion/Version.py | 6 ++++-- lastversion/__about__.py | 2 +- tests/test_github.py | 11 +++++++++++ 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 37039e8c..f6d85261 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog All notable changes to this project will be documented in this file. +## [3.3.2] - 2023-09-25 +### Fixed +* Fix regression in semver preference + ## [3.3.1] - 2023-09-22 ### Fixed * Fixed AppImage installation #107 diff --git a/lastversion/Version.py b/lastversion/Version.py index 93164b82..46edca69 100644 --- a/lastversion/Version.py +++ b/lastversion/Version.py @@ -26,8 +26,10 @@ def fix_letter_post_release(self, match): return match.group(1) + '.post' + str(ord(match.group(2))) def is_semver(self): - """Check if this a semantic version""" - return self.base_version.count('.') == 2 + """ + Check if this a semantic version or a shorthand of semantic version + """ + return self.base_version.count('.') >= 1 @staticmethod def part_to_pypi(part): diff --git a/lastversion/__about__.py b/lastversion/__about__.py index ccf9dedd..5bc6ae85 100644 --- a/lastversion/__about__.py +++ b/lastversion/__about__.py @@ -1,3 +1,3 @@ """Package metadata""" -__version__ = '3.3.1' +__version__ = '3.3.2' __self__ = "dvershinin/lastversion" diff --git a/tests/test_github.py b/tests/test_github.py index 3b8e3522..9a0b84ff 100644 --- a/tests/test_github.py +++ b/tests/test_github.py @@ -45,3 +45,14 @@ def test_semver_preferred(): output = latest(repo) assert output == version.parse("8.10.0") + + +def test_semver_shorthand_preferred(): + """ + Test a GitHub project with a shorthand semver version number for releases + """ + repo = "https://github.com/lastversion-test-repos/cgal" + + output = latest(repo) + + assert output == version.parse("5.6")