From bd20455036d8f886e30ca6e5babed2bb138a6a62 Mon Sep 17 00:00:00 2001 From: Arthur Cheng Date: Wed, 19 Nov 2025 13:37:06 -0800 Subject: [PATCH] fix CI to resolve multiple version for same dep --- .github/scripts/get_min_versions.py | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/.github/scripts/get_min_versions.py b/.github/scripts/get_min_versions.py index 46e74c9..ca69b5c 100644 --- a/.github/scripts/get_min_versions.py +++ b/.github/scripts/get_min_versions.py @@ -44,14 +44,26 @@ def get_min_version_from_toml(toml_path: str): for lib in MIN_VERSION_LIBS: # Check if the lib is present in the dependencies if lib in dependencies: - # Get the version string - version_string = dependencies[lib] - - # Use parse_version to get the minimum supported version from version_string - min_version = get_min_version(version_string) - - # Store the minimum version in the min_versions dictionary - min_versions[lib] = min_version + # Get the version string or list + version_spec = dependencies[lib] + + # Handle list format (multiple version constraints for different Python versions) + if isinstance(version_spec, list): + # Extract all version strings from the list and find the minimum + versions = [] + for spec in version_spec: + if isinstance(spec, dict) and "version" in spec: + versions.append(get_min_version(spec["version"])) + + # If we found versions, use the minimum one + if versions: + # Parse all versions and select the minimum + min_version = min(versions, key=parse_version) + min_versions[lib] = min_version + elif isinstance(version_spec, str): + # Handle simple string format + min_version = get_min_version(version_spec) + min_versions[lib] = min_version return min_versions