From 41591f2c66b05bcaed7d26d8fd6e38b266be4d0e Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Thu, 14 Nov 2024 19:20:32 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=A6=20Cap=20Cython=20under=20Python=20?= =?UTF-8?q?3.12+=20below=20v3.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The effect of this is that the pre-release versions of Cython are no longer allowed to be automatically installed into the ephemeral build environment, implicitly. Ref https://github.com/aio-libs/yarl/issues/1411 Co-Authored-By: ajsanchezsanz <3304408+ajsanchezsanz@users.noreply.github.com> Co-Authored-By: markgreene74 <18945890+markgreene74@users.noreply.github.com> Co-Authored-By: Sviatoslav Sydorenko --- packaging/pep517_backend/_backend.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/packaging/pep517_backend/_backend.py b/packaging/pep517_backend/_backend.py index f3ea98d3..0fec684f 100644 --- a/packaging/pep517_backend/_backend.py +++ b/packaging/pep517_backend/_backend.py @@ -10,7 +10,6 @@ from shutil import copytree from sys import implementation as _system_implementation from sys import stderr as _standard_error_stream -from sys import version_info as _python_version_tuple from tempfile import TemporaryDirectory from warnings import warn as _warn_that @@ -79,9 +78,6 @@ PURE_PYTHON_ENV_VAR = 'FROZENLIST_NO_EXTENSIONS' """Environment variable name toggle used to opt out of making C-exts.""" -IS_PY3_12_PLUS = _python_version_tuple[:2] >= (3, 12) -"""A flag meaning that the current runtime is Python 3.12 or higher.""" - IS_CPYTHON = _system_implementation.name == "cpython" """A flag meaning that the current interpreter implementation is CPython.""" @@ -343,8 +339,8 @@ def get_requires_for_build_wheel( ) c_ext_build_deps = [] if is_pure_python_build else [ - 'Cython >= 3.0.0b3' if IS_PY3_12_PLUS # Only Cython 3+ is compatible - else 'Cython', + 'Cython ~= 3.0.0; python_version >= "3.12"', + 'Cython; python_version < "3.12"', ] return _setuptools_get_requires_for_build_wheel(