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