Issue #25027: Reverts partial-static build options and adds vcruntime140.dll to Windows installation.

This commit is contained in:
Steve Dower 2015-09-08 21:39:01 -07:00
parent 0130e2991d
commit fcbe1df4af
13 changed files with 151 additions and 38 deletions

View file

@ -3,6 +3,8 @@ import sys
import unittest
import os
import distutils._msvccompiler as _msvccompiler
from distutils.errors import DistutilsPlatformError
from distutils.tests import support
from test.support import run_unittest
@ -19,19 +21,65 @@ class msvccompilerTestCase(support.TempdirManager,
# makes sure query_vcvarsall raises
# a DistutilsPlatformError if the compiler
# is not found
from distutils._msvccompiler import _get_vc_env
def _find_vcvarsall():
return None
def _find_vcvarsall(plat_spec):
return None, None
import distutils._msvccompiler as _msvccompiler
old_find_vcvarsall = _msvccompiler._find_vcvarsall
_msvccompiler._find_vcvarsall = _find_vcvarsall
try:
self.assertRaises(DistutilsPlatformError, _get_vc_env,
self.assertRaises(DistutilsPlatformError,
_msvccompiler._get_vc_env,
'wont find this version')
finally:
_msvccompiler._find_vcvarsall = old_find_vcvarsall
def test_compiler_options(self):
# suppress path to vcruntime from _find_vcvarsall to
# check that /MT is added to compile options
old_find_vcvarsall = _msvccompiler._find_vcvarsall
def _find_vcvarsall(plat_spec):
return old_find_vcvarsall(plat_spec)[0], None
_msvccompiler._find_vcvarsall = _find_vcvarsall
try:
compiler = _msvccompiler.MSVCCompiler()
compiler.initialize()
self.assertIn('/MT', compiler.compile_options)
self.assertNotIn('/MD', compiler.compile_options)
finally:
_msvccompiler._find_vcvarsall = old_find_vcvarsall
def test_vcruntime_copy(self):
# force path to a known file - it doesn't matter
# what we copy as long as its name is not in
# _msvccompiler._BUNDLED_DLLS
old_find_vcvarsall = _msvccompiler._find_vcvarsall
def _find_vcvarsall(plat_spec):
return old_find_vcvarsall(plat_spec)[0], __file__
_msvccompiler._find_vcvarsall = _find_vcvarsall
try:
tempdir = self.mkdtemp()
compiler = _msvccompiler.MSVCCompiler()
compiler.initialize()
compiler._copy_vcruntime(tempdir)
self.assertTrue(os.path.isfile(os.path.join(
tempdir, os.path.basename(__file__))))
finally:
_msvccompiler._find_vcvarsall = old_find_vcvarsall
def test_vcruntime_skip_copy(self):
tempdir = self.mkdtemp()
compiler = _msvccompiler.MSVCCompiler()
compiler.initialize()
dll = compiler._vcruntime_redist
self.assertTrue(os.path.isfile(dll))
compiler._copy_vcruntime(tempdir)
self.assertFalse(os.path.isfile(os.path.join(
tempdir, os.path.basename(dll))))
def test_suite():
return unittest.makeSuite(msvccompilerTestCase)