Skip to content

Commit 0e968cf

Browse files
committed
Remove more lazy imports.
No idea why they were there.
1 parent 33f26a9 commit 0e968cf

File tree

4 files changed

+3
-25
lines changed

4 files changed

+3
-25
lines changed

distutils/command/build.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,12 @@
1010
from collections.abc import Callable
1111
from typing import ClassVar
1212

13+
from ..ccompiler import show_compilers
1314
from ..core import Command
1415
from ..errors import DistutilsOptionError
1516
from ..util import get_platform
1617

1718

18-
def show_compilers():
19-
from ..ccompiler import show_compilers
20-
21-
show_compilers()
22-
23-
2419
class build(Command):
2520
description = "build everything needed to install"
2621

distutils/command/build_clib.py

+1-9
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,12 @@
1919
from distutils._log import log
2020
from typing import ClassVar
2121

22+
from ..ccompiler import new_compiler, show_compilers
2223
from ..core import Command
2324
from ..errors import DistutilsSetupError
2425
from ..sysconfig import customize_compiler
2526

2627

27-
def show_compilers():
28-
from ..ccompiler import show_compilers
29-
30-
show_compilers()
31-
32-
3328
class build_clib(Command):
3429
description = "build C/C++ libraries used by Python extensions"
3530

@@ -93,9 +88,6 @@ def run(self) -> None:
9388
if not self.libraries:
9489
return
9590

96-
# Yech -- this is cut 'n pasted from build_ext.py!
97-
from ..ccompiler import new_compiler
98-
9991
self.compiler = new_compiler(
10092
compiler=self.compiler, dry_run=self.dry_run, force=self.force
10193
)

distutils/command/build_ext.py

+1-8
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from typing import ClassVar
1717

1818
from .._modified import newer_group
19+
from ..ccompiler import new_compiler, show_compilers
1920
from ..core import Command
2021
from ..errors import (
2122
CCompilerError,
@@ -34,12 +35,6 @@
3435
extension_name_re = re.compile(r'^[a-zA-Z_][a-zA-Z_0-9]*(\.[a-zA-Z_][a-zA-Z_0-9]*)*$')
3536

3637

37-
def show_compilers():
38-
from ..ccompiler import show_compilers
39-
40-
show_compilers()
41-
42-
4338
class build_ext(Command):
4439
description = "build C/C++ extensions (compile/link to build directory)"
4540

@@ -303,8 +298,6 @@ def finalize_options(self) -> None: # noqa: C901
303298
raise DistutilsOptionError("parallel should be an integer")
304299

305300
def run(self) -> None: # noqa: C901
306-
from ..ccompiler import new_compiler
307-
308301
# 'self.extensions', as supplied by setup.py, is a list of
309302
# Extension instances. See the documentation for Extension (in
310303
# distutils.extension) for details.

distutils/command/config.py

-2
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,6 @@ def try_run(
258258
built from 'body' and 'headers'. Return true on success, false
259259
otherwise.
260260
"""
261-
from ..ccompiler import CompileError, LinkError
262-
263261
self._check_compiler()
264262
try:
265263
src, obj, exe = self._link(

0 commit comments

Comments
 (0)