From 09f9da53c9bf668f44e641c29715c7b7272bc91b Mon Sep 17 00:00:00 2001 From: hauntsaninja <> Date: Sun, 10 Oct 2021 00:49:55 -0700 Subject: [PATCH 1/2] mypyc: use setuptools' distutils --- mypyc/build.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mypyc/build.py b/mypyc/build.py index 1834b9db2338..584eefc01ad9 100644 --- a/mypyc/build.py +++ b/mypyc/build.py @@ -45,6 +45,13 @@ if TYPE_CHECKING: from distutils.core import Extension # noqa +try: + # Import setuptools so that it monkey-patch overrides distutils + import setuptools +except ImportError: + if sys.version_info >= (3, 12): + # Raise on Python 3.12, since distutils will go away forever + raise from distutils import sysconfig, ccompiler From 363536323ba4650f4c65777c51aede13853cec3d Mon Sep 17 00:00:00 2001 From: hauntsaninja <> Date: Sun, 10 Oct 2021 00:53:05 -0700 Subject: [PATCH 2/2] silence linters --- mypyc/build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mypyc/build.py b/mypyc/build.py index 584eefc01ad9..71acec06ad18 100644 --- a/mypyc/build.py +++ b/mypyc/build.py @@ -47,7 +47,7 @@ try: # Import setuptools so that it monkey-patch overrides distutils - import setuptools + import setuptools # type: ignore # noqa except ImportError: if sys.version_info >= (3, 12): # Raise on Python 3.12, since distutils will go away forever