fix: move and simplify arch check
This commit is contained in:
@@ -20,6 +20,7 @@ from cibuildwheel.util import (
|
|||||||
DependencyConstraints,
|
DependencyConstraints,
|
||||||
TestSelector,
|
TestSelector,
|
||||||
Unbuffered,
|
Unbuffered,
|
||||||
|
allowed_architectures_check,
|
||||||
detect_ci_provider,
|
detect_ci_provider,
|
||||||
resources_dir,
|
resources_dir,
|
||||||
)
|
)
|
||||||
@@ -257,6 +258,12 @@ def main() -> None:
|
|||||||
|
|
||||||
print_preamble(platform, build_options)
|
print_preamble(platform, build_options)
|
||||||
|
|
||||||
|
try:
|
||||||
|
allowed_architectures_check(platform, build_options)
|
||||||
|
except ValueError as err:
|
||||||
|
print("cibuildwheel:", *err.args, file=sys.stderr)
|
||||||
|
sys.exit(4)
|
||||||
|
|
||||||
if not identifiers:
|
if not identifiers:
|
||||||
print(f'cibuildwheel: No build identifiers selected: {build_selector}', file=sys.stderr)
|
print(f'cibuildwheel: No build identifiers selected: {build_selector}', file=sys.stderr)
|
||||||
if not args.allow_empty:
|
if not args.allow_empty:
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ from .util import (
|
|||||||
BuildOptions,
|
BuildOptions,
|
||||||
BuildSelector,
|
BuildSelector,
|
||||||
NonPlatformWheelError,
|
NonPlatformWheelError,
|
||||||
allowed_architectures_check,
|
|
||||||
get_build_verbosity_extra_flags,
|
get_build_verbosity_extra_flags,
|
||||||
prepare_command,
|
prepare_command,
|
||||||
read_python_configs,
|
read_python_configs,
|
||||||
@@ -49,8 +48,6 @@ def get_python_configurations(
|
|||||||
|
|
||||||
|
|
||||||
def build(options: BuildOptions) -> None:
|
def build(options: BuildOptions) -> None:
|
||||||
allowed_architectures_check('linux', options)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
subprocess.check_output(['docker', '--version'])
|
subprocess.check_output(['docker', '--version'])
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ from .util import (
|
|||||||
BuildOptions,
|
BuildOptions,
|
||||||
BuildSelector,
|
BuildSelector,
|
||||||
NonPlatformWheelError,
|
NonPlatformWheelError,
|
||||||
allowed_architectures_check,
|
|
||||||
download,
|
download,
|
||||||
get_build_verbosity_extra_flags,
|
get_build_verbosity_extra_flags,
|
||||||
get_pip_script,
|
get_pip_script,
|
||||||
@@ -188,8 +187,6 @@ def setup_python(python_configuration: PythonConfiguration,
|
|||||||
|
|
||||||
|
|
||||||
def build(options: BuildOptions) -> None:
|
def build(options: BuildOptions) -> None:
|
||||||
allowed_architectures_check("macos", options)
|
|
||||||
|
|
||||||
temp_dir = Path(tempfile.mkdtemp(prefix='cibuildwheel'))
|
temp_dir = Path(tempfile.mkdtemp(prefix='cibuildwheel'))
|
||||||
built_wheel_dir = temp_dir / 'built_wheel'
|
built_wheel_dir = temp_dir / 'built_wheel'
|
||||||
repaired_wheel_dir = temp_dir / 'repaired_wheel'
|
repaired_wheel_dir = temp_dir / 'repaired_wheel'
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ from .util import (
|
|||||||
BuildOptions,
|
BuildOptions,
|
||||||
BuildSelector,
|
BuildSelector,
|
||||||
NonPlatformWheelError,
|
NonPlatformWheelError,
|
||||||
allowed_architectures_check,
|
|
||||||
download,
|
download,
|
||||||
get_build_verbosity_extra_flags,
|
get_build_verbosity_extra_flags,
|
||||||
get_pip_script,
|
get_pip_script,
|
||||||
@@ -207,8 +206,6 @@ def pep_518_cp35_workaround(package_dir: Path, env: Dict[str, str]) -> None:
|
|||||||
|
|
||||||
|
|
||||||
def build(options: BuildOptions) -> None:
|
def build(options: BuildOptions) -> None:
|
||||||
allowed_architectures_check('windows', options)
|
|
||||||
|
|
||||||
temp_dir = Path(tempfile.mkdtemp(prefix='cibuildwheel'))
|
temp_dir = Path(tempfile.mkdtemp(prefix='cibuildwheel'))
|
||||||
built_wheel_dir = temp_dir / 'built_wheel'
|
built_wheel_dir = temp_dir / 'built_wheel'
|
||||||
repaired_wheel_dir = temp_dir / 'repaired_wheel'
|
repaired_wheel_dir = temp_dir / 'repaired_wheel'
|
||||||
|
|||||||
@@ -81,8 +81,6 @@ def test_archs_default(platform, intercepted_build_args, monkeypatch):
|
|||||||
|
|
||||||
@pytest.mark.parametrize('use_env_var', [False, True])
|
@pytest.mark.parametrize('use_env_var', [False, True])
|
||||||
def test_archs_argument(platform, intercepted_build_args, monkeypatch, use_env_var):
|
def test_archs_argument(platform, intercepted_build_args, monkeypatch, use_env_var):
|
||||||
if platform == 'windows':
|
|
||||||
pytest.skip('Will have empty build selectors on Windows')
|
|
||||||
|
|
||||||
if use_env_var:
|
if use_env_var:
|
||||||
monkeypatch.setenv('CIBW_ARCHS', 'ppc64le')
|
monkeypatch.setenv('CIBW_ARCHS', 'ppc64le')
|
||||||
@@ -90,10 +88,15 @@ def test_archs_argument(platform, intercepted_build_args, monkeypatch, use_env_v
|
|||||||
monkeypatch.setenv('CIBW_ARCHS', 'unused')
|
monkeypatch.setenv('CIBW_ARCHS', 'unused')
|
||||||
monkeypatch.setattr(sys, 'argv', sys.argv + ['--archs', 'ppc64le'])
|
monkeypatch.setattr(sys, 'argv', sys.argv + ['--archs', 'ppc64le'])
|
||||||
|
|
||||||
main()
|
if platform in {'macos', 'windows'}:
|
||||||
build_options = intercepted_build_args.args[0]
|
with pytest.raises(SystemExit) as err:
|
||||||
|
main()
|
||||||
|
assert err.value.args == (4,)
|
||||||
|
|
||||||
assert build_options.architectures == {Architecture.ppc64le}
|
else:
|
||||||
|
main()
|
||||||
|
build_options = intercepted_build_args.args[0]
|
||||||
|
assert build_options.architectures == {Architecture.ppc64le}
|
||||||
|
|
||||||
|
|
||||||
def test_archs_platform_specific(platform, intercepted_build_args, monkeypatch):
|
def test_archs_platform_specific(platform, intercepted_build_args, monkeypatch):
|
||||||
|
|||||||
Reference in New Issue
Block a user