From 6458604c994f5dd2cb3f9a16565001414e504152 Mon Sep 17 00:00:00 2001 From: mayeut Date: Sun, 13 Feb 2022 16:57:35 +0100 Subject: [PATCH] feature: add manylinux_2_28 support --- bin/update_docker.py | 6 ++++ .../resources/pinned_docker_images.cfg | 5 ++++ docs/options.md | 6 ++-- test/test_manylinuxXXXX_only.py | 29 ++++++++++++++++--- unit_test/main_tests/main_options_test.py | 2 ++ 5 files changed, 41 insertions(+), 7 deletions(-) diff --git a/bin/update_docker.py b/bin/update_docker.py index 73da5a1ba..32d98e750 100755 --- a/bin/update_docker.py +++ b/bin/update_docker.py @@ -45,6 +45,12 @@ class Image(NamedTuple): Image("manylinux_2_24", "pypy_x86_64", "quay.io/pypa/manylinux_2_24_x86_64", None), Image("manylinux_2_24", "pypy_i686", "quay.io/pypa/manylinux_2_24_i686", None), Image("manylinux_2_24", "pypy_aarch64", "quay.io/pypa/manylinux_2_24_aarch64", None), + # manylinux_2_28 images + Image("manylinux_2_28", "x86_64", "quay.io/pypa/manylinux_2_28_x86_64", None), + Image("manylinux_2_28", "aarch64", "quay.io/pypa/manylinux_2_28_aarch64", None), + Image("manylinux_2_28", "ppc64le", "quay.io/pypa/manylinux_2_28_ppc64le", None), + Image("manylinux_2_28", "pypy_x86_64", "quay.io/pypa/manylinux_2_28_x86_64", None), + Image("manylinux_2_28", "pypy_aarch64", "quay.io/pypa/manylinux_2_28_aarch64", None), # musllinux_1_1 images Image("musllinux_1_1", "x86_64", "quay.io/pypa/musllinux_1_1_x86_64", None), Image("musllinux_1_1", "i686", "quay.io/pypa/musllinux_1_1_i686", None), diff --git a/cibuildwheel/resources/pinned_docker_images.cfg b/cibuildwheel/resources/pinned_docker_images.cfg index c4f81a5d2..0a7c65925 100644 --- a/cibuildwheel/resources/pinned_docker_images.cfg +++ b/cibuildwheel/resources/pinned_docker_images.cfg @@ -3,6 +3,7 @@ manylinux1 = quay.io/pypa/manylinux1_x86_64:2022-06-12-a846b05 manylinux2010 = quay.io/pypa/manylinux2010_x86_64:2022-06-13-c365205 manylinux2014 = quay.io/pypa/manylinux2014_x86_64:2022-06-13-c365205 manylinux_2_24 = quay.io/pypa/manylinux_2_24_x86_64:2022-06-13-c365205 +manylinux_2_28 = quay.io/pypa/manylinux_2_28_x86_64:2022-06-13-c365205 musllinux_1_1 = quay.io/pypa/musllinux_1_1_x86_64:2022-06-13-c365205 [i686] @@ -16,6 +17,7 @@ musllinux_1_1 = quay.io/pypa/musllinux_1_1_i686:2022-06-13-c365205 manylinux2010 = quay.io/pypa/manylinux2010_x86_64:2022-06-13-c365205 manylinux2014 = quay.io/pypa/manylinux2014_x86_64:2022-06-13-c365205 manylinux_2_24 = quay.io/pypa/manylinux_2_24_x86_64:2022-06-13-c365205 +manylinux_2_28 = quay.io/pypa/manylinux_2_28_x86_64:2022-06-13-c365205 [pypy_i686] manylinux2010 = quay.io/pypa/manylinux2010_i686:2022-06-13-c365205 @@ -25,11 +27,13 @@ manylinux_2_24 = quay.io/pypa/manylinux_2_24_i686:2022-06-13-c365205 [aarch64] manylinux2014 = quay.io/pypa/manylinux2014_aarch64:2022-06-13-c365205 manylinux_2_24 = quay.io/pypa/manylinux_2_24_aarch64:2022-06-13-c365205 +manylinux_2_28 = quay.io/pypa/manylinux_2_28_aarch64:2022-06-13-c365205 musllinux_1_1 = quay.io/pypa/musllinux_1_1_aarch64:2022-06-13-c365205 [ppc64le] manylinux2014 = quay.io/pypa/manylinux2014_ppc64le:2022-06-13-c365205 manylinux_2_24 = quay.io/pypa/manylinux_2_24_ppc64le:2022-06-13-c365205 +manylinux_2_28 = quay.io/pypa/manylinux_2_28_ppc64le:2022-06-13-c365205 musllinux_1_1 = quay.io/pypa/musllinux_1_1_ppc64le:2022-06-13-c365205 [s390x] @@ -40,4 +44,5 @@ musllinux_1_1 = quay.io/pypa/musllinux_1_1_s390x:2022-06-13-c365205 [pypy_aarch64] manylinux2014 = quay.io/pypa/manylinux2014_aarch64:2022-06-13-c365205 manylinux_2_24 = quay.io/pypa/manylinux_2_24_aarch64:2022-06-13-c365205 +manylinux_2_28 = quay.io/pypa/manylinux_2_28_aarch64:2022-06-13-c365205 diff --git a/docs/options.md b/docs/options.md index eee6cd1ce..f72b388a3 100644 --- a/docs/options.md +++ b/docs/options.md @@ -886,14 +886,14 @@ The available options are (default value): Set an alternative Docker image to be used for building [manylinux / musllinux](https://github.com/pypa/manylinux) wheels. -For `CIBW_MANYLINUX_*_IMAGE`, 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). Alternatively, set these options to any other valid Docker image name. For PyPy, the `manylinux1` image is not 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`. +For `CIBW_MANYLINUX_*_IMAGE`, the value of this option can either be set to `manylinux1`, `manylinux2010`, `manylinux2014`, `manylinux_2_24` or `manylinux_2_28` to use a pinned version of the [official manylinux images](https://github.com/pypa/manylinux). Alternatively, set these options to any other valid Docker image name. For PyPy, the `manylinux1` image is not available. For architectures other +than x86 (x86\_64 and i686) `manylinux2014`, `manylinux_2_24` or `manylinux_2_28` must be used, because the first version of the manylinux specification that supports additional architectures is `manylinux2014`. `manylinux_2_28` is not supported for `i686` & `s390x` architectures. For `CIBW_MUSLLINUX_*_IMAGE`, the value of this option can either be set to `musllinux_1_1` to use a pinned version of the [official musllinux images](https://github.com/pypa/musllinux). Alternatively, set these options to any other valid Docker image name. If this option is blank, it will fall though to the next available definition (environment variable -> pyproject.toml -> default). -If setting a custom Docker image, you'll need to make sure it 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 compatible to the relevant standard to produce valid manylinux1/manylinux2010/manylinux2014/manylinux_2_24/musllinux_1_1 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/), [PEP 600](https://www.python.org/dev/peps/pep-0600/) and [PEP 656](https://www.python.org/dev/peps/pep-0656/) for more details). +If setting a custom Docker image, you'll need to make sure it 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 compatible to the relevant standard to produce valid manylinux1/manylinux2010/manylinux2014/manylinux_2_24/manylinux_2_28/musllinux_1_1 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/), [PEP 600](https://www.python.org/dev/peps/pep-0600/) and [PEP 656](https://www.python.org/dev/peps/pep-0656/) for more details). Auditwheel detects the version of the manylinux / musllinux 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)"'`). diff --git a/test/test_manylinuxXXXX_only.py b/test/test_manylinuxXXXX_only.py index 1c75f9b1c..2a80cbb34 100644 --- a/test/test_manylinuxXXXX_only.py +++ b/test/test_manylinuxXXXX_only.py @@ -21,17 +21,24 @@ #if !__GLIBC_PREREQ(2, 5) /* manylinux1 is glibc 2.5 */ #error "Must run on a glibc >= 2.5 linux environment" #endif + + #if __GLIBC_PREREQ(2, 28) + #include + #endif """ ), spam_c_function_add=textwrap.dedent( r""" - #if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 24) + #if __GLIBC_PREREQ(2, 28) + // thrd_equal & thrd_current are only available in manylinux_2_28+ + sts = thrd_equal(thrd_current(), thrd_current()) ? 0 : 1;; + #elif __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 */ + #elif __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 __GLIBC_PREREQ(2, 10) /* manylinux2010 is glibc 2.12 */ // malloc_info is only available on manylinux2010+ sts = malloc_info(0, stdout); #endif @@ -41,7 +48,8 @@ @pytest.mark.parametrize( - "manylinux_image", ["manylinux1", "manylinux2010", "manylinux2014", "manylinux_2_24"] + "manylinux_image", + ["manylinux1", "manylinux2010", "manylinux2014", "manylinux_2_24", "manylinux_2_28"], ) def test(manylinux_image, tmp_path): if utils.platform != "linux": @@ -49,6 +57,10 @@ def test(manylinux_image, tmp_path): elif platform.machine() not in ["x86_64", "i686"]: if manylinux_image in ["manylinux1", "manylinux2010"]: pytest.skip("manylinux1 and 2010 doesn't exist for non-x86 architectures") + elif manylinux_image == "manylinux_2_28" and platform.machine() == "s390x": + pytest.skip("manylinux_2_28 doesn't exist for s390x architecture") + elif manylinux_image == "manylinux_2_28" and platform.machine() == "i686": + pytest.skip("manylinux_2_28 doesn't exist for i686 architecture") project_dir = tmp_path / "project" project_with_manylinux_symbols.generate(project_dir) @@ -74,6 +86,9 @@ def test(manylinux_image, tmp_path): if manylinux_image in {"manylinux2010"}: # We don't have a manylinux2010 image for PyPy 3.9, CPython 3.11 add_env["CIBW_SKIP"] = "pp39* cp311*" + if manylinux_image == "manylinux_2_28" and platform.machine() == "x86_64": + # We don't have a manylinux_2_28 image for i686 + add_env["CIBW_ARCHS"] = "x86_64" actual_wheels = utils.cibuildwheel_run(project_dir, add_env=add_env) @@ -91,7 +106,13 @@ def test(manylinux_image, tmp_path): if manylinux_image in {"manylinux1"}: # remove PyPy & CPython 3.10 and above expected_wheels = [w for w in expected_wheels if "-pp" not in w and "-cp31" not in w] + if manylinux_image in {"manylinux2010"}: # remove PyPy 3.9 & CPython 3.11 expected_wheels = [w for w in expected_wheels if "-pp39" not in w and "-cp311" not in w] + + if manylinux_image == "manylinux_2_28" and platform.machine() == "x86_64": + # We don't have a manylinux_2_28 image for i686 + expected_wheels = [w for w in expected_wheels if "i686" not in w] + assert set(actual_wheels) == set(expected_wheels) diff --git a/unit_test/main_tests/main_options_test.py b/unit_test/main_tests/main_options_test.py index 977fc378b..27a97a2e8 100644 --- a/unit_test/main_tests/main_options_test.py +++ b/unit_test/main_tests/main_options_test.py @@ -80,6 +80,7 @@ def test_empty_selector(platform, intercepted_build_args, monkeypatch): ("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", "manylinux_2_28", "quay.io/pypa/manylinux_2_28_x86_64:*"), ("x86_64", "custom_image", "custom_image"), ("i686", None, "quay.io/pypa/manylinux2014_i686:*"), ("i686", "manylinux1", "quay.io/pypa/manylinux1_i686:*"), @@ -92,6 +93,7 @@ def test_empty_selector(platform, intercepted_build_args, monkeypatch): ("pypy_x86_64", "manylinux2010", "quay.io/pypa/manylinux2010_x86_64:*"), ("pypy_x86_64", "manylinux2014", "quay.io/pypa/manylinux2014_x86_64:*"), ("pypy_x86_64", "manylinux_2_24", "quay.io/pypa/manylinux_2_24_x86_64:*"), + ("pypy_x86_64", "manylinux_2_28", "quay.io/pypa/manylinux_2_28_x86_64:*"), ("pypy_x86_64", "custom_image", "custom_image"), ], )