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

Skip to content

Commit 4ebd39d

Browse files
committed
Refactor msvc runtime checking, put it into mingw32compiler
1 parent 1d3d4cd commit 4ebd39d

2 files changed

Lines changed: 16 additions & 12 deletions

File tree

numpy/distutils/command/config.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
from distutils.file_util import copy_file
1313
from distutils.msvccompiler import get_build_version as get_build_msvc_version
1414
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
15+
from numpy.distutils.mingw32compiler import msvc_manifest_xml,
16+
check_embedded_match_linked
1717

1818
LANG_EXT['f77'] = '.f'
1919
LANG_EXT['f90'] = '.f90'
@@ -117,16 +117,7 @@ def _link (self, body,
117117
msver = get_build_msvc_version()
118118
if msver is not None:
119119
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)
120+
check_embedded_msvcr_match_linked(msver)
130121

131122
return self._wrap_method(old_config._link,lang,
132123
(body, headers, include_dirs,

numpy/distutils/mingw32ccompiler.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,3 +294,16 @@ def manifest_rc(name, type='dll'):
294294
return """\
295295
#include "winuser.h"
296296
%d RT_MANIFEST %s""" % (rctype, name)
297+
298+
def check_embedded_msvcr_match_linked(msver):
299+
"""msver is the ms runtime version used for the MANIFEST."""
300+
# check msvcr major version are the same for linking and
301+
# embedding
302+
msvcv = msvc_runtime_library()
303+
if msvcv:
304+
maj = msvcv[5:6]
305+
if not maj == int(msver):
306+
raise ValueError,
307+
"Dyscrepancy between linked msvcr " \
308+
"(%f) and the one about to be embedded " \
309+
"(%f)" % (int(msver), maj)

0 commit comments

Comments
 (0)