17
17
from collections .abc import Sequence
18
18
from distutils ._log import log
19
19
20
+ from ..ccompiler import CCompiler , CompileError , LinkError , new_compiler
20
21
from ..core import Command
21
22
from ..errors import DistutilsExecError
22
23
from ..sysconfig import customize_compiler
@@ -90,8 +91,6 @@ def _check_compiler(self):
90
91
"""
91
92
# We do this late, and only on-demand, because this is an expensive
92
93
# import.
93
- from ..ccompiler import CCompiler , new_compiler
94
-
95
94
if not isinstance (self .compiler , CCompiler ):
96
95
self .compiler = new_compiler (
97
96
compiler = self .compiler , dry_run = self .dry_run , force = True
@@ -177,8 +176,6 @@ def try_cpp(self, body=None, headers=None, include_dirs=None, lang="c"):
177
176
preprocessor succeeded, false if there were any errors.
178
177
('body' probably isn't of much use, but what the heck.)
179
178
"""
180
- from ..ccompiler import CompileError
181
-
182
179
self ._check_compiler ()
183
180
ok = True
184
181
try :
@@ -213,8 +210,6 @@ def try_compile(self, body, headers=None, include_dirs=None, lang="c"):
213
210
"""Try to compile a source file built from 'body' and 'headers'.
214
211
Return true on success, false otherwise.
215
212
"""
216
- from ..ccompiler import CompileError
217
-
218
213
self ._check_compiler ()
219
214
try :
220
215
self ._compile (body , headers , include_dirs , lang )
@@ -239,8 +234,6 @@ def try_link(
239
234
'headers', to executable form. Return true on success, false
240
235
otherwise.
241
236
"""
242
- from ..ccompiler import CompileError , LinkError
243
-
244
237
self ._check_compiler ()
245
238
try :
246
239
self ._link (body , headers , include_dirs , libraries , library_dirs , lang )
0 commit comments