[Python-checkins] cpython (merge 3.5 -> default): Issue #25850: Use cross-compilation by default for 64-bit Windows.

steve.dower python-checkins at python.org
Sat Jan 16 15:41:18 EST 2016


https://hg.python.org/cpython/rev/37dc870175be
changeset:   99935:37dc870175be
parent:      99932:4b06490cca47
parent:      99934:fc117df27143
user:        Steve Dower <steve.dower at microsoft.com>
date:        Sat Jan 16 12:40:19 2016 -0800
summary:
  Issue #25850: Use cross-compilation by default for 64-bit Windows.

files:
  Lib/distutils/_msvccompiler.py |  21 +++++----------------
  Misc/NEWS                      |   2 ++
  2 files changed, 7 insertions(+), 16 deletions(-)


diff --git a/Lib/distutils/_msvccompiler.py b/Lib/distutils/_msvccompiler.py
--- a/Lib/distutils/_msvccompiler.py
+++ b/Lib/distutils/_msvccompiler.py
@@ -125,11 +125,11 @@
     return exe
 
 # A map keyed by get_platform() return values to values accepted by
-# 'vcvarsall.bat'.  Note a cross-compile may combine these (eg, 'x86_amd64' is
-# the param to cross-compile on x86 targetting amd64.)
+# 'vcvarsall.bat'. Always cross-compile from x86 to work with the
+# lighter-weight MSVC installs that do not include native 64-bit tools.
 PLAT_TO_VCVARS = {
     'win32' : 'x86',
-    'win-amd64' : 'amd64',
+    'win-amd64' : 'x86_amd64',
 }
 
 # A map keyed by get_platform() return values to the file under
@@ -193,19 +193,8 @@
             raise DistutilsPlatformError("--plat-name must be one of {}"
                                          .format(tuple(PLAT_TO_VCVARS)))
 
-        # On x86, 'vcvarsall.bat amd64' creates an env that doesn't work;
-        # to cross compile, you use 'x86_amd64'.
-        # On AMD64, 'vcvarsall.bat amd64' is a native build env; to cross
-        # compile use 'x86' (ie, it runs the x86 compiler directly)
-        if plat_name == get_platform() or plat_name == 'win32':
-            # native build or cross-compile to win32
-            plat_spec = PLAT_TO_VCVARS[plat_name]
-        else:
-            # cross compile from win32 -> some 64bit
-            plat_spec = '{}_{}'.format(
-                PLAT_TO_VCVARS[get_platform()],
-                PLAT_TO_VCVARS[plat_name]
-            )
+        # Get the vcvarsall.bat spec for the requested platform.
+        plat_spec = PLAT_TO_VCVARS[plat_name]
 
         vc_env = _get_vc_env(plat_spec)
         if not vc_env:
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -131,6 +131,8 @@
 Library
 -------
 
+- Issue #25850: Use cross-compilation by default for 64-bit Windows.
+
 - Issue #25822: Add docstrings to the fields of urllib.parse results.
   Patch contributed by Swati Jaiswal.
 

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list