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

Skip to content

Commit fd80286

Browse files
committed
Refactor manifest generation and put it back into mingw32ccompiler module.
1 parent 3d745a6 commit fd80286

2 files changed

Lines changed: 23 additions & 21 deletions

File tree

numpy/distutils/command/config.py

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@
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
1413
from numpy.distutils.exec_command import exec_command
15-
from numpy.distutils.mingw32ccompiler import msvc_manifest_xml, \
16-
check_embedded_msvcr_match_linked, manifest_name, rc_name, manifest_rc
14+
from numpy.distutils.mingw32ccompiler import generate_manifest
1715

1816
LANG_EXT['f77'] = '.f'
1917
LANG_EXT['f90'] = '.f90'
@@ -114,24 +112,7 @@ def _link (self, body,
114112
log.warn('could not find library %r in directories %s' \
115113
% (libname, library_dirs))
116114
elif self.compiler.compiler_type == 'mingw32':
117-
msver = get_build_msvc_version()
118-
if msver is not None:
119-
if msver >= 8:
120-
check_embedded_msvcr_match_linked(msver)
121-
ma = int(msver)
122-
mi = int((msver - ma) * 10)
123-
# Write the manifest file
124-
manxml = msvc_manifest_xml(ma, mi)
125-
man = open(manifest_name(self), "w")
126-
self.temp_files.append(manxml)
127-
man.write(manxml)
128-
man.close()
129-
# # Write the rc file
130-
# manrc = manifest_rc(manifest_name(self), "exe")
131-
# rc = open(rc_name(self), "w")
132-
# self.temp_files.append(manrc)
133-
# rc.write(manrc)
134-
# rc.close()
115+
generate_manifest(self)
135116
return self._wrap_method(old_config._link,lang,
136117
(body, headers, include_dirs,
137118
libraries, library_dirs, lang))

numpy/distutils/mingw32ccompiler.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
from distutils.errors import DistutilsExecError, CompileError, UnknownFileError
2828

2929
from distutils.unixccompiler import UnixCCompiler
30+
from distutils.msvccompiler import get_build_version as get_build_msvc_version
3031
from numpy.distutils.misc_util import msvc_runtime_library
3132

3233
# the same as cygwin plus some additional parameters
@@ -321,3 +322,23 @@ def rc_name(config):
321322
# Get configest name (including suffix)
322323
root = configtest_name(config)
323324
return root + ".rc"
325+
326+
def generate_manifest(config):
327+
msver = get_build_msvc_version()
328+
if msver is not None:
329+
if msver >= 8:
330+
check_embedded_msvcr_match_linked(msver)
331+
ma = int(msver)
332+
mi = int((msver - ma) * 10)
333+
# Write the manifest file
334+
manxml = msvc_manifest_xml(ma, mi)
335+
man = open(manifest_name(config), "w")
336+
config.temp_files.append(manifest_name(config))
337+
man.write(manxml)
338+
man.close()
339+
# # Write the rc file
340+
# manrc = manifest_rc(manifest_name(self), "exe")
341+
# rc = open(rc_name(self), "w")
342+
# self.temp_files.append(manrc)
343+
# rc.write(manrc)
344+
# rc.close()

0 commit comments

Comments
 (0)