Skip to content

Commit cd8d276

Browse files
fix CI to resolve multiple version for same dep (#68)
1 parent 0fca982 commit cd8d276

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

.github/scripts/get_min_versions.py

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,26 @@ def get_min_version_from_toml(toml_path: str):
4444
for lib in MIN_VERSION_LIBS:
4545
# Check if the lib is present in the dependencies
4646
if lib in dependencies:
47-
# Get the version string
48-
version_string = dependencies[lib]
49-
50-
# Use parse_version to get the minimum supported version from version_string
51-
min_version = get_min_version(version_string)
52-
53-
# Store the minimum version in the min_versions dictionary
54-
min_versions[lib] = min_version
47+
# Get the version string or list
48+
version_spec = dependencies[lib]
49+
50+
# Handle list format (multiple version constraints for different Python versions)
51+
if isinstance(version_spec, list):
52+
# Extract all version strings from the list and find the minimum
53+
versions = []
54+
for spec in version_spec:
55+
if isinstance(spec, dict) and "version" in spec:
56+
versions.append(get_min_version(spec["version"]))
57+
58+
# If we found versions, use the minimum one
59+
if versions:
60+
# Parse all versions and select the minimum
61+
min_version = min(versions, key=parse_version)
62+
min_versions[lib] = min_version
63+
elif isinstance(version_spec, str):
64+
# Handle simple string format
65+
min_version = get_min_version(version_spec)
66+
min_versions[lib] = min_version
5567

5668
return min_versions
5769

0 commit comments

Comments
 (0)