From 0bdafc56497f77a081e54c0f2482cbed77c6fc7c Mon Sep 17 00:00:00 2001 From: Joe Rickerby Date: Sun, 5 Apr 2020 12:12:42 +0100 Subject: [PATCH] Set MACOSX_DEPLOYMENT_TARGET to 10.9, if not set by the user --- cibuildwheel/macos.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/cibuildwheel/macos.py b/cibuildwheel/macos.py index 59106262..c867dc53 100644 --- a/cibuildwheel/macos.py +++ b/cibuildwheel/macos.py @@ -162,16 +162,17 @@ def build(project_dir, output_dir, test_command, before_test, test_requires, tes exit(1) call(['pip', 'install', '--upgrade', 'setuptools', 'wheel', 'delocate'], env=env) - # setup target platform, only required for python 3.5 + # Set MACOSX_DEPLOYMENT_TARGET to 10.9, if the user didn't set it. + # CPython 3.5 defaults to 10.6, and pypy defaults to 10.3, causing + # warnings and potential problems if it's left unset. + env.setdefault('MACOSX_DEPLOYMENT_TARGET', '10.9') + if config.version == '3.5': - if '_PYTHON_HOST_PLATFORM' not in env: - # cross-compilation platform override - env['_PYTHON_HOST_PLATFORM'] = 'macosx-10.9-x86_64' - if 'ARCHFLAGS' not in env: - # https://github.com/python/cpython/blob/a5ed2fe0eedefa1649aa93ee74a0bafc8e628a10/Lib/_osx_support.py#L260 - env['ARCHFLAGS'] = '-arch x86_64' - if 'MACOSX_DEPLOYMENT_TARGET' not in env: - env['MACOSX_DEPLOYMENT_TARGET'] = '10.9' + # Cross-compilation platform override - CPython 3.5 has an + # i386/x86_64 version of Python, but we only want a x64_64 build + env.setdefault('_PYTHON_HOST_PLATFORM', 'macosx-10.9-x86_64') + # https://github.com/python/cpython/blob/a5ed2fe0eedefa1649aa93ee74a0bafc8e628a10/Lib/_osx_support.py#L260 + env.setdefault('ARCHFLAGS', '-arch x86_64') # run the before_build command if before_build: