Add option to specify additional markers for wheel build requirements (#129949)
This commit is contained in:
parent
9037cb8a7d
commit
0a4c0fe7cc
2 changed files with 56 additions and 5 deletions
|
@ -58,8 +58,16 @@ INCLUDED_REQUIREMENTS_WHEELS = {
|
||||||
# will be included in requirements_all_{action}.txt
|
# will be included in requirements_all_{action}.txt
|
||||||
|
|
||||||
OVERRIDDEN_REQUIREMENTS_ACTIONS = {
|
OVERRIDDEN_REQUIREMENTS_ACTIONS = {
|
||||||
"pytest": {"exclude": set(), "include": {"python-gammu"}},
|
"pytest": {
|
||||||
"wheels_aarch64": {"exclude": set(), "include": INCLUDED_REQUIREMENTS_WHEELS},
|
"exclude": set(),
|
||||||
|
"include": {"python-gammu"},
|
||||||
|
"markers": {},
|
||||||
|
},
|
||||||
|
"wheels_aarch64": {
|
||||||
|
"exclude": set(),
|
||||||
|
"include": INCLUDED_REQUIREMENTS_WHEELS,
|
||||||
|
"markers": {},
|
||||||
|
},
|
||||||
# Pandas has issues building on armhf, it is expected they
|
# Pandas has issues building on armhf, it is expected they
|
||||||
# will drop the platform in the near future (they consider it
|
# will drop the platform in the near future (they consider it
|
||||||
# "flimsy" on 386). The following packages depend on pandas,
|
# "flimsy" on 386). The following packages depend on pandas,
|
||||||
|
@ -67,10 +75,23 @@ OVERRIDDEN_REQUIREMENTS_ACTIONS = {
|
||||||
"wheels_armhf": {
|
"wheels_armhf": {
|
||||||
"exclude": {"env-canada", "noaa-coops", "pyezviz", "pykrakenapi"},
|
"exclude": {"env-canada", "noaa-coops", "pyezviz", "pykrakenapi"},
|
||||||
"include": INCLUDED_REQUIREMENTS_WHEELS,
|
"include": INCLUDED_REQUIREMENTS_WHEELS,
|
||||||
|
"markers": {},
|
||||||
|
},
|
||||||
|
"wheels_armv7": {
|
||||||
|
"exclude": set(),
|
||||||
|
"include": INCLUDED_REQUIREMENTS_WHEELS,
|
||||||
|
"markers": {},
|
||||||
|
},
|
||||||
|
"wheels_amd64": {
|
||||||
|
"exclude": set(),
|
||||||
|
"include": INCLUDED_REQUIREMENTS_WHEELS,
|
||||||
|
"markers": {},
|
||||||
|
},
|
||||||
|
"wheels_i386": {
|
||||||
|
"exclude": set(),
|
||||||
|
"include": INCLUDED_REQUIREMENTS_WHEELS,
|
||||||
|
"markers": {},
|
||||||
},
|
},
|
||||||
"wheels_armv7": {"exclude": set(), "include": INCLUDED_REQUIREMENTS_WHEELS},
|
|
||||||
"wheels_amd64": {"exclude": set(), "include": INCLUDED_REQUIREMENTS_WHEELS},
|
|
||||||
"wheels_i386": {"exclude": set(), "include": INCLUDED_REQUIREMENTS_WHEELS},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IGNORE_PIN = ("colorlog>2.1,<3", "urllib3")
|
IGNORE_PIN = ("colorlog>2.1,<3", "urllib3")
|
||||||
|
@ -311,6 +332,10 @@ def process_action_requirement(req: str, action: str) -> str:
|
||||||
return req
|
return req
|
||||||
if normalized_package_name in EXCLUDED_REQUIREMENTS_ALL:
|
if normalized_package_name in EXCLUDED_REQUIREMENTS_ALL:
|
||||||
return f"# {req}"
|
return f"# {req}"
|
||||||
|
if markers := OVERRIDDEN_REQUIREMENTS_ACTIONS[action]["markers"].get(
|
||||||
|
normalized_package_name, None
|
||||||
|
):
|
||||||
|
return f"{req};{markers}"
|
||||||
return req
|
return req
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
"""Tests for the gen_requirements_all script."""
|
"""Tests for the gen_requirements_all script."""
|
||||||
|
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
from script import gen_requirements_all
|
from script import gen_requirements_all
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,3 +25,27 @@ def test_include_overrides_subsets() -> None:
|
||||||
for overrides in gen_requirements_all.OVERRIDDEN_REQUIREMENTS_ACTIONS.values():
|
for overrides in gen_requirements_all.OVERRIDDEN_REQUIREMENTS_ACTIONS.values():
|
||||||
for req in overrides["include"]:
|
for req in overrides["include"]:
|
||||||
assert req in gen_requirements_all.EXCLUDED_REQUIREMENTS_ALL
|
assert req in gen_requirements_all.EXCLUDED_REQUIREMENTS_ALL
|
||||||
|
|
||||||
|
|
||||||
|
def test_requirement_override_markers() -> None:
|
||||||
|
"""Test override markers are applied to the correct requirements."""
|
||||||
|
data = {
|
||||||
|
"pytest": {
|
||||||
|
"exclude": set(),
|
||||||
|
"include": set(),
|
||||||
|
"markers": {"env-canada": "python_version<'3.13'"},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
with patch.dict(
|
||||||
|
gen_requirements_all.OVERRIDDEN_REQUIREMENTS_ACTIONS, data, clear=True
|
||||||
|
):
|
||||||
|
assert (
|
||||||
|
gen_requirements_all.process_action_requirement(
|
||||||
|
"env-canada==0.7.2", "pytest"
|
||||||
|
)
|
||||||
|
== "env-canada==0.7.2;python_version<'3.13'"
|
||||||
|
)
|
||||||
|
assert (
|
||||||
|
gen_requirements_all.process_action_requirement("other==1.0", "pytest")
|
||||||
|
== "other==1.0"
|
||||||
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue