@@ -62,17 +62,28 @@ def _check_compiler (self):
6262 e = get_exception ()
6363 msg = """\
6464 Could not initialize compiler instance: do you have Visual Studio
65- installed ? If you are trying to build with mingw, please use python setup.py
66- build -c mingw32 instead ). If you have Visual Studio installed, check it is
67- correctly installed, and the right version (VS 2008 for python 2.6, VS 2003 for
68- 2.5, etc...). Original exception was: %s, and the Compiler
69- class was %s
65+ installed? If you are trying to build with MinGW, please use "python setup.py
66+ build -c mingw32" instead. If you have Visual Studio installed, check it is
67+ correctly installed, and the right version (VS 2008 for python 2.6, 2.7 and 3.2,
68+ VS 2010 for >= 3.3).
69+
70+ Original exception was: %s, and the Compiler class was %s
7071============================================================================""" \
7172 % (e , self .compiler .__class__ .__name__ )
7273 print ("""\
7374 ============================================================================""" )
7475 raise distutils .errors .DistutilsPlatformError (msg )
7576
77+ # After MSVC is initialized, add an explicit /MANIFEST to linker
78+ # flags. See issues gh-4245 and gh-4101 for details. Also
79+ # relevant are issues 4431 and 16296 on the Python bug tracker.
80+ from distutils import msvc9compiler
81+ if msvc9compiler .get_build_version () >= 10 :
82+ for ldflags in [self .compiler .ldflags_shared ,
83+ self .compiler .ldflags_shared_debug ]:
84+ if '/MANIFEST' not in ldflags :
85+ ldflags .append ('/MANIFEST' )
86+
7687 if not isinstance (self .fcompiler , FCompiler ):
7788 self .fcompiler = new_fcompiler (compiler = self .fcompiler ,
7889 dry_run = self .dry_run , force = 1 ,
0 commit comments