MCPcopy Create free account
hub / github.com/numpy/numpy / _check_compiler

Method _check_compiler

numpy/distutils/command/config.py:40–86  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

38 old_config.initialize_options(self)
39
40 def _check_compiler (self):
41 old_config._check_compiler(self)
42 from numpy.distutils.fcompiler import FCompiler, new_fcompiler
43
44 if sys.platform == 'win32' and (self.compiler.compiler_type in
45 ('msvc', 'intelw', 'intelemw')):
46 # XXX: hack to circumvent a python 2.6 bug with msvc9compiler:
47 # initialize call query_vcvarsall, which throws an IOError, and
48 # causes an error along the way without much information. We try to
49 # catch it here, hoping it is early enough, and print a helpful
50 # message instead of Error: None.
51 if not self.compiler.initialized:
52 try:
53 self.compiler.initialize()
54 except IOError as e:
55 msg = textwrap.dedent("""\
56 Could not initialize compiler instance: do you have Visual Studio
57 installed? If you are trying to build with MinGW, please use "python setup.py
58 build -c mingw32" instead. If you have Visual Studio installed, check it is
59 correctly installed, and the right version (VS 2015 as of this writing).
60
61 Original exception was: %s, and the Compiler class was %s
62 ============================================================================""") \
63 % (e, self.compiler.__class__.__name__)
64 print(textwrap.dedent("""\
65 ============================================================================"""))
66 raise distutils.errors.DistutilsPlatformError(msg) from e
67
68 # After MSVC is initialized, add an explicit /MANIFEST to linker
69 # flags. See issues gh-4245 and gh-4101 for details. Also
70 # relevant are issues 4431 and 16296 on the Python bug tracker.
71 from distutils import msvc9compiler
72 if msvc9compiler.get_build_version() >= 10:
73 for ldflags in [self.compiler.ldflags_shared,
74 self.compiler.ldflags_shared_debug]:
75 if '/MANIFEST' not in ldflags:
76 ldflags.append('/MANIFEST')
77
78 if not isinstance(self.fcompiler, FCompiler):
79 self.fcompiler = new_fcompiler(compiler=self.fcompiler,
80 dry_run=self.dry_run, force=1,
81 c_compiler=self.compiler)
82 if self.fcompiler is not None:
83 self.fcompiler.customize(self.distribution)
84 if self.fcompiler.get_version():
85 self.fcompiler.customize_cmd(self)
86 self.fcompiler.show_customization()
87
88 def _wrap_method(self, mth, lang, args):
89 from distutils.ccompiler import CompileError

Callers 15

check_headerMethod · 0.95
check_declMethod · 0.95
check_macro_trueMethod · 0.95
check_typeMethod · 0.95
check_type_sizeMethod · 0.95
check_funcMethod · 0.95
check_funcs_onceMethod · 0.95
get_outputMethod · 0.95
check_inlineFunction · 0.80
check_restrictFunction · 0.80

Calls 5

new_fcompilerFunction · 0.90
printFunction · 0.85
customizeMethod · 0.80
initializeMethod · 0.45
get_versionMethod · 0.45

Tested by

no test coverage detected