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:
ytshen 2025-12-30 17:28:06 +08:00
parent 722d8c6a62
commit f2511f188c
2 changed files with 17 additions and 5 deletions

View File

@ -76,7 +76,7 @@ class CachedRelease:
# 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
target = f"{zotero_version}.0"
target = f"{zotero_version}.*"
return (
compare_versions(target, min_ver) >= 0

View File

@ -37,15 +37,27 @@ def compare_versions(version1: Union[str, int], version2: Union[str, int]) -> in
if p1 == "*" or p2 == "*":
continue
# Try numeric comparison
try:
# Check if parts are numeric
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)
if n1 < n2:
return -1
elif n1 > n2:
return 1
except ValueError:
# Fall back to string comparison for non-numeric parts
elif p1_is_num and not p2_is_num:
# 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:
return -1
elif p1 > p2: