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

Skip to content

Commit 1d3d4cd

Browse files
committed
Detect whether config link needs embedding the manifest for the MSVC runtime.
1 parent 6cf5c1f commit 1d3d4cd

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

numpy/distutils/command/config.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010
from distutils.command.config import LANG_EXT
1111
from distutils import log
1212
from distutils.file_util import copy_file
13+
from distutils.msvccompiler import get_build_version as get_build_msvc_version
1314
from numpy.distutils.exec_command import exec_command
15+
from numpy.distutils.misc_util import msvc_runtime_library
16+
from numpy.distutils.mingw32compiler import msvc_manifest_xml
1417

1518
LANG_EXT['f77'] = '.f'
1619
LANG_EXT['f90'] = '.f90'
@@ -110,6 +113,21 @@ def _link (self, body,
110113
if fileexists: continue
111114
log.warn('could not find library %r in directories %s' \
112115
% (libname, library_dirs))
116+
elif self.compiler.compiler_type == 'mingw32':
117+
msver = get_build_msvc_version()
118+
if msver is not None:
119+
if msver >= 8:
120+
# check msvcr major version are the same for linking and
121+
# embedding
122+
msvcv = msvc_runtime_library()
123+
if msvcv:
124+
maj = msvcv[5:6]
125+
if not maj == int(msver):
126+
raise ValueError,
127+
"Dyscrepancy between linked msvcr " \
128+
"(%f) and the one about to be embedded " \
129+
"(%f)" % (int(msver), maj)
130+
113131
return self._wrap_method(old_config._link,lang,
114132
(body, headers, include_dirs,
115133
libraries, library_dirs, lang))

0 commit comments

Comments
 (0)