Skip to content

Commit 2bd9973

Browse files
committed
Add min/max-python-version support to links-conditional
1 parent e0160f2 commit 2bd9973

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

pythonbuild/cpython.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,19 @@ def derive_setup_local(
569569
line += " %s" % link_for_target(lib, target_triple)
570570

571571
for entry in info.get("links-conditional", []):
572-
if any(re.match(p, target_triple) for p in entry["targets"]):
572+
if targets := entry.get("targets", []):
573+
target_match = any(re.match(p, target_triple) for p in targets)
574+
else:
575+
target_match = True
576+
577+
python_min_match = meets_python_minimum_version(
578+
python_version, entry.get("minimum-python-version", "1.0")
579+
)
580+
python_max_match = meets_python_maximum_version(
581+
python_version, entry.get("maximum-python-version", "100.0")
582+
)
583+
584+
if target_match and (python_min_match and python_max_match):
573585
line += " %s" % link_for_target(entry["name"], target_triple)
574586

575587
if "-apple-" in target_triple:

0 commit comments

Comments
 (0)