Skip to content

Commit 441610e

Browse files
committed
Unpin the types-setuptools build dependency (python#14787)
- The latest release of `types-setuptools` started causing type-check errors (and, therefore, mypyc build errors) on the `master` branch: see, e.g. https://github.com/python/mypy/actions/runs/4275505309/jobs/7442902732. - python#14781 addressed some of the new errors, but didn't quite fix the build. - python#14788 then pinned the `types-setuptools` dependency as a temporary stopgap measure. - This PR now attempts to unpin `types-setuptools` and fix the build errors in a more principled way.
1 parent 3180344 commit 441610e

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

mypyc/build.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151

5252
try:
5353
# Import setuptools so that it monkey-patch overrides distutils
54-
import setuptools # noqa: F401
54+
import setuptools
5555
except ImportError:
5656
if sys.version_info >= (3, 12):
5757
# Raise on Python 3.12, since distutils will go away forever
@@ -63,13 +63,16 @@ def get_extension() -> type[Extension]:
6363
# We can work with either setuptools or distutils, and pick setuptools
6464
# if it has been imported.
6565
use_setuptools = "setuptools" in sys.modules
66+
extension_class: type[Extension]
6667

6768
if not use_setuptools:
68-
from distutils.core import Extension
69+
import distutils.core
70+
71+
extension_class = distutils.core.Extension
6972
else:
70-
from setuptools import Extension
73+
extension_class = setuptools.Extension
7174

72-
return Extension
75+
return extension_class
7376

7477

7578
def setup_mypycify_vars() -> None:

0 commit comments

Comments
 (0)