chore: drop deprecated options related to CIBW_ENABLE (#2095)
* chore: drop deprecated options * Add --enable option * Fix pyodide tests --------- Co-authored-by: Joe Rickerby <joerick@mac.com>
This commit is contained in:
co-authored by
Joe Rickerby
parent
730b64249f
commit
d134edc652
@@ -30,6 +30,7 @@ from cibuildwheel.util import (
|
||||
CIBW_CACHE_PATH,
|
||||
BuildSelector,
|
||||
CIProvider,
|
||||
EnableGroup,
|
||||
Unbuffered,
|
||||
detect_ci_provider,
|
||||
fix_ansi_codes_for_github_actions,
|
||||
@@ -100,6 +101,17 @@ def main_inner(global_options: GlobalOptions) -> None:
|
||||
""",
|
||||
)
|
||||
|
||||
enable_groups_str = ", ".join(g.value for g in EnableGroup)
|
||||
parser.add_argument(
|
||||
"--enable",
|
||||
action="append",
|
||||
default=[],
|
||||
metavar="GROUP",
|
||||
help=f"""
|
||||
Enable an additional category of builds. Use multiple times to select multiple groups. Choices: {enable_groups_str}.
|
||||
""",
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"--only",
|
||||
default=None,
|
||||
@@ -156,12 +168,6 @@ def main_inner(global_options: GlobalOptions) -> None:
|
||||
help="Do not report an error code if the build does not match any wheels.",
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"--prerelease-pythons",
|
||||
action="store_true",
|
||||
help="Enable pre-release Python versions if available.",
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"--debug-traceback",
|
||||
action="store_true",
|
||||
|
||||
+12
-42
@@ -29,10 +29,9 @@ from .util import (
|
||||
BuildFrontendConfig,
|
||||
BuildSelector,
|
||||
DependencyConstraints,
|
||||
EnableGroups,
|
||||
EnableGroup,
|
||||
TestSelector,
|
||||
format_safe,
|
||||
read_python_configs,
|
||||
resources_dir,
|
||||
selector_matches,
|
||||
strtobool,
|
||||
@@ -50,8 +49,8 @@ class CommandLineArguments:
|
||||
package_dir: Path
|
||||
print_build_identifiers: bool
|
||||
allow_empty: bool
|
||||
prerelease_pythons: bool
|
||||
debug_traceback: bool
|
||||
enable: list[str]
|
||||
|
||||
@staticmethod
|
||||
def defaults() -> CommandLineArguments:
|
||||
@@ -63,9 +62,9 @@ class CommandLineArguments:
|
||||
config_file="",
|
||||
output_dir=Path("wheelhouse"),
|
||||
package_dir=Path("."),
|
||||
prerelease_pythons=False,
|
||||
print_build_identifiers=False,
|
||||
debug_traceback=False,
|
||||
enable=[],
|
||||
)
|
||||
|
||||
|
||||
@@ -618,28 +617,13 @@ class Options:
|
||||
enable_groups = self.reader.get(
|
||||
"enable", env_plat=False, option_format=ListFormat(sep=" "), env_rule=InheritRule.APPEND
|
||||
)
|
||||
enable = {EnableGroups(group) for group in enable_groups.split()}
|
||||
|
||||
free_threaded_support = strtobool(
|
||||
self.reader.get("free-threaded-support", env_plat=False, ignore_empty=True)
|
||||
)
|
||||
|
||||
prerelease_pythons = args.prerelease_pythons or strtobool(
|
||||
self.env.get("CIBW_PRERELEASE_PYTHONS", "0")
|
||||
)
|
||||
|
||||
if free_threaded_support or prerelease_pythons:
|
||||
msg = (
|
||||
"free-threaded-support and prerelease-pythons should be specified by enable instead"
|
||||
)
|
||||
if enable:
|
||||
raise OptionsReaderError(msg)
|
||||
log.warning(msg)
|
||||
|
||||
if free_threaded_support:
|
||||
enable.add(EnableGroups.CPythonFreeThreading)
|
||||
if prerelease_pythons:
|
||||
enable.add(EnableGroups.CPythonPrerelease)
|
||||
try:
|
||||
enable = {EnableGroup(group) for group in enable_groups.split()}
|
||||
for command_line_group in args.enable:
|
||||
enable.add(EnableGroup(command_line_group))
|
||||
except ValueError as e:
|
||||
msg = f"Failed to parse enable group. {e}. Valid group names are: {', '.join(g.value for g in EnableGroup)}"
|
||||
raise errors.ConfigurationError(msg) from e
|
||||
|
||||
# This is not supported in tool.cibuildwheel, as it comes from a standard location.
|
||||
# Passing this in as an environment variable will override pyproject.toml, setup.cfg, or setup.py
|
||||
@@ -656,30 +640,16 @@ class Options:
|
||||
build_config = args.only
|
||||
skip_config = ""
|
||||
architectures = Architecture.all_archs(self.platform)
|
||||
enable = set(EnableGroups)
|
||||
enable = set(EnableGroup)
|
||||
|
||||
build_selector = BuildSelector(
|
||||
build_config=build_config,
|
||||
skip_config=skip_config,
|
||||
requires_python=requires_python,
|
||||
enable=frozenset(
|
||||
enable | {EnableGroups.PyPy}
|
||||
), # For backwards compatibility, we are adding PyPy for now
|
||||
enable=frozenset(enable),
|
||||
)
|
||||
test_selector = TestSelector(skip_config=test_skip)
|
||||
|
||||
all_configs = read_python_configs(self.platform)
|
||||
all_pypy_ids = {
|
||||
config["identifier"] for config in all_configs if config["identifier"].startswith("pp")
|
||||
}
|
||||
if (
|
||||
not self._defaults
|
||||
and EnableGroups.PyPy not in enable
|
||||
and any(build_selector(build_id) for build_id in all_pypy_ids)
|
||||
):
|
||||
msg = "PyPy builds will be disabled by default in version 3. Enabling PyPy builds should be specified by enable"
|
||||
log.warning(msg)
|
||||
|
||||
return GlobalOptions(
|
||||
package_dir=package_dir,
|
||||
output_dir=output_dir,
|
||||
|
||||
@@ -284,13 +284,6 @@
|
||||
],
|
||||
"title": "CIBW_ENVIRONMENT_PASS"
|
||||
},
|
||||
"free-threaded-support": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "The project supports free-threaded builds of Python (PEP703)",
|
||||
"deprecated": "Use the `enable` option instead.",
|
||||
"title": "CIBW_FREE_THREADED_SUPPORT"
|
||||
},
|
||||
"manylinux-aarch64-image": {
|
||||
"type": "string",
|
||||
"description": "Specify alternative manylinux / musllinux container images",
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
build = "*"
|
||||
skip = ""
|
||||
test-skip = ""
|
||||
free-threaded-support = false
|
||||
enable = []
|
||||
|
||||
archs = ["auto"]
|
||||
|
||||
@@ -44,7 +44,7 @@ from .typing import PathOrStr, PlatformName
|
||||
|
||||
__all__ = [
|
||||
"MANYLINUX_ARCHS",
|
||||
"EnableGroups",
|
||||
"EnableGroup",
|
||||
"call",
|
||||
"combine_constraints",
|
||||
"find_compatible_wheel",
|
||||
@@ -67,7 +67,7 @@ install_certifi_script: Final[Path] = resources_dir / "install_certifi.py"
|
||||
free_thread_enable_313: Final[Path] = resources_dir / "free-threaded-enable-313.xml"
|
||||
|
||||
|
||||
class EnableGroups(enum.Enum):
|
||||
class EnableGroup(enum.Enum):
|
||||
"""
|
||||
Groups of build selectors that are not enabled by default.
|
||||
"""
|
||||
@@ -278,7 +278,7 @@ class BuildSelector:
|
||||
build_config: str
|
||||
skip_config: str
|
||||
requires_python: SpecifierSet | None = None
|
||||
enable: frozenset[EnableGroups] = frozenset()
|
||||
enable: frozenset[EnableGroup] = frozenset()
|
||||
|
||||
def __call__(self, build_id: str) -> bool:
|
||||
# Filter build selectors by python_requires if set
|
||||
@@ -293,15 +293,15 @@ class BuildSelector:
|
||||
return False
|
||||
|
||||
# filter out groups that are not enabled
|
||||
if EnableGroups.CPythonFreeThreading not in self.enable and selector_matches(
|
||||
if EnableGroup.CPythonFreeThreading not in self.enable and selector_matches(
|
||||
"cp3??t-*", build_id
|
||||
):
|
||||
return False
|
||||
if EnableGroups.CPythonPrerelease not in self.enable and selector_matches(
|
||||
if EnableGroup.CPythonPrerelease not in self.enable and selector_matches(
|
||||
"cp314*", build_id
|
||||
):
|
||||
return False
|
||||
if EnableGroups.PyPy not in self.enable and selector_matches("pp*", build_id):
|
||||
if EnableGroup.PyPy not in self.enable and selector_matches("pp*", build_id):
|
||||
return False
|
||||
|
||||
should_build = selector_matches(self.build_config, build_id)
|
||||
|
||||
Reference in New Issue
Block a user