Adding support for Microsoft Visual C++ Compiler for Python 2.7

This commit is contained in:
James Wettenhall
2017-03-22 08:40:05 +11:00
parent 088ba0ccdf
commit 96dc809236
2 changed files with 7 additions and 0 deletions

View File

@@ -723,7 +723,9 @@ def checkCompiler(quiet=False):
# Make sure that the compiler that Python wants to use can be found.
# It will terminate if the compiler is not found or other exceptions
# are raised.
# setuptools is imported to address https://bugs.python.org/issue23246
cmd = "import distutils.msvc9compiler as msvc; " \
"import setuptools; " \
"mc = msvc.MSVCCompiler(); " \
"mc.initialize(); " \
"print(mc.cc)"
@@ -734,7 +736,9 @@ def checkCompiler(quiet=False):
# Now get the environment variables which that compiler needs from
# its vcvarsall.bat command and load them into this process's
# environment.
# setuptools is imported to address https://bugs.python.org/issue23246
cmd = "import distutils.msvc9compiler as msvc; " \
"import setuptools; " \
"arch = msvc.PLAT_TO_VCVARS[msvc.get_platform()]; " \
"env = msvc.query_vcvarsall(msvc.VERSION, arch); " \
"print(env)"

View File

@@ -74,6 +74,7 @@ def configure(conf):
msvc_version = str( distutils.msvc9compiler.get_build_version() )
conf.env['MSVC_VERSIONS'] = ['msvc ' + msvc_version]
conf.env['MSVC_TARGETS'] = [conf.options.msvc_arch]
conf.env['NO_MSVC_DETECT'] = 1
conf.load('msvc')
else:
conf.load('compiler_cc compiler_cxx')
@@ -415,6 +416,8 @@ def my_check_python_headers(conf):
if env.CC_NAME == "msvc":
from distutils.msvccompiler import MSVCCompiler
# setuptools is imported to address https://bugs.python.org/issue23246
import setuptools
dist_compiler = MSVCCompiler()
dist_compiler.initialize()
env.append_value('CFLAGS_PYEXT', dist_compiler.compile_options)