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")