Skip to content

Commit

Permalink
feature: add manylinux_2_28 support
Browse files Browse the repository at this point in the history
  • Loading branch information
mayeut committed Jun 16, 2022
1 parent f1c2d6c commit 6458604
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 7 deletions.
6 changes: 6 additions & 0 deletions bin/update_docker.py
Expand Up @@ -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),
Expand Down
5 changes: 5 additions & 0 deletions cibuildwheel/resources/pinned_docker_images.cfg
Expand Up @@ -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]
Expand All @@ -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
Expand All @@ -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]
Expand All @@ -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

6 changes: 3 additions & 3 deletions docs/options.md
Expand Up @@ -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)"'`).

Expand Down
29 changes: 25 additions & 4 deletions test/test_manylinuxXXXX_only.py
Expand Up @@ -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 <threads.h>
#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
Expand All @@ -41,14 +48,19 @@


@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":
pytest.skip("the docker test is only relevant to the linux build")
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)
Expand All @@ -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)

Expand All @@ -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)
2 changes: 2 additions & 0 deletions unit_test/main_tests/main_options_test.py
Expand Up @@ -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:*"),
Expand All @@ -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"),
],
)
Expand Down

0 comments on commit 6458604

Please sign in to comment.