From 8272fe53250ca6c354749b97c13faba20f25caeb Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 26 Oct 2023 11:48:29 -0700 Subject: [PATCH] src/sage/misc/cython.py: Fix the workaround for setuptools_scm in the runtime env --- src/sage/misc/cython.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/sage/misc/cython.py b/src/sage/misc/cython.py index 5631cc092e3..c0c803bf943 100644 --- a/src/sage/misc/cython.py +++ b/src/sage/misc/cython.py @@ -421,7 +421,7 @@ def cython(filename, verbose=0, compile_message=False, os.curdir) # This emulates running "setup.py build" with the correct options - dist = Distribution() + # # setuptools plugins considered harmful: # If build isolation is not in use and setuptools_scm is installed, # then its file_finders entry point is invoked, which we don't need. @@ -429,7 +429,12 @@ def cython(filename, verbose=0, compile_message=False, # LookupError: pyproject.toml does not contain a tool.setuptools_scm section # LookupError: setuptools-scm was unable to detect version ... # We just remove all handling of "setuptools.finalize_distribution_options" entry points. - dist._removed = staticmethod(lambda ep: True) + class Distribution_no_finalize_distribution_options(Distribution): + @staticmethod + def _removed(ep): + return True + + dist = Distribution_no_finalize_distribution_options() dist.ext_modules = [ext] dist.include_dirs = includes buildcmd = dist.get_command_obj("build")