Skip to content

Commit c4c9eba

Browse files
committed
Only build x86_64 / Intel 10.9+ on macOS
1 parent d175179 commit c4c9eba

File tree

5 files changed

+33
-31
lines changed

5 files changed

+33
-31
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ Python wheels are great. Building them across **Mac, Linux, Windows**, on **mult
1515
What does it do?
1616
----------------
1717

18-
| | macOS 10.6+ intel | macOS 10.9+ x86_64 | manylinux i686 | manylinux x86_64 | Windows 32bit | Windows 64bit |
19-
|---|---|---|---|---|---|---|
20-
| Python 2.7 || | || ✅¹ | ✅¹ |
21-
| Python 3.5 || | ||||
22-
| Python 3.6 || | ||||
23-
| Python 3.7 || | ||||
24-
| Python 3.8 | | |||||
18+
| | macOS 10.9+ x86_64 | manylinux i686 | manylinux x86_64 | Windows 32bit | Windows 64bit |
19+
|---|---|---|---|---|---|
20+
| Python 2.7 |||| ✅¹ | ✅¹ |
21+
| Python 3.5 ||||||
22+
| Python 3.6 ||||||
23+
| Python 3.7 ||||||
24+
| Python 3.8 ||||||
2525

2626
> ¹ Not supported on Travis
2727

cibuildwheel/__main__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def main():
6161
args = parser.parse_args()
6262

6363
detect_obsolete_options()
64-
64+
6565
if args.platform != 'auto':
6666
platform = args.platform
6767
else:
@@ -97,7 +97,7 @@ def main():
9797
if platform == 'linux':
9898
repair_command_default = 'auditwheel repair -w {dest_dir} {wheel}'
9999
elif platform == 'macos':
100-
repair_command_default = 'delocate-listdeps {wheel} && delocate-wheel -w {dest_dir} {wheel}'
100+
repair_command_default = 'delocate-listdeps {wheel} && delocate-wheel --require-archs x86_64 -w {dest_dir} {wheel}'
101101
else:
102102
repair_command_default = ''
103103
repair_command = get_option_from_environment('CIBW_REPAIR_WHEEL_COMMAND', platform=platform, default=repair_command_default)

cibuildwheel/macos.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
def get_python_configurations(build_selector):
1515
PythonConfiguration = namedtuple('PythonConfiguration', ['version', 'identifier', 'url'])
1616
python_configurations = [
17-
PythonConfiguration(version='2.7', identifier='cp27-macosx_10_6_intel', url='https://www.python.org/ftp/python/2.7.17/python-2.7.17-macosx10.6.pkg'),
18-
PythonConfiguration(version='3.5', identifier='cp35-macosx_10_6_intel', url='https://www.python.org/ftp/python/3.5.4/python-3.5.4-macosx10.6.pkg'),
19-
PythonConfiguration(version='3.6', identifier='cp36-macosx_10_6_intel', url='https://www.python.org/ftp/python/3.6.8/python-3.6.8-macosx10.6.pkg'),
20-
PythonConfiguration(version='3.7', identifier='cp37-macosx_10_6_intel', url='https://www.python.org/ftp/python/3.7.6/python-3.7.6-macosx10.6.pkg'),
17+
PythonConfiguration(version='2.7', identifier='cp27-macosx_10_9_x86_64', url='https://www.python.org/ftp/python/2.7.17/python-2.7.17-macosx10.9.pkg'),
18+
PythonConfiguration(version='3.5', identifier='cp35-macosx_10_9_x86_64', url='https://www.python.org/ftp/python/3.5.4/python-3.5.4-macosx10.6.pkg'),
19+
PythonConfiguration(version='3.6', identifier='cp36-macosx_10_9_x86_64', url='https://www.python.org/ftp/python/3.6.8/python-3.6.8-macosx10.9.pkg'),
20+
PythonConfiguration(version='3.7', identifier='cp37-macosx_10_9_x86_64', url='https://www.python.org/ftp/python/3.7.6/python-3.7.6-macosx10.9.pkg'),
2121
PythonConfiguration(version='3.8', identifier='cp38-macosx_10_9_x86_64', url='https://www.python.org/ftp/python/3.8.1/python-3.8.1-macosx10.9.pkg'),
2222
]
2323

@@ -32,6 +32,7 @@ def build(project_dir, output_dir, test_command, test_requires, test_extras, bef
3232
repaired_wheel_dir = os.path.join(temp_dir, 'repaired_wheel')
3333

3434
python_configurations = get_python_configurations(build_selector)
35+
3536
get_pip_url = 'https://bootstrap.pypa.io/get-pip.py'
3637
get_pip_script = '/tmp/get-pip.py'
3738

@@ -50,20 +51,19 @@ def call(args, env=None, cwd=None, shell=False):
5051
return subprocess.check_call(args, env=env, cwd=cwd, shell=shell)
5152

5253
# get latest pip once and for all
53-
54-
call(['curl', '-L', '--retry', '3', '--retry-delay', '3', '-o', get_pip_script, get_pip_url])
54+
call(['curl', '--retry', '3', '--retry-delay', '3', '-sSLo', get_pip_script, get_pip_url])
5555

5656
for config in python_configurations:
5757
# if this version of python isn't installed, get it from python.org and install
5858
python_package_identifier = 'org.python.Python.PythonFramework-%s' % config.version
5959
if python_package_identifier not in installed_system_packages:
6060
# download the pkg
61-
call(['curl', '-L', '-o', '/tmp/Python.pkg', config.url])
61+
call(['curl', '--retry', '3', '--retry-delay', '3', '-sSLo', '/tmp/Python.pkg', config.url])
6262
# install
6363
call(['sudo', 'installer', '-pkg', '/tmp/Python.pkg', '-target', '/'])
6464
# patch open ssl
6565
if config.version == '3.5':
66-
call(['curl', '-fsSLo', '/tmp/python-patch.tar.gz', 'https://github.com/mayeut/patch-macos-python-openssl/releases/download/v1.0.2t/patch-macos-python-%s-openssl-v1.0.2t.tar.gz' % config.version])
66+
call(['curl', '--retry', '3', '--retry-delay', '3', '-fsSLo', '/tmp/python-patch.tar.gz', 'https://github.com/mayeut/patch-macos-python-openssl/releases/download/v1.0.2t/patch-macos-python-%s-openssl-v1.0.2t.tar.gz' % config.version])
6767
call(['sudo', 'tar', '-C', '/Library/Frameworks/Python.framework/Versions/%s/' % config.version, '-xmf', '/tmp/python-patch.tar.gz'])
6868

6969
installation_bin_path = '/Library/Frameworks/Python.framework/Versions/{}/bin'.format(config.version)
@@ -98,6 +98,11 @@ def call(args, env=None, cwd=None, shell=False):
9898
call(['pip', '--version'], env=env)
9999
call(['pip', 'install', '--upgrade', 'setuptools', 'wheel', 'delocate'], env=env)
100100

101+
# setup target platform, only required for python 3.5
102+
if config.version == '3.5':
103+
env['_PYTHON_HOST_PLATFORM'] = 'macosx-10.9-x86_64' # cross-compilation platform override
104+
env['ARCHFLAGS'] = '-arch x86_64' # https://github.com/python/cpython/blob/a5ed2fe0eedefa1649aa93ee74a0bafc8e628a10/Lib/_osx_support.py#L260
105+
101106
# run the before_build command
102107
if before_build:
103108
before_build_prepared = prepare_command(before_build, project=abs_project_dir)

docs/options.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,21 +64,21 @@ This option can also be set using the command-line option `--platform`.
6464

6565
> Choose the Python versions to build
6666

67-
Space-separated list of builds to build and skip. Each build has an identifier like `cp27-manylinux_x86_64` or `cp35-macosx_10_6_intel` - you can list specific ones to build and `cibuildwheel` will only build those, and/or list ones to skip and `cibuildwheel` won't try to build them.
67+
Space-separated list of builds to build and skip. Each build has an identifier like `cp27-manylinux_x86_64` or `cp35-macosx_10_9_x86_64` - you can list specific ones to build and `cibuildwheel` will only build those, and/or list ones to skip and `cibuildwheel` won't try to build them.
6868

6969
When both options are specified, both conditions are applied and only builds with a tag that matches `CIBW_BUILD` and does not match `CIBW_SKIP` will be built.
7070

7171
When setting the options, you can use shell-style globbing syntax (as per `fnmatch`). All the build identifiers supported by cibuildwheel are shown below:
7272

7373
<div class="build-id-table-marker"></div>
7474

75-
| | macOS 64bit | macOS 32/64bit | Manylinux 64bit | Manylinux 32bit | Windows 64bit | Windows 32bit |
76-
|------------|-------------------------|------------------------|------------------------|----------------------|-----------------|----------------|
77-
| Python 2.7 | | cp27-macosx_10_6_intel | cp27-manylinux_x86_64 | cp27-manylinux_i686 | cp27-win_amd64 | cp27-win32 |
78-
| Python 3.5 | | cp35-macosx_10_6_intel | cp35-manylinux_x86_64 | cp35-manylinux_i686 | cp35-win_amd64 | cp35-win32 |
79-
| Python 3.6 | | cp36-macosx_10_6_intel | cp36-manylinux_x86_64 | cp36-manylinux_i686 | cp36-win_amd64 | cp36-win32 |
80-
| Python 3.7 | | cp37-macosx_10_6_intel | cp37-manylinux_x86_64 | cp37-manylinux_i686 | cp37-win_amd64 | cp37-win32 |
81-
| Python 3.8 | cp38-macosx_10_9_x86_64 | | cp38-manylinux_x86_64 | cp38-manylinux_i686 | cp38-win_amd64 | cp38-win32 |
75+
| | macOS 64bit | Manylinux 64bit | Manylinux 32bit | Windows 64bit | Windows 32bit |
76+
|------------|-------------------------|------------------------|----------------------|-----------------|----------------|
77+
| Python 2.7 | cp27-macosx_10_9_x86_64 | cp27-manylinux_x86_64 | cp27-manylinux_i686 | cp27-win_amd64 | cp27-win32 |
78+
| Python 3.5 | cp35-macosx_10_9_x86_64 | cp35-manylinux_x86_64 | cp35-manylinux_i686 | cp35-win_amd64 | cp35-win32 |
79+
| Python 3.6 | cp36-macosx_10_9_x86_64 | cp36-manylinux_x86_64 | cp36-manylinux_i686 | cp36-win_amd64 | cp36-win32 |
80+
| Python 3.7 | cp37-macosx_10_9_x86_64 | cp37-manylinux_x86_64 | cp37-manylinux_i686 | cp37-win_amd64 | cp37-win32 |
81+
| Python 3.8 | cp38-macosx_10_9_x86_64 | cp38-manylinux_x86_64 | cp38-manylinux_i686 | cp38-win_amd64 | cp38-win32 |
8282

8383
The list of supported and currently selected build identifiers can also be retrieved by passing the `--print-build-identifiers` flag to `cibuildwheel`.
8484
The format is `python_tag-platform_tag`, with tags similar to those in [PEP 425](https://www.python.org/dev/peps/pep-0425/#details).
@@ -90,7 +90,7 @@ The format is `python_tag-platform_tag`, with tags similar to those in [PEP 425]
9090
CIBW_BUILD: cp36-*
9191
9292
# Skip building on Python 2.7 on the Mac
93-
CIBW_SKIP: cp27-macosx_10_6_intel
93+
CIBW_SKIP: cp27-macosx_10_9_x86_64
9494
9595
# Skip building on Python 3.8 on the Mac
9696
CIBW_SKIP: cp38-macosx_10_9_x86_64
@@ -208,7 +208,7 @@ CIBW_BEFORE_BUILD: yum install -y libffi-dev && pip install .
208208
Default:
209209

210210
- on Linux: `'auditwheel repair -w {dest_dir} {wheel}'`
211-
- on macOS: `'delocate-listdeps {wheel} && delocate-wheel -w {dest_dir} {wheel}'`
211+
- on macOS: `'delocate-listdeps {wheel} && delocate-wheel --require-archs x86_64 -w {dest_dir} {wheel}'`
212212
- on Windows: `''`
213213

214214
A shell command to repair a built wheel by copying external library dependencies into the wheel tree and relinking them.

test/shared/utils.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,7 @@ def get_platform_tags(python_abi_tag):
9090
return ['win32', 'win_amd64']
9191
elif platform == 'macos':
9292
def get_platform_tags(python_abi_tag):
93-
if python_abi_tag == 'cp38-cp38':
94-
return ['macosx_10_9_x86_64']
95-
else:
96-
return ['macosx_10_6_intel']
93+
return ['macosx_10_9_x86_64']
9794
else:
9895
raise Exception('unsupported platform')
9996

0 commit comments

Comments
 (0)