From 74c99e0d934af767533bcd62e2c304680788ac99 Mon Sep 17 00:00:00 2001 From: mayeut Date: Sun, 1 Oct 2023 13:51:21 +0200 Subject: [PATCH] feat: use manylinux-interpreters tool if present This will allow dropping some EOL (and maybe some none EOL) python interpreters in manylinux images which would allow to reduce its size (faster for a vast majority of user, a small slow-down for users of those interpreters). --- cibuildwheel/linux.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cibuildwheel/linux.py b/cibuildwheel/linux.py index 32223d801..7b1a85af7 100644 --- a/cibuildwheel/linux.py +++ b/cibuildwheel/linux.py @@ -117,10 +117,20 @@ def check_all_python_exist( *, platform_configs: Iterable[PythonConfiguration], container: OCIContainer ) -> None: exist = True + has_manylinux_interpreters = True messages = [] + + try: + # use capture_output to keep quiet + container.call(["manylinux-interpreters", "--help"], capture_output=True) + except subprocess.CalledProcessError: + has_manylinux_interpreters = False + for config in platform_configs: python_path = config.path / "bin" / "python" try: + if has_manylinux_interpreters: + container.call(["manylinux-interpreters", "ensure", config.path.name]) container.call(["test", "-x", python_path]) except subprocess.CalledProcessError: messages.append(