Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cdc45ed

Browse files
committed
Try to initialize the msvc compiler before the general code to detect the error early.
1 parent 7b811f8 commit cdc45ed

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

numpy/distutils/command/config.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,6 @@ def try_run(self, body, headers=None, include_dirs=None,
4141
def _check_compiler (self):
4242
old_config._check_compiler(self)
4343
from numpy.distutils.fcompiler import FCompiler, new_fcompiler
44-
if not isinstance(self.fcompiler, FCompiler):
45-
self.fcompiler = new_fcompiler(compiler=self.fcompiler,
46-
dry_run=self.dry_run, force=1,
47-
c_compiler=self.compiler)
48-
if self.fcompiler is not None:
49-
self.fcompiler.customize(self.distribution)
50-
if self.fcompiler.get_version():
51-
self.fcompiler.customize_cmd(self)
52-
self.fcompiler.show_customization()
5344

5445
if sys.platform == 'win32' and self.compiler.compiler_type == 'msvc':
5546
# XXX: hack to circumvent a python 2.6 bug with msvc9compiler:
@@ -74,6 +65,16 @@ class was %s
7465
============================================================================"""
7566
raise distutils.errors.DistutilsPlatformError(msg)
7667

68+
if not isinstance(self.fcompiler, FCompiler):
69+
self.fcompiler = new_fcompiler(compiler=self.fcompiler,
70+
dry_run=self.dry_run, force=1,
71+
c_compiler=self.compiler)
72+
if self.fcompiler is not None:
73+
self.fcompiler.customize(self.distribution)
74+
if self.fcompiler.get_version():
75+
self.fcompiler.customize_cmd(self)
76+
self.fcompiler.show_customization()
77+
7778
def _wrap_method(self,mth,lang,args):
7879
from distutils.ccompiler import CompileError
7980
from distutils.errors import DistutilsExecError

0 commit comments

Comments
 (0)