12
12
# finding DevStudio (through the registry)
13
13
# ported to VS2005 and VS 2008 by Christian Heimes
15
__revision__ = "$Id: msvc9compiler.py 68082 2008-12-30 23:06:46Z tarek.ziade $"
15
__revision__ = "$Id: msvc9compiler.py 76652 2009-12-03 20:56:15Z martin.v.loewis $"
20
21
from distutils.errors import (DistutilsExecError, DistutilsPlatformError,
21
22
CompileError, LibError, LinkError)
22
23
from distutils.ccompiler import (CCompiler, gen_preprocess_options,
641
642
# will still consider the DLL up-to-date, but it will not have a
642
643
# manifest. Maybe we should link to a temp file? OTOH, that
643
644
# implies a build environment error that shouldn't go undetected.
644
mfid = 1 if target_desc == CCompiler.EXECUTABLE else 2
645
if target_desc == CCompiler.EXECUTABLE:
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
656
manifest_f = open(temp_manifest, "rb")
657
manifest_buf = manifest_f.read()
659
pattern = re.compile(
660
r"""<assemblyIdentity.*?name=("|')Microsoft\."""\
661
r"""VC\d{2}\.CRT("|').*?(/>|</assemblyIdentity>)""",
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)
645
671
out_arg = '-outputresource:%s;%s' % (output_filename, mfid)
647
673
self.spawn(['mt.exe', '-nologo', '-manifest',