Skip to content

Commit fd57c55

Browse files
authored
Merge branch 'main' into re-enable-mypy
2 parents 80a9eec + 8b94447 commit fd57c55

File tree

8 files changed

+17
-23
lines changed

8 files changed

+17
-23
lines changed

distutils/ccompiler.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
from .compat.numpy import ( # noqa: F401
2+
_default_compilers,
3+
compiler_class,
4+
)
15
from .compilers.C import base
26
from .compilers.C.base import (
3-
compiler_class,
47
gen_lib_options,
58
gen_preprocess_options,
69
get_default_compiler,
@@ -12,7 +15,6 @@
1215
__all__ = [
1316
'CompileError',
1417
'LinkError',
15-
'compiler_class',
1618
'gen_lib_options',
1719
'gen_preprocess_options',
1820
'get_default_compiler',

distutils/command/install.py

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
from __future__ import annotations
66

7+
import collections
78
import contextlib
89
import itertools
910
import os
@@ -13,8 +14,6 @@
1314
from site import USER_BASE, USER_SITE
1415
from typing import ClassVar
1516

16-
import jaraco.collections
17-
1817
from ..core import Command
1918
from ..debug import DEBUG
2019
from ..errors import DistutilsOptionError, DistutilsPlatformError
@@ -145,7 +144,7 @@ def _resolve_scheme(name):
145144
try:
146145
resolved = sysconfig.get_preferred_scheme(key)
147146
except Exception:
148-
resolved = fw.scheme(_pypy_hack(name))
147+
resolved = fw.scheme(name)
149148
return resolved
150149

151150

@@ -162,7 +161,7 @@ def _inject_headers(name, scheme):
162161
"""
163162
# Bypass the preferred scheme, which may not
164163
# have defined headers.
165-
fallback = _load_scheme(_pypy_hack(name))
164+
fallback = _load_scheme(name)
166165
scheme.setdefault('headers', fallback['headers'])
167166
return scheme
168167

@@ -172,14 +171,6 @@ def _scheme_attrs(scheme):
172171
return {f'install_{key}': scheme[key] for key in SCHEME_KEYS}
173172

174173

175-
def _pypy_hack(name):
176-
PY37 = sys.version_info < (3, 8)
177-
old_pypy = hasattr(sys, 'pypy_version_info') and PY37
178-
prefix = not name.endswith(('_user', '_home'))
179-
pypy_name = 'pypy' + '_nt' * (os.name == 'nt')
180-
return pypy_name if old_pypy and prefix else name
181-
182-
183174
class install(Command):
184175
description = "install everything from build directory"
185176

@@ -432,12 +423,12 @@ def finalize_options(self) -> None: # noqa: C901
432423
local_vars['userbase'] = self.install_userbase
433424
local_vars['usersite'] = self.install_usersite
434425

435-
self.config_vars = jaraco.collections.DictStack([
436-
fw.vars(),
437-
compat_vars,
438-
sysconfig.get_config_vars(),
426+
self.config_vars = collections.ChainMap(
439427
local_vars,
440-
])
428+
sysconfig.get_config_vars(),
429+
compat_vars,
430+
fw.vars(),
431+
)
441432

442433
self.expand_basedirs()
443434

distutils/compat/numpy.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# required for older numpy versions on Pythons prior to 3.12; see pypa/setuptools#4876
2+
from ..compilers.C.base import _default_compilers, compiler_class # noqa: F401

distutils/compilers/C/unix.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ def _is_gcc(self):
323323
compiler = os.path.basename(shlex.split(cc_var)[0])
324324
return "gcc" in compiler or "g++" in compiler
325325

326-
def runtime_library_dir_option(self, dir: str) -> str | list[str]:
326+
def runtime_library_dir_option(self, dir: str) -> str | list[str]: # type: ignore[override] # Fixed in pypa/distutils#339
327327
# XXX Hackish, at the very least. See Python bug #445902:
328328
# https://bugs.python.org/issue445902
329329
# Linkers on different platforms need different options to

distutils/sysconfig.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,6 @@ def _extant(path):
156156

157157

158158
def _get_python_inc_posix(prefix, spec_prefix, plat_specific):
159-
if IS_PYPY and sys.version_info < (3, 8):
160-
return os.path.join(prefix, 'include')
161159
return (
162160
_get_python_inc_posix_python(plat_specific)
163161
or _extant(_get_python_inc_from_config(plat_specific, spec_prefix))

mypy.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ explicit_package_bases = True
1313
disable_error_code =
1414
# Disable due to many false positives
1515
overload-overlap,
16+
1617
# local
1718

1819
# TODO: Resolve and re-enable these gradually

newsfragments/4876.bugfix.2.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Restore `distutils.ccompiler._default_compilers` -- by :user:`ManiacDC`

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ dependencies = [
2222
"packaging",
2323
"jaraco.functools >= 4",
2424
"more_itertools",
25-
"jaraco.collections",
2625
]
2726
dynamic = ["version"]
2827

0 commit comments

Comments
 (0)