lastversion 3.6.2__tar.gz → 3.6.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {lastversion-3.6.2/src/lastversion.egg-info → lastversion-3.6.3}/PKG-INFO +1 -1
- {lastversion-3.6.2 → lastversion-3.6.3}/src/lastversion/__about__.py +1 -1
- {lastversion-3.6.2 → lastversion-3.6.3}/src/lastversion/repo_holders/github.py +57 -3
- {lastversion-3.6.2 → lastversion-3.6.3/src/lastversion.egg-info}/PKG-INFO +1 -1
- {lastversion-3.6.2 → lastversion-3.6.3}/tests/test_github.py +35 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/LICENSE +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/MANIFEST.in +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/README-ZH-CN.md +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/README.md +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/pyproject.toml +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/setup.cfg +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/setup.py +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/src/lastversion/__init__.py +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/src/lastversion/__main__.py +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/src/lastversion/ai.py +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/src/lastversion/argparse_version.py +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/src/lastversion/cache.py +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/src/lastversion/cli.py +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/src/lastversion/config.py +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/src/lastversion/exceptions.py +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/src/lastversion/holder_factory.py +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/src/lastversion/lastversion.py +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/src/lastversion/repo_holders/__init__.py +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/src/lastversion/repo_holders/alpine.py +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/src/lastversion/repo_holders/base.py +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/src/lastversion/repo_holders/bibucket.py +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/src/lastversion/repo_holders/feed.py +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/src/lastversion/repo_holders/gitea.py +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/src/lastversion/repo_holders/gitlab.py +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/src/lastversion/repo_holders/helmchat.py +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/src/lastversion/repo_holders/local.py +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/src/lastversion/repo_holders/mercurial.py +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/src/lastversion/repo_holders/pypi.py +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/src/lastversion/repo_holders/sourceforge.py +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/src/lastversion/repo_holders/system.py +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/src/lastversion/repo_holders/test.py +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/src/lastversion/repo_holders/wikipedia.py +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/src/lastversion/repo_holders/wordpress.py +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/src/lastversion/spdx_id_to_rpmspec.py +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/src/lastversion/utils.py +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/src/lastversion/version.py +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/src/lastversion.egg-info/SOURCES.txt +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/src/lastversion.egg-info/dependency_links.txt +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/src/lastversion.egg-info/entry_points.txt +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/src/lastversion.egg-info/not-zip-safe +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/src/lastversion.egg-info/requires.txt +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/src/lastversion.egg-info/top_level.txt +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/tests/test_alpine.py +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/tests/test_cache.py +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/tests/test_cli.py +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/tests/test_gitea.py +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/tests/test_gitlab.py +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/tests/test_hg.py +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/tests/test_lastversion.py +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/tests/test_pypi.py +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/tests/test_sf.py +0 -0
- {lastversion-3.6.2 → lastversion-3.6.3}/tests/test_wiki.py +0 -0
|
@@ -603,6 +603,27 @@ class GitHubRepoSession(BaseProjectHolder):
|
|
|
603
603
|
release["install_name"] = self.name
|
|
604
604
|
return release or None
|
|
605
605
|
|
|
606
|
+
@staticmethod
|
|
607
|
+
def is_version_more_specific(version_a, version_b):
|
|
608
|
+
"""Check if version_a is more specific than version_b.
|
|
609
|
+
|
|
610
|
+
A version is more specific if it has more release components and
|
|
611
|
+
starts with all the components of the less specific version.
|
|
612
|
+
E.g., 3.5.4 is more specific than 3.5.
|
|
613
|
+
|
|
614
|
+
Args:
|
|
615
|
+
version_a: The potentially more specific version.
|
|
616
|
+
version_b: The potentially less specific version.
|
|
617
|
+
|
|
618
|
+
Returns:
|
|
619
|
+
bool: True if version_a is more specific than version_b.
|
|
620
|
+
"""
|
|
621
|
+
release_a = version_a.release
|
|
622
|
+
release_b = version_b.release
|
|
623
|
+
if len(release_a) > len(release_b):
|
|
624
|
+
return release_a[: len(release_b)] == release_b
|
|
625
|
+
return False
|
|
626
|
+
|
|
606
627
|
def semver_check_skip(self, version, selected_release):
|
|
607
628
|
"""Should we skip this version from being selected based on semver."""
|
|
608
629
|
if version.is_semver():
|
|
@@ -625,6 +646,15 @@ class GitHubRepoSession(BaseProjectHolder):
|
|
|
625
646
|
if self.seen_semver and not version.is_semver():
|
|
626
647
|
log.info("Version %s is not a semver and we already found a semver", version)
|
|
627
648
|
return True
|
|
649
|
+
# Skip if the new version is less specific than the selected one
|
|
650
|
+
# e.g., skip 3.5 if we already have 3.5.4 (both under the 3.5 branch)
|
|
651
|
+
if comparable and self.is_version_more_specific(selected_release["version"], version):
|
|
652
|
+
log.info(
|
|
653
|
+
"Version %s is less specific than already selected %s",
|
|
654
|
+
version,
|
|
655
|
+
selected_release["version"],
|
|
656
|
+
)
|
|
657
|
+
return True
|
|
628
658
|
return False
|
|
629
659
|
|
|
630
660
|
def get_release_from_feed(self, pre_ok, major):
|
|
@@ -662,8 +692,17 @@ class GitHubRepoSession(BaseProjectHolder):
|
|
|
662
692
|
)
|
|
663
693
|
continue
|
|
664
694
|
if ret and tag_date + timedelta(days=30) < ret["tag_date"]:
|
|
665
|
-
|
|
666
|
-
|
|
695
|
+
# Don't break if the new version is more specific than the selected one
|
|
696
|
+
# e.g., continue processing 3.5.4 even if we selected 3.5 from a recent tag
|
|
697
|
+
if self.is_version_more_specific(version, ret["version"]):
|
|
698
|
+
log.info(
|
|
699
|
+
"Version %s is more specific than selected %s, continuing despite date",
|
|
700
|
+
version,
|
|
701
|
+
ret["version"],
|
|
702
|
+
)
|
|
703
|
+
else:
|
|
704
|
+
log.info("The version %s is newer, but is too old!", version)
|
|
705
|
+
break
|
|
667
706
|
# we always want to return formal release if it exists, because it has useful data
|
|
668
707
|
# grab formal release via APi to check for pre-release mark
|
|
669
708
|
formal_release = self.get_formal_release_for_tag(tag_name)
|
|
@@ -709,7 +748,22 @@ class GitHubRepoSession(BaseProjectHolder):
|
|
|
709
748
|
# simply because feeds list stuff in order of recency,
|
|
710
749
|
# however, still use /tags unless releases.atom has data within a year
|
|
711
750
|
if ret and ret["tag_date"].replace(tzinfo=None) > (datetime.utcnow() - timedelta(days=365)):
|
|
712
|
-
return
|
|
751
|
+
# Don't return early if the result is NOT a formal release and has a
|
|
752
|
+
# less-specific version (e.g., 3.5 instead of 3.5.x). In such cases,
|
|
753
|
+
# we should check the API for more specific formal releases.
|
|
754
|
+
# This handles cases where non-release tags like "3.5-POST-CLANG-FORMAT"
|
|
755
|
+
# are picked up from the feed but proper releases like "openssl-3.5.4"
|
|
756
|
+
# exist as formal releases. See issue #218.
|
|
757
|
+
is_non_formal = ret.get("type") == "feed"
|
|
758
|
+
version_components = len(ret["version"].release)
|
|
759
|
+
if is_non_formal and version_components < 3:
|
|
760
|
+
log.info(
|
|
761
|
+
"Feed result %s is non-formal with %d version components, checking API",
|
|
762
|
+
ret["version"],
|
|
763
|
+
version_components,
|
|
764
|
+
)
|
|
765
|
+
else:
|
|
766
|
+
return self.enrich_release_info(ret)
|
|
713
767
|
|
|
714
768
|
log.info("Feed contained none or only tags older than 1 year. Switching to API")
|
|
715
769
|
|
|
@@ -8,6 +8,8 @@ from packaging import version
|
|
|
8
8
|
|
|
9
9
|
from lastversion.cli import main
|
|
10
10
|
from lastversion.lastversion import latest
|
|
11
|
+
from lastversion.repo_holders.github import GitHubRepoSession
|
|
12
|
+
from lastversion.version import Version
|
|
11
13
|
from tests.helpers import captured_exit_code
|
|
12
14
|
|
|
13
15
|
|
|
@@ -134,3 +136,36 @@ def test_github_temurin8_latest_tag():
|
|
|
134
136
|
assert m is not None
|
|
135
137
|
update_num = int(m.group(1))
|
|
136
138
|
assert update_num >= 462
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
def test_is_version_more_specific():
|
|
142
|
+
"""Test the is_version_more_specific helper method."""
|
|
143
|
+
# 3.5.4 is more specific than 3.5
|
|
144
|
+
assert GitHubRepoSession.is_version_more_specific(Version("3.5.4"), Version("3.5"))
|
|
145
|
+
# 3.5.4.1 is more specific than 3.5.4
|
|
146
|
+
assert GitHubRepoSession.is_version_more_specific(Version("3.5.4.1"), Version("3.5.4"))
|
|
147
|
+
# 3.5.4 is more specific than 3
|
|
148
|
+
assert GitHubRepoSession.is_version_more_specific(Version("3.5.4"), Version("3"))
|
|
149
|
+
# 3.5 is NOT more specific than 3.5.4
|
|
150
|
+
assert not GitHubRepoSession.is_version_more_specific(Version("3.5"), Version("3.5.4"))
|
|
151
|
+
# 3.5.4 is NOT more specific than 3.5.4 (same)
|
|
152
|
+
assert not GitHubRepoSession.is_version_more_specific(Version("3.5.4"), Version("3.5.4"))
|
|
153
|
+
# 3.6.0 is NOT more specific than 3.5 (different version line)
|
|
154
|
+
assert not GitHubRepoSession.is_version_more_specific(Version("3.6.0"), Version("3.5"))
|
|
155
|
+
# 2.5.4 is NOT more specific than 3.5 (different major)
|
|
156
|
+
assert not GitHubRepoSession.is_version_more_specific(Version("2.5.4"), Version("3.5"))
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
def test_github_openssl_branch_prefers_specific_version():
|
|
160
|
+
"""
|
|
161
|
+
Test that when filtering by branch, a more specific version like 3.5.4 is
|
|
162
|
+
preferred over a less specific version like 3.5 (from a non-release tag).
|
|
163
|
+
This is a regression test for GitHub issue #218.
|
|
164
|
+
"""
|
|
165
|
+
repo = "https://github.com/openssl/openssl"
|
|
166
|
+
output = latest(repo, major="3.5")
|
|
167
|
+
# Should return a version like 3.5.4, not just 3.5
|
|
168
|
+
assert output is not None
|
|
169
|
+
assert output > version.parse("3.5.0"), f"Expected version > 3.5.0, got {output}"
|
|
170
|
+
# Verify it starts with 3.5
|
|
171
|
+
assert str(output).startswith("3.5."), f"Expected version starting with 3.5., got {output}"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|