feat: use lenient version matching for compatibility check
Use target="7.*" instead of "7.0" to match any version in the major version series. This allows plugins with min=7.5.0 to still appear in the Zotero 7 compatible list. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
722d8c6a62
commit
f2511f188c
2
src/zotero_scraper/cache/release_cache.py
vendored
2
src/zotero_scraper/cache/release_cache.py
vendored
@ -76,7 +76,7 @@ class CachedRelease:
|
|||||||
|
|
||||||
# Target version X.0 must be within [min_version, max_version]
|
# Target version X.0 must be within [min_version, max_version]
|
||||||
# e.g., for target "7", check if 7.0 >= min_ver and 7.0 <= max_ver
|
# e.g., for target "7", check if 7.0 >= min_ver and 7.0 <= max_ver
|
||||||
target = f"{zotero_version}.0"
|
target = f"{zotero_version}.*"
|
||||||
|
|
||||||
return (
|
return (
|
||||||
compare_versions(target, min_ver) >= 0
|
compare_versions(target, min_ver) >= 0
|
||||||
|
|||||||
@ -37,15 +37,27 @@ def compare_versions(version1: Union[str, int], version2: Union[str, int]) -> in
|
|||||||
if p1 == "*" or p2 == "*":
|
if p1 == "*" or p2 == "*":
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Try numeric comparison
|
# Check if parts are numeric
|
||||||
try:
|
p1_is_num = p1.isdigit()
|
||||||
|
p2_is_num = p2.isdigit()
|
||||||
|
|
||||||
|
if p1_is_num and p2_is_num:
|
||||||
|
# Both numeric - compare as integers
|
||||||
n1, n2 = int(p1), int(p2)
|
n1, n2 = int(p1), int(p2)
|
||||||
if n1 < n2:
|
if n1 < n2:
|
||||||
return -1
|
return -1
|
||||||
elif n1 > n2:
|
elif n1 > n2:
|
||||||
return 1
|
return 1
|
||||||
except ValueError:
|
elif p1_is_num and not p2_is_num:
|
||||||
# Fall back to string comparison for non-numeric parts
|
# p1 is numeric (stable), p2 is pre-release (alpha/beta/rc)
|
||||||
|
# Stable > pre-release, so p1 > p2
|
||||||
|
return 1
|
||||||
|
elif not p1_is_num and p2_is_num:
|
||||||
|
# p1 is pre-release, p2 is numeric (stable)
|
||||||
|
# Pre-release < stable, so p1 < p2
|
||||||
|
return -1
|
||||||
|
else:
|
||||||
|
# Both non-numeric - string comparison
|
||||||
if p1 < p2:
|
if p1 < p2:
|
||||||
return -1
|
return -1
|
||||||
elif p1 > p2:
|
elif p1 > p2:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user