From a48480014efe84f957745201a088b3887c446822 Mon Sep 17 00:00:00 2001 From: mayeut Date: Sun, 14 Feb 2021 17:18:31 +0100 Subject: [PATCH] Add manylinux_2_24 support --- bin/update_dependencies.py | 6 ++++ .../resources/pinned_docker_images.cfg | 5 ++++ docs/options.md | 8 ++--- test/test_before_build.py | 2 +- test/test_docker_images.py | 2 +- test/test_manylinuxXXXX_only.py | 29 +++++++++++-------- test/test_pep518.py | 1 - test/test_projects/c.py | 11 ++++++- test/test_ssl.py | 1 - unit_test/main_tests/main_options_test.py | 2 ++ 10 files changed, 46 insertions(+), 21 deletions(-) diff --git a/bin/update_dependencies.py b/bin/update_dependencies.py index 166eebe37..c54fc9822 100755 --- a/bin/update_dependencies.py +++ b/bin/update_dependencies.py @@ -71,6 +71,12 @@ Image('manylinux2014', 'aarch64', 'quay.io/pypa/manylinux2014_aarch64', None), Image('manylinux2014', 'ppc64le', 'quay.io/pypa/manylinux2014_ppc64le', 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() diff --git a/cibuildwheel/resources/pinned_docker_images.cfg b/cibuildwheel/resources/pinned_docker_images.cfg index 7a87bcb05..ba5103f2b 100644 --- a/cibuildwheel/resources/pinned_docker_images.cfg +++ b/cibuildwheel/resources/pinned_docker_images.cfg @@ -2,21 +2,26 @@ manylinux1 = quay.io/pypa/manylinux1_x86_64:2021-02-06-920c3c7 manylinux2010 = quay.io/pypa/manylinux2010_x86_64:2021-02-06-3d322a5 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] manylinux1 = quay.io/pypa/manylinux1_i686:2021-02-06-920c3c7 manylinux2010 = quay.io/pypa/manylinux2010_i686:2021-02-06-3d322a5 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] manylinux2010 = pypywheels/manylinux2010-pypy_x86_64:2020-12-11-f1e0e80 [aarch64] 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] 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] manylinux2014 = quay.io/pypa/manylinux2014_s390x:2021-02-14-fc316c3 +manylinux_2_24 = quay.io/pypa/manylinux_2_24_s390x:2021-02-14-fc316c3 diff --git a/docs/options.md b/docs/options.md index b00d12547..425fe0e7b 100644 --- a/docs/options.md +++ b/docs/options.md @@ -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). -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 -than x86 (x86\_64 and i686) manylinux2014 must be used because this is the first version of the manylinux specification that supports additional architectures. +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` 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 `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 diff --git a/test/test_before_build.py b/test/test_before_build.py index 1feb6fd9e..6939bebe3 100644 --- a/test/test_before_build.py +++ b/test/test_before_build.py @@ -7,7 +7,7 @@ project_with_before_build_asserts = test_projects.new_c_project( 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 # is the same one as is currently running. diff --git a/test/test_docker_images.py b/test/test_docker_images.py index 59feaf1dc..7328d3a23 100644 --- a/test/test_docker_images.py +++ b/test/test_docker_images.py @@ -7,7 +7,7 @@ dockcross_only_project = test_projects.new_c_project( 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 # environment options CIBW_MANYLINUX1_*_IMAGE diff --git a/test/test_manylinuxXXXX_only.py b/test/test_manylinuxXXXX_only.py index ff422cf91..ba143b3e8 100644 --- a/test/test_manylinuxXXXX_only.py +++ b/test/test_manylinuxXXXX_only.py @@ -9,6 +9,9 @@ project_with_manylinux_symbols = test_projects.new_c_project( spam_c_top_level_add=textwrap.dedent(r''' #include + #include + #include + #include #if !defined(__GLIBC_PREREQ) #error "Must run on a glibc linux environment" @@ -19,19 +22,21 @@ #endif '''), spam_c_function_add=textwrap.dedent(r''' - #if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 17) /* manylinux2014 is glibc 2.17 */ - // secure_getenv is only available in manylinux2014, ensuring - // that only a manylinux2014 wheel is produced - secure_getenv("NON_EXISTING_ENV_VARIABLE"); + #if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 24) + // nextupf is only available in manylinux_2_24+ + sts = (int)nextupf(0.0F); + #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 */ // malloc_info is only available on manylinux2010+ - malloc_info(0, stdout); + sts = malloc_info(0, stdout); #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): if utils.platform != 'linux': 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, # rather than when dynamically loading the Python 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_I686_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': # We don't have a manylinux1 image for PyPy add_env['CIBW_SKIP'] = 'pp*' - elif manylinux_image == 'manylinux2014': - # We don't have a manylinux2014 image for PyPy (yet?) - add_env['CIBW_SKIP'] = 'cp27* pp*' # Python 2.7 not available on manylinux2014 + elif manylinux_image in {'manylinux2014', 'manylinux_2_24'}: + # 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 / 'manylinux_2_24' 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])] - 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] - 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] assert set(actual_wheels) == set(expected_wheels) diff --git a/test/test_pep518.py b/test/test_pep518.py index 2d71896d1..a15181ba2 100644 --- a/test/test_pep518.py +++ b/test/test_pep518.py @@ -7,7 +7,6 @@ setup_py_add=textwrap.dedent( """ # Will fail if PEP 518 does work - import sys import requests if sys.version_info < (3, 6, 0): assert requests.__version__ == "2.22.0", "Requests found but wrong version ({0})".format(requests.__version__) diff --git a/test/test_projects/c.py b/test/test_projects/c.py index 55c699d69..85b4ddd50 100644 --- a/test/test_projects/c.py +++ b/test/test_projects/c.py @@ -60,12 +60,21 @@ ''' SETUP_PY_TEMPLATE = r''' +import sys from setuptools import setup, Extension {{ setup_py_add }} +libraries = [] +if sys.platform.startswith('linux'): + libraries.extend(['m', 'c']) + setup( - ext_modules=[Extension('spam', sources=['spam.c'])], + ext_modules=[Extension( + 'spam', + sources=['spam.c'], + libraries=libraries, + )], {{ setup_py_setup_args_add | indent(4) }} ) ''' diff --git a/test/test_ssl.py b/test/test_ssl.py index 9b195f084..00900669c 100644 --- a/test/test_ssl.py +++ b/test/test_ssl.py @@ -5,7 +5,6 @@ project_with_ssl_tests = test_projects.new_c_project( setup_py_add=textwrap.dedent(r''' import ssl - import sys if sys.version_info[0] == 2: from urllib2 import urlopen diff --git a/unit_test/main_tests/main_options_test.py b/unit_test/main_tests/main_options_test.py index 9342dca82..245594898 100644 --- a/unit_test/main_tests/main_options_test.py +++ b/unit_test/main_tests/main_options_test.py @@ -71,11 +71,13 @@ def test_empty_selector(platform, intercepted_build_args, monkeypatch): ('x86_64', 'manylinux1', 'quay.io/pypa/manylinux1_x86_64:*'), ('x86_64', 'manylinux2010', 'quay.io/pypa/manylinux2010_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'), ('i686', None, 'quay.io/pypa/manylinux2010_i686:*'), ('i686', 'manylinux1', 'quay.io/pypa/manylinux1_i686:*'), ('i686', 'manylinux2010', 'quay.io/pypa/manylinux2010_i686:*'), ('i686', 'manylinux2014', 'quay.io/pypa/manylinux2014_i686:*'), + ('i686', 'manylinux_2_24', 'quay.io/pypa/manylinux_2_24_i686:*'), ('i686', 'custom_image', 'custom_image'), ('pypy_x86_64', None, 'pypywheels/manylinux2010-pypy_x86_64:*'), ('pypy_x86_64', 'manylinux1', 'manylinux1'), # Does not exist