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

Skip to content

Commit 8ab3101

Browse files
committed
Merged revisions 76653 via svnmerge from
svn+ssh://[email protected]/python/branches/py3k ................ r76653 | martin.v.loewis | 2009-12-03 21:57:49 +0100 (Do, 03 Dez 2009) | 10 lines Merged revisions 76651 via svnmerge from svn+ssh://[email protected]/python/trunk ........ r76651 | martin.v.loewis | 2009-12-03 21:53:51 +0100 (Do, 03 Dez 2009) | 3 lines Issue #4120: Drop reference to CRT from manifest when building extensions with msvc9compiler. ........ ................
1 parent 31105ab commit 8ab3101

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

Lib/distutils/msvc9compiler.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import os
1818
import subprocess
1919
import sys
20+
import re
2021

2122
from distutils.errors import DistutilsExecError, DistutilsPlatformError, \
2223
CompileError, LibError, LinkError
@@ -645,6 +646,28 @@ def link(self,
645646
mfid = 1
646647
else:
647648
mfid = 2
649+
try:
650+
# Remove references to the Visual C runtime, so they will
651+
# fall through to the Visual C dependency of Python.exe.
652+
# This way, when installed for a restricted user (e.g.
653+
# runtimes are not in WinSxS folder, but in Python's own
654+
# folder), the runtimes do not need to be in every folder
655+
# with .pyd's.
656+
manifest_f = open(temp_manifest, "rb")
657+
manifest_buf = manifest_f.read()
658+
manifest_f.close()
659+
pattern = re.compile(
660+
r"""<assemblyIdentity.*?name=("|')Microsoft\."""\
661+
r"""VC\d{2}\.CRT("|').*?(/>|</assemblyIdentity>)""",
662+
re.DOTALL)
663+
manifest_buf = re.sub(pattern, "", manifest_buf)
664+
pattern = "<dependentAssembly>\s*</dependentAssembly>"
665+
manifest_buf = re.sub(pattern, "", manifest_buf)
666+
manifest_f = open(temp_manifest, "wb")
667+
manifest_f.write(manifest_buf)
668+
manifest_f.close()
669+
except IOError:
670+
pass
648671
out_arg = '-outputresource:%s;%s' % (output_filename, mfid)
649672
try:
650673
self.spawn(['mt.exe', '-nologo', '-manifest',

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ Core and Builtins
5555
Library
5656
-------
5757

58+
- Issue #4120: Drop reference to CRT from manifest when building extensions with
59+
msvc9compiler.
60+
5861
- Issue #7410: deepcopy of itertools.count was resetting the count.
5962

6063
- Issue #4486: When an exception has an explicit cause, do not print its

0 commit comments

Comments
 (0)