Commit 03ae9d8b authored by Paul Monson's avatar Paul Monson Committed by Steve Dower

bpo-35920: Windows 10 ARM32 platform support (GH-11774)

parent eb3478f2
...@@ -89,13 +89,24 @@ def _find_vc2017(): ...@@ -89,13 +89,24 @@ def _find_vc2017():
return None, None return None, None
PLAT_SPEC_TO_RUNTIME = {
'x86' : 'x86',
'x86_amd64' : 'x64',
'x86_arm' : 'arm',
}
def _find_vcvarsall(plat_spec): def _find_vcvarsall(plat_spec):
_, best_dir = _find_vc2017() _, best_dir = _find_vc2017()
vcruntime = None vcruntime = None
vcruntime_plat = 'x64' if 'amd64' in plat_spec else 'x86'
if plat_spec in PLAT_SPEC_TO_RUNTIME:
vcruntime_plat = PLAT_SPEC_TO_RUNTIME[plat_spec]
else:
vcruntime_plat = 'x64' if 'amd64' in plat_spec else 'x86'
if best_dir: if best_dir:
vcredist = os.path.join(best_dir, "..", "..", "redist", "MSVC", "**", vcredist = os.path.join(best_dir, "..", "..", "redist", "MSVC", "**",
"Microsoft.VC141.CRT", "vcruntime140.dll") vcruntime_plat, "Microsoft.VC141.CRT", "vcruntime140.dll")
try: try:
import glob import glob
vcruntime = glob.glob(vcredist, recursive=True)[-1] vcruntime = glob.glob(vcredist, recursive=True)[-1]
...@@ -178,6 +189,7 @@ def _find_exe(exe, paths=None): ...@@ -178,6 +189,7 @@ def _find_exe(exe, paths=None):
PLAT_TO_VCVARS = { PLAT_TO_VCVARS = {
'win32' : 'x86', 'win32' : 'x86',
'win-amd64' : 'x86_amd64', 'win-amd64' : 'x86_amd64',
'win-arm32' : 'x86_arm',
} }
# A set containing the DLLs that are guaranteed to be available for # A set containing the DLLs that are guaranteed to be available for
......
...@@ -81,7 +81,6 @@ def _spawn_nt(cmd, search_path=1, verbose=0, dry_run=0): ...@@ -81,7 +81,6 @@ def _spawn_nt(cmd, search_path=1, verbose=0, dry_run=0):
"command %r failed with exit status %d" % (cmd, rc)) "command %r failed with exit status %d" % (cmd, rc))
if sys.platform == 'darwin': if sys.platform == 'darwin':
from distutils import sysconfig
_cfg_target = None _cfg_target = None
_cfg_target_split = None _cfg_target_split = None
...@@ -95,6 +94,7 @@ def _spawn_posix(cmd, search_path=1, verbose=0, dry_run=0): ...@@ -95,6 +94,7 @@ def _spawn_posix(cmd, search_path=1, verbose=0, dry_run=0):
if sys.platform == 'darwin': if sys.platform == 'darwin':
global _cfg_target, _cfg_target_split global _cfg_target, _cfg_target_split
if _cfg_target is None: if _cfg_target is None:
from distutils import sysconfig
_cfg_target = sysconfig.get_config_var( _cfg_target = sysconfig.get_config_var(
'MACOSX_DEPLOYMENT_TARGET') or '' 'MACOSX_DEPLOYMENT_TARGET') or ''
if _cfg_target: if _cfg_target:
......
...@@ -15,6 +15,7 @@ import re ...@@ -15,6 +15,7 @@ import re
import sys import sys
from .errors import DistutilsPlatformError from .errors import DistutilsPlatformError
from .util import get_platform, get_host_platform
# These are needed in a couple of spots, so just compute them once. # These are needed in a couple of spots, so just compute them once.
PREFIX = os.path.normpath(sys.prefix) PREFIX = os.path.normpath(sys.prefix)
......
...@@ -15,7 +15,7 @@ from distutils.spawn import spawn ...@@ -15,7 +15,7 @@ from distutils.spawn import spawn
from distutils import log from distutils import log
from distutils.errors import DistutilsByteCompileError from distutils.errors import DistutilsByteCompileError
def get_platform (): def get_host_platform():
"""Return a string that identifies the current platform. This is used mainly to """Return a string that identifies the current platform. This is used mainly to
distinguish platform-specific build directories and platform-specific built distinguish platform-specific build directories and platform-specific built
distributions. Typically includes the OS name and version and the distributions. Typically includes the OS name and version and the
...@@ -38,6 +38,8 @@ def get_platform (): ...@@ -38,6 +38,8 @@ def get_platform ():
if os.name == 'nt': if os.name == 'nt':
if 'amd64' in sys.version.lower(): if 'amd64' in sys.version.lower():
return 'win-amd64' return 'win-amd64'
if '(arm)' in sys.version.lower():
return 'win-arm32'
return sys.platform return sys.platform
# Set for cross builds explicitly # Set for cross builds explicitly
...@@ -90,8 +92,16 @@ def get_platform (): ...@@ -90,8 +92,16 @@ def get_platform ():
return "%s-%s-%s" % (osname, release, machine) return "%s-%s-%s" % (osname, release, machine)
# get_platform () def get_platform():
if os.name == 'nt':
TARGET_TO_PLAT = {
'x86' : 'win32',
'x64' : 'win-amd64',
'arm' : 'win-arm32',
}
return TARGET_TO_PLAT.get(os.environ.get('VSCMD_ARG_TGT_ARCH')) or get_host_platform()
else:
return get_host_platform()
def convert_path (pathname): def convert_path (pathname):
"""Return 'pathname' as a name that will work on the native filesystem, """Return 'pathname' as a name that will work on the native filesystem,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment