Skip to content

Commit 023a1fa

Browse files
committed
dependency selection based on py version
Signed-off-by: Sreekanth Vadigi <[email protected]>
1 parent 6df672d commit 023a1fa

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

scripts/dependency_manager.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,24 @@ def _parse_constraint(self, name, constraint):
3939
if isinstance(constraint, str):
4040
return constraint, False # version_constraint, is_optional
4141
elif isinstance(constraint, list):
42-
# Handle complex constraints like pandas/pyarrow
42+
# Handle complex constraints like pandas/pyarrow with Python version markers
43+
current_python = sys.version_info
44+
current_version = f"{current_python.major}.{current_python.minor}"
45+
46+
# Find the constraint that matches the current Python version
47+
for item in constraint:
48+
if 'python' in item:
49+
python_spec = item['python']
50+
# Parse the Python version specifier
51+
spec_set = SpecifierSet(python_spec)
52+
53+
# Check if current Python version matches this constraint
54+
if current_version in spec_set:
55+
version = item['version']
56+
is_optional = item.get('optional', False)
57+
return version, is_optional
58+
59+
# Fallback to first constraint if no Python version match
4360
first_constraint = constraint[0]
4461
version = first_constraint['version']
4562
is_optional = first_constraint.get('optional', False)

0 commit comments

Comments
 (0)