feat: adding enable (#2048)
* feat: adding enable Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> * refactor: use recommended term Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> * fix: use `cached_property` for `Options` properties * fix: warn on PyPy default --------- Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> Co-authored-by: mayeut <mayeut@users.noreply.github.com>
This commit is contained in:
co-authored by
mayeut
parent
9459533408
commit
393e0352e8
@@ -2,11 +2,13 @@ from __future__ import annotations
|
||||
|
||||
from packaging.specifiers import SpecifierSet
|
||||
|
||||
from cibuildwheel.util import BuildSelector
|
||||
from cibuildwheel.util import BuildSelector, EnableGroups
|
||||
|
||||
|
||||
def test_build():
|
||||
build_selector = BuildSelector(build_config="cp3*-* *-manylinux*", skip_config="")
|
||||
build_selector = BuildSelector(
|
||||
build_config="cp3*-* *-manylinux*", skip_config="", enable=frozenset([EnableGroups.PyPy])
|
||||
)
|
||||
|
||||
assert build_selector("cp36-manylinux_x86_64")
|
||||
assert build_selector("cp37-manylinux_x86_64")
|
||||
@@ -43,7 +45,7 @@ def test_build_filter_pre():
|
||||
build_selector = BuildSelector(
|
||||
build_config="cp3*-* *-manylinux*",
|
||||
skip_config="",
|
||||
prerelease_pythons=True,
|
||||
enable=frozenset([EnableGroups.CPythonPrerelease, EnableGroups.PyPy]),
|
||||
)
|
||||
|
||||
assert build_selector("cp37-manylinux_x86_64")
|
||||
@@ -55,7 +57,9 @@ def test_build_filter_pre():
|
||||
|
||||
def test_skip():
|
||||
build_selector = BuildSelector(
|
||||
build_config="*", skip_config="pp36-* cp3?-manylinux_i686 cp36-win* *-win32"
|
||||
build_config="*",
|
||||
skip_config="pp36-* cp3?-manylinux_i686 cp36-win* *-win32",
|
||||
enable=frozenset([EnableGroups.PyPy]),
|
||||
)
|
||||
|
||||
assert not build_selector("pp36-manylinux_x86_64")
|
||||
@@ -79,7 +83,9 @@ def test_skip():
|
||||
|
||||
def test_build_and_skip():
|
||||
build_selector = BuildSelector(
|
||||
build_config="cp36-* cp37-macosx* *-manylinux*", skip_config="pp37-* cp37-manylinux_i686"
|
||||
build_config="cp36-* cp37-macosx* *-manylinux*",
|
||||
skip_config="pp37-* cp37-manylinux_i686",
|
||||
enable=frozenset([EnableGroups.PyPy]),
|
||||
)
|
||||
|
||||
assert not build_selector("pp37-manylinux_x86_64")
|
||||
@@ -110,7 +116,10 @@ def test_build_braces():
|
||||
|
||||
def test_build_limited_python():
|
||||
build_selector = BuildSelector(
|
||||
build_config="*", skip_config="", requires_python=SpecifierSet(">=3.7")
|
||||
build_config="*",
|
||||
skip_config="",
|
||||
requires_python=SpecifierSet(">=3.7"),
|
||||
enable=frozenset([EnableGroups.PyPy]),
|
||||
)
|
||||
|
||||
assert not build_selector("cp36-manylinux_x86_64")
|
||||
@@ -146,9 +155,7 @@ def test_build_limited_python_patch():
|
||||
|
||||
|
||||
def test_build_free_threaded_python():
|
||||
build_selector = BuildSelector(
|
||||
build_config="*", skip_config="", prerelease_pythons=True, free_threaded_support=True
|
||||
)
|
||||
build_selector = BuildSelector(build_config="*", skip_config="", enable=frozenset(EnableGroups))
|
||||
|
||||
assert build_selector("cp313t-manylinux_x86_64")
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import pytest
|
||||
|
||||
from cibuildwheel.__main__ import main
|
||||
from cibuildwheel.architecture import Architecture
|
||||
from cibuildwheel.util import EnableGroups
|
||||
|
||||
from ..conftest import MOCK_PACKAGE_DIR
|
||||
|
||||
@@ -216,7 +217,7 @@ def test_only_argument(intercepted_build_args, monkeypatch, only, plat):
|
||||
assert options.globals.build_selector.skip_config == ""
|
||||
assert options.platform == plat
|
||||
assert options.globals.architectures == Architecture.all_archs(plat)
|
||||
assert options.globals.build_selector.prerelease_pythons is True
|
||||
assert EnableGroups.PyPy in options.globals.build_selector.enable
|
||||
|
||||
|
||||
@pytest.mark.parametrize("only", ("cp311-manylxinux_x86_64", "some_linux_thing"))
|
||||
|
||||
@@ -15,6 +15,7 @@ from cibuildwheel.options import (
|
||||
Options,
|
||||
_get_pinned_container_images,
|
||||
)
|
||||
from cibuildwheel.util import EnableGroups
|
||||
|
||||
PYPROJECT_1 = """
|
||||
[tool.cibuildwheel]
|
||||
@@ -454,4 +455,7 @@ def test_free_threaded_support(
|
||||
)
|
||||
)
|
||||
options = Options(platform="linux", command_line_arguments=args, env=env)
|
||||
assert options.globals.build_selector.free_threaded_support is expected_result
|
||||
if expected_result:
|
||||
assert EnableGroups.CPythonFreeThreading in options.globals.build_selector.enable
|
||||
else:
|
||||
assert EnableGroups.CPythonFreeThreading not in options.globals.build_selector.enable
|
||||
|
||||
Reference in New Issue
Block a user