Add manylinux_2_24 support (#595)

This commit is contained in:
Matthieu Darbois
2021-02-18 08:15:37 +01:00
committed by GitHub
parent 14f2f4eeb1
commit 1e7961c157
10 changed files with 46 additions and 21 deletions
+6
View File
@@ -71,6 +71,12 @@ images = [
Image('manylinux2014', 'aarch64', 'quay.io/pypa/manylinux2014_aarch64', None), Image('manylinux2014', 'aarch64', 'quay.io/pypa/manylinux2014_aarch64', None),
Image('manylinux2014', 'ppc64le', 'quay.io/pypa/manylinux2014_ppc64le', None), Image('manylinux2014', 'ppc64le', 'quay.io/pypa/manylinux2014_ppc64le', None),
Image('manylinux2014', 's390x', 'quay.io/pypa/manylinux2014_s390x', None), Image('manylinux2014', 's390x', 'quay.io/pypa/manylinux2014_s390x', None),
Image('manylinux_2_24', 'x86_64', 'quay.io/pypa/manylinux_2_24_x86_64', None),
Image('manylinux_2_24', 'i686', 'quay.io/pypa/manylinux_2_24_i686', None),
Image('manylinux_2_24', 'aarch64', 'quay.io/pypa/manylinux_2_24_aarch64', None),
Image('manylinux_2_24', 'ppc64le', 'quay.io/pypa/manylinux_2_24_ppc64le', None),
Image('manylinux_2_24', 's390x', 'quay.io/pypa/manylinux_2_24_s390x', None),
] ]
config = configparser.ConfigParser() config = configparser.ConfigParser()
@@ -2,21 +2,26 @@
manylinux1 = quay.io/pypa/manylinux1_x86_64:2021-02-06-920c3c7 manylinux1 = quay.io/pypa/manylinux1_x86_64:2021-02-06-920c3c7
manylinux2010 = quay.io/pypa/manylinux2010_x86_64:2021-02-06-3d322a5 manylinux2010 = quay.io/pypa/manylinux2010_x86_64:2021-02-06-3d322a5
manylinux2014 = quay.io/pypa/manylinux2014_x86_64:2021-02-14-fc316c3 manylinux2014 = quay.io/pypa/manylinux2014_x86_64:2021-02-14-fc316c3
manylinux_2_24 = quay.io/pypa/manylinux_2_24_x86_64:2021-02-14-fc316c3
[i686] [i686]
manylinux1 = quay.io/pypa/manylinux1_i686:2021-02-06-920c3c7 manylinux1 = quay.io/pypa/manylinux1_i686:2021-02-06-920c3c7
manylinux2010 = quay.io/pypa/manylinux2010_i686:2021-02-06-3d322a5 manylinux2010 = quay.io/pypa/manylinux2010_i686:2021-02-06-3d322a5
manylinux2014 = quay.io/pypa/manylinux2014_i686:2021-02-14-fc316c3 manylinux2014 = quay.io/pypa/manylinux2014_i686:2021-02-14-fc316c3
manylinux_2_24 = quay.io/pypa/manylinux_2_24_i686:2021-02-14-fc316c3
[pypy_x86_64] [pypy_x86_64]
manylinux2010 = pypywheels/manylinux2010-pypy_x86_64:2020-12-11-f1e0e80 manylinux2010 = pypywheels/manylinux2010-pypy_x86_64:2020-12-11-f1e0e80
[aarch64] [aarch64]
manylinux2014 = quay.io/pypa/manylinux2014_aarch64:2021-02-14-fc316c3 manylinux2014 = quay.io/pypa/manylinux2014_aarch64:2021-02-14-fc316c3
manylinux_2_24 = quay.io/pypa/manylinux_2_24_aarch64:2021-02-14-fc316c3
[ppc64le] [ppc64le]
manylinux2014 = quay.io/pypa/manylinux2014_ppc64le:2021-02-14-fc316c3 manylinux2014 = quay.io/pypa/manylinux2014_ppc64le:2021-02-14-fc316c3
manylinux_2_24 = quay.io/pypa/manylinux_2_24_ppc64le:2021-02-14-fc316c3
[s390x] [s390x]
manylinux2014 = quay.io/pypa/manylinux2014_s390x:2021-02-14-fc316c3 manylinux2014 = quay.io/pypa/manylinux2014_s390x:2021-02-14-fc316c3
manylinux_2_24 = quay.io/pypa/manylinux_2_24_s390x:2021-02-14-fc316c3
+4 -4
View File
@@ -448,14 +448,14 @@ CIBW_REPAIR_WHEEL_COMMAND_LINUX: "auditwheel repair --lib-sdir . -w {dest_dir} {
An alternative Docker image to be used for building [`manylinux`](https://github.com/pypa/manylinux) wheels. `cibuildwheel` will then pull these instead of the default images, [`quay.io/pypa/manylinux2010_x86_64`](https://quay.io/pypa/manylinux2010_x86_64), [`quay.io/pypa/manylinux2010_i686`](https://quay.io/pypa/manylinux2010_i686), [`pypywheels/manylinux2010-pypy_x86_64`](https://hub.docker.com/r/pypywheels/manylinux2010-pypy_x86_64), [`quay.io/pypa/manylinux2014_aarch64`](https://quay.io/pypa/manylinux2014_aarch64), [`quay.io/pypa/manylinux2014_ppc64le`](https://quay.io/pypa/manylinux2014_ppc64le), and [`quay.io/pypa/manylinux2014_s390x`](https://quay.io/pypa/manylinux2010_s390x). An alternative Docker image to be used for building [`manylinux`](https://github.com/pypa/manylinux) wheels. `cibuildwheel` will then pull these instead of the default images, [`quay.io/pypa/manylinux2010_x86_64`](https://quay.io/pypa/manylinux2010_x86_64), [`quay.io/pypa/manylinux2010_i686`](https://quay.io/pypa/manylinux2010_i686), [`pypywheels/manylinux2010-pypy_x86_64`](https://hub.docker.com/r/pypywheels/manylinux2010-pypy_x86_64), [`quay.io/pypa/manylinux2014_aarch64`](https://quay.io/pypa/manylinux2014_aarch64), [`quay.io/pypa/manylinux2014_ppc64le`](https://quay.io/pypa/manylinux2014_ppc64le), and [`quay.io/pypa/manylinux2014_s390x`](https://quay.io/pypa/manylinux2010_s390x).
The value of this option can either be set to `manylinux1`, `manylinux2010` or `manylinux2014` to use a pinned version of the [official `manylinux` images](https://github.com/pypa/manylinux) and [PyPy `manylinux` images](https://github.com/pypy/manylinux). Alternatively, set these options to any other valid Docker image name. Note that for PyPy, only the official `manylinux2010` image is currently available. For architectures other The value of this option can either be set to `manylinux1`, `manylinux2010`, `manylinux2014` or `manylinux_2_24` to use a pinned version of the [official `manylinux` images](https://github.com/pypa/manylinux) and [PyPy `manylinux` images](https://github.com/pypy/manylinux). Alternatively, set these options to any other valid Docker image name. Note that for PyPy, only the official `manylinux2010` image is currently available. For architectures other
than x86 (x86\_64 and i686) manylinux2014 must be used because this is the first version of the manylinux specification that supports additional architectures. than x86 (x86\_64 and i686) `manylinux2014` or `manylinux_2_24` must be used because the first version of the manylinux specification that supports additional architectures is `manylinux2014`.
Beware to specify a valid Docker image that can be used in the same way as the official, default Docker images: all necessary Python and pip versions need to be present in `/opt/python/`, and the `auditwheel` tool needs to be present for `cibuildwheel` to work. Apart from that, the architecture and relevant shared system libraries need to be manylinux1-, manylinux2010- or manylinux2014-compatible in order to produce valid `manylinux1`/`manylinux2010`/`manylinux2014` wheels (see [pypa/manylinux on GitHub](https://github.com/pypa/manylinux), [PEP 513](https://www.python.org/dev/peps/pep-0513/), [PEP 571](https://www.python.org/dev/peps/pep-0571/) and [PEP 599](https://www.python.org/dev/peps/pep-0599/) for more details). Beware to specify a valid Docker image that can be used in the same way as the official, default Docker images: all necessary Python and pip versions need to be present in `/opt/python/`, and the `auditwheel` tool needs to be present for `cibuildwheel` to work. Apart from that, the architecture and relevant shared system libraries need to be manylinux1-, manylinux2010- or manylinux2014-compatible in order to produce valid `manylinux1`/`manylinux2010`/`manylinux2014`/`manylinux_2_24` wheels (see [pypa/manylinux on GitHub](https://github.com/pypa/manylinux), [PEP 513](https://www.python.org/dev/peps/pep-0513/), [PEP 571](https://www.python.org/dev/peps/pep-0571/), [PEP 599](https://www.python.org/dev/peps/pep-0599/) and [PEP 600](https://www.python.org/dev/peps/pep-0600/) for more details).
Note that `auditwheel` detects the version of the `manylinux` standard in the Docker image through the `AUDITWHEEL_PLAT` environment variable, as `cibuildwheel` has no way of detecting the correct `--plat` command line argument to pass to `auditwheel` for a custom image. If a Docker image does not correctly set this `AUDITWHEEL_PLAT` environment variable, the `CIBW_ENVIRONMENT` option can be used to do so (e.g., `CIBW_ENVIRONMENT='AUDITWHEEL_PLAT="manylinux2010_$(uname -m)"'`). Note that `auditwheel` detects the version of the `manylinux` standard in the Docker image through the `AUDITWHEEL_PLAT` environment variable, as `cibuildwheel` has no way of detecting the correct `--plat` command line argument to pass to `auditwheel` for a custom image. If a Docker image does not correctly set this `AUDITWHEEL_PLAT` environment variable, the `CIBW_ENVIRONMENT` option can be used to do so (e.g., `CIBW_ENVIRONMENT='AUDITWHEEL_PLAT="manylinux2010_$(uname -m)"'`).
Note that `manylinux2014` doesn't support builds with Python 2.7 - when building with `manylinux2014`, skip Python 2.7 using `CIBW_SKIP` (see example below). Note that `manylinux2014`/`manylinux_2_24` don't support builds with Python 2.7 - when building with `manylinux2014`/`manylinux_2_24`, skip Python 2.7 using `CIBW_SKIP` (see example below).
#### Examples #### Examples
+1 -1
View File
@@ -7,7 +7,7 @@ from . import test_projects, utils
project_with_before_build_asserts = test_projects.new_c_project( project_with_before_build_asserts = test_projects.new_c_project(
setup_py_add=textwrap.dedent(r''' setup_py_add=textwrap.dedent(r'''
import sys, os import os
# assert that the Python version as written to pythonversion.txt in the CIBW_BEFORE_BUILD step # assert that the Python version as written to pythonversion.txt in the CIBW_BEFORE_BUILD step
# is the same one as is currently running. # is the same one as is currently running.
+1 -1
View File
@@ -7,7 +7,7 @@ from . import test_projects, utils
dockcross_only_project = test_projects.new_c_project( dockcross_only_project = test_projects.new_c_project(
setup_py_add=textwrap.dedent(r''' setup_py_add=textwrap.dedent(r'''
import os, sys import os
# check that we're running in the correct docker image as specified in the # check that we're running in the correct docker image as specified in the
# environment options CIBW_MANYLINUX1_*_IMAGE # environment options CIBW_MANYLINUX1_*_IMAGE
+17 -12
View File
@@ -9,6 +9,9 @@ from . import test_projects, utils
project_with_manylinux_symbols = test_projects.new_c_project( project_with_manylinux_symbols = test_projects.new_c_project(
spam_c_top_level_add=textwrap.dedent(r''' spam_c_top_level_add=textwrap.dedent(r'''
#include <malloc.h> #include <malloc.h>
#include <stdlib.h>
#include <stdint.h>
#include <math.h>
#if !defined(__GLIBC_PREREQ) #if !defined(__GLIBC_PREREQ)
#error "Must run on a glibc linux environment" #error "Must run on a glibc linux environment"
@@ -19,19 +22,21 @@ project_with_manylinux_symbols = test_projects.new_c_project(
#endif #endif
'''), '''),
spam_c_function_add=textwrap.dedent(r''' spam_c_function_add=textwrap.dedent(r'''
#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 17) /* manylinux2014 is glibc 2.17 */ #if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 24)
// secure_getenv is only available in manylinux2014, ensuring // nextupf is only available in manylinux_2_24+
// that only a manylinux2014 wheel is produced sts = (int)nextupf(0.0F);
secure_getenv("NON_EXISTING_ENV_VARIABLE"); #elif defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 17) /* manylinux2014 is glibc 2.17 */
// secure_getenv is only available in manylinux2014+
sts = (int)(intptr_t)secure_getenv("NON_EXISTING_ENV_VARIABLE");
#elif defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10) /* manylinux2010 is glibc 2.12 */ #elif defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10) /* manylinux2010 is glibc 2.12 */
// malloc_info is only available on manylinux2010+ // malloc_info is only available on manylinux2010+
malloc_info(0, stdout); sts = malloc_info(0, stdout);
#endif #endif
'''), '''),
) )
@pytest.mark.parametrize('manylinux_image', ['manylinux1', 'manylinux2010', 'manylinux2014']) @pytest.mark.parametrize('manylinux_image', ['manylinux1', 'manylinux2010', 'manylinux2014', 'manylinux_2_24'])
def test(manylinux_image, tmp_path): def test(manylinux_image, tmp_path):
if utils.platform != 'linux': if utils.platform != 'linux':
pytest.skip('the docker test is only relevant to the linux build') pytest.skip('the docker test is only relevant to the linux build')
@@ -46,7 +51,7 @@ def test(manylinux_image, tmp_path):
# CFLAGS environment variable is necessary to fail on 'malloc_info' (on manylinux1) during compilation/linking, # CFLAGS environment variable is necessary to fail on 'malloc_info' (on manylinux1) during compilation/linking,
# rather than when dynamically loading the Python # rather than when dynamically loading the Python
add_env = { add_env = {
'CIBW_ENVIRONMENT': 'CFLAGS="$CFLAGS -Werror=implicit-function-declaration"', 'CIBW_ENVIRONMENT': 'CFLAGS="$CFLAGS -O0 -Werror=implicit-function-declaration"',
'CIBW_MANYLINUX_X86_64_IMAGE': manylinux_image, 'CIBW_MANYLINUX_X86_64_IMAGE': manylinux_image,
'CIBW_MANYLINUX_I686_IMAGE': manylinux_image, 'CIBW_MANYLINUX_I686_IMAGE': manylinux_image,
'CIBW_MANYLINUX_PYPY_X86_64_IMAGE': manylinux_image, 'CIBW_MANYLINUX_PYPY_X86_64_IMAGE': manylinux_image,
@@ -57,14 +62,14 @@ def test(manylinux_image, tmp_path):
if manylinux_image == 'manylinux1': if manylinux_image == 'manylinux1':
# We don't have a manylinux1 image for PyPy # We don't have a manylinux1 image for PyPy
add_env['CIBW_SKIP'] = 'pp*' add_env['CIBW_SKIP'] = 'pp*'
elif manylinux_image == 'manylinux2014': elif manylinux_image in {'manylinux2014', 'manylinux_2_24'}:
# We don't have a manylinux2014 image for PyPy (yet?) # We don't have a manylinux2014 / 'manylinux_2_24' image for PyPy (yet?)
add_env['CIBW_SKIP'] = 'cp27* pp*' # Python 2.7 not available on manylinux2014 add_env['CIBW_SKIP'] = 'cp27* pp*' # Python 2.7 not available on manylinux2014 / 'manylinux_2_24'
actual_wheels = utils.cibuildwheel_run(project_dir, add_env=add_env) actual_wheels = utils.cibuildwheel_run(project_dir, add_env=add_env)
expected_wheels = [w for w in utils.expected_wheels('spam', '0.1.0', manylinux_versions=[manylinux_image])] expected_wheels = [w for w in utils.expected_wheels('spam', '0.1.0', manylinux_versions=[manylinux_image])]
if manylinux_image == 'manylinux2014': if manylinux_image in {'manylinux2014', 'manylinux_2_24'}:
expected_wheels = [w for w in expected_wheels if '-cp27' not in w] expected_wheels = [w for w in expected_wheels if '-cp27' not in w]
if manylinux_image in ['manylinux1', 'manylinux2014']: if manylinux_image in {'manylinux1', 'manylinux2014', 'manylinux_2_24'}:
expected_wheels = [w for w in expected_wheels if '-pp' not in w] expected_wheels = [w for w in expected_wheels if '-pp' not in w]
assert set(actual_wheels) == set(expected_wheels) assert set(actual_wheels) == set(expected_wheels)
-1
View File
@@ -7,7 +7,6 @@ basic_project = test_projects.new_c_project(
setup_py_add=textwrap.dedent( setup_py_add=textwrap.dedent(
""" """
# Will fail if PEP 518 does work # Will fail if PEP 518 does work
import sys
import requests import requests
if sys.version_info < (3, 6, 0): if sys.version_info < (3, 6, 0):
assert requests.__version__ == "2.22.0", "Requests found but wrong version ({0})".format(requests.__version__) assert requests.__version__ == "2.22.0", "Requests found but wrong version ({0})".format(requests.__version__)
+10 -1
View File
@@ -60,12 +60,21 @@ MOD_INIT(spam)
''' '''
SETUP_PY_TEMPLATE = r''' SETUP_PY_TEMPLATE = r'''
import sys
from setuptools import setup, Extension from setuptools import setup, Extension
{{ setup_py_add }} {{ setup_py_add }}
libraries = []
if sys.platform.startswith('linux'):
libraries.extend(['m', 'c'])
setup( setup(
ext_modules=[Extension('spam', sources=['spam.c'])], ext_modules=[Extension(
'spam',
sources=['spam.c'],
libraries=libraries,
)],
{{ setup_py_setup_args_add | indent(4) }} {{ setup_py_setup_args_add | indent(4) }}
) )
''' '''
-1
View File
@@ -5,7 +5,6 @@ from . import test_projects, utils
project_with_ssl_tests = test_projects.new_c_project( project_with_ssl_tests = test_projects.new_c_project(
setup_py_add=textwrap.dedent(r''' setup_py_add=textwrap.dedent(r'''
import ssl import ssl
import sys
if sys.version_info[0] == 2: if sys.version_info[0] == 2:
from urllib2 import urlopen from urllib2 import urlopen
@@ -71,11 +71,13 @@ def test_empty_selector(platform, intercepted_build_args, monkeypatch):
('x86_64', 'manylinux1', 'quay.io/pypa/manylinux1_x86_64:*'), ('x86_64', 'manylinux1', 'quay.io/pypa/manylinux1_x86_64:*'),
('x86_64', 'manylinux2010', 'quay.io/pypa/manylinux2010_x86_64:*'), ('x86_64', 'manylinux2010', 'quay.io/pypa/manylinux2010_x86_64:*'),
('x86_64', 'manylinux2014', 'quay.io/pypa/manylinux2014_x86_64:*'), ('x86_64', 'manylinux2014', 'quay.io/pypa/manylinux2014_x86_64:*'),
('x86_64', 'manylinux_2_24', 'quay.io/pypa/manylinux_2_24_x86_64:*'),
('x86_64', 'custom_image', 'custom_image'), ('x86_64', 'custom_image', 'custom_image'),
('i686', None, 'quay.io/pypa/manylinux2010_i686:*'), ('i686', None, 'quay.io/pypa/manylinux2010_i686:*'),
('i686', 'manylinux1', 'quay.io/pypa/manylinux1_i686:*'), ('i686', 'manylinux1', 'quay.io/pypa/manylinux1_i686:*'),
('i686', 'manylinux2010', 'quay.io/pypa/manylinux2010_i686:*'), ('i686', 'manylinux2010', 'quay.io/pypa/manylinux2010_i686:*'),
('i686', 'manylinux2014', 'quay.io/pypa/manylinux2014_i686:*'), ('i686', 'manylinux2014', 'quay.io/pypa/manylinux2014_i686:*'),
('i686', 'manylinux_2_24', 'quay.io/pypa/manylinux_2_24_i686:*'),
('i686', 'custom_image', 'custom_image'), ('i686', 'custom_image', 'custom_image'),
('pypy_x86_64', None, 'pypywheels/manylinux2010-pypy_x86_64:*'), ('pypy_x86_64', None, 'pypywheels/manylinux2010-pypy_x86_64:*'),
('pypy_x86_64', 'manylinux1', 'manylinux1'), # Does not exist ('pypy_x86_64', 'manylinux1', 'manylinux1'), # Does not exist