Skip to content

Commit 964996e

Browse files
authored
Merge pull request python#17 from paulmon/win-arm32-master
Win arm32 master
2 parents 1c3de54 + 91c3864 commit 964996e

File tree

127 files changed

+10813
-133
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+10813
-133
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Doc/.env/
3232
Include/pydtrace_probes.h
3333
Lib/distutils/command/*.pdb
3434
Lib/lib2to3/*.pickle
35+
Lib/site-packages/**/*
3536
Lib/test/data/*
3637
Makefile
3738
Makefile.pre
@@ -69,11 +70,14 @@ PCbuild/*.VC.db
6970
PCbuild/*.VC.opendb
7071
PCbuild/.vs/
7172
PCbuild/amd64/
73+
PCbuild/arm32/
74+
PCbuild/iot/
7275
PCbuild/obj/
7376
PCbuild/win32/
7477
.purify
7578
Parser/pgen
7679
Parser/pgen.exe
80+
Scripts/*.exe
7781
__pycache__
7882
autom4te.cache
7983
build/

Include/internal/pycore_atomic.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ extern "C" {
1919

2020
#if defined(_MSC_VER)
2121
#include <intrin.h>
22+
#ifndef _M_ARM
2223
#include <immintrin.h>
2324
#endif
25+
#endif
2426

2527
/* This is modeled after the atomics interface from C1x, according to
2628
* the draft at

Include/pyport.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ extern "C" {
406406
#endif
407407

408408
/* get and set x87 control word for VisualStudio/x86 */
409-
#if defined(_MSC_VER) && !defined(_WIN64) /* x87 not supported in 64-bit */
409+
#if defined(_MSC_VER) && !defined(_WIN64) && !defined(_M_ARM) /* x87 not supported in 64-bit or ARM */
410410
#define HAVE_PY_SET_53BIT_PRECISION 1
411411
#define _Py_SET_53BIT_PRECISION_HEADER \
412412
unsigned int old_387controlword, new_387controlword, out_387controlword

Include/pythonrun.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ PyAPI_DATA(PyThreadState*) _PyOS_ReadlineTState;
165165
to an 8k margin. */
166166
#define PYOS_STACK_MARGIN 2048
167167

168-
#if defined(WIN32) && !defined(MS_WIN64) && defined(_MSC_VER) && _MSC_VER >= 1300
168+
#if defined(WIN32) && !defined(MS_WIN64) && !defined(_M_ARM) && defined(_MSC_VER) && _MSC_VER >= 1300
169169
/* Enable stack checking under Microsoft C */
170170
#define USE_STACKCHECK
171171
#endif

Lib/ctypes/test/test_win32.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Windows specific tests
22

33
from ctypes import *
4-
import unittest, sys
4+
import unittest, sys, platform
55
from test import support
66

77
import _ctypes_test
@@ -11,6 +11,7 @@
1111
@unittest.skipUnless(sizeof(c_void_p) == sizeof(c_int),
1212
"sizeof c_void_p and c_int differ")
1313
class WindowsTestCase(unittest.TestCase):
14+
@unittest.skipIf(platform.win32_is_iot(), "API not present on Windows 10 IoT Core")
1415
def test_callconv_1(self):
1516
# Testing stdcall function
1617

@@ -26,6 +27,7 @@ def test_callconv_1(self):
2627
# (8 bytes in excess)
2728
self.assertRaises(ValueError, IsWindow, 0, 0, 0)
2829

30+
@unittest.skipIf(platform.win32_is_iot(), "API not present on Windows 10 IoT Core")
2931
def test_callconv_2(self):
3032
# Calling stdcall function as cdecl
3133

Lib/distutils/_msvccompiler.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
CompileError, LibError, LinkError
2424
from distutils.ccompiler import CCompiler, gen_lib_options
2525
from distutils import log
26-
from distutils.util import get_platform
26+
from distutils.util import get_target_platform
2727

2828
from itertools import count
2929

@@ -88,13 +88,24 @@ def _find_vc2017():
8888

8989
return None, None
9090

91+
PLAT_SPEC_TO_RUNTIME = {
92+
'x86' : 'x86',
93+
'x86_amd64' : 'x64',
94+
'x86_arm' : 'arm',
95+
}
96+
9197
def _find_vcvarsall(plat_spec):
9298
_, best_dir = _find_vc2017()
9399
vcruntime = None
94-
vcruntime_plat = 'x64' if 'amd64' in plat_spec else 'x86'
100+
101+
if plat_spec in PLAT_SPEC_TO_RUNTIME:
102+
vcruntime_plat = PLAT_SPEC_TO_RUNTIME[plat_spec]
103+
else:
104+
vcruntime_plat = 'x64' if 'amd64' in plat_spec else 'x86'
105+
95106
if best_dir:
96107
vcredist = os.path.join(best_dir, "..", "..", "redist", "MSVC", "**",
97-
"Microsoft.VC141.CRT", "vcruntime140.dll")
108+
vcruntime_plat, "Microsoft.VC141.CRT", "vcruntime140.dll")
98109
try:
99110
import glob
100111
vcruntime = glob.glob(vcredist, recursive=True)[-1]
@@ -171,12 +182,13 @@ def _find_exe(exe, paths=None):
171182
return fn
172183
return exe
173184

174-
# A map keyed by get_platform() return values to values accepted by
185+
# A map keyed by get_target_platform() return values to values accepted by
175186
# 'vcvarsall.bat'. Always cross-compile from x86 to work with the
176187
# lighter-weight MSVC installs that do not include native 64-bit tools.
177188
PLAT_TO_VCVARS = {
178189
'win32' : 'x86',
179190
'win-amd64' : 'x86_amd64',
191+
'win-arm' : 'x86_arm',
180192
}
181193

182194
# A set containing the DLLs that are guaranteed to be available for
@@ -226,7 +238,8 @@ def initialize(self, plat_name=None):
226238
# multi-init means we would need to check platform same each time...
227239
assert not self.initialized, "don't init multiple times"
228240
if plat_name is None:
229-
plat_name = get_platform()
241+
plat_name = get_target_platform()
242+
230243
# sanity check for platforms to prevent obscure errors later.
231244
if plat_name not in PLAT_TO_VCVARS:
232245
raise DistutilsPlatformError("--plat-name must be one of {}"

Lib/distutils/command/bdist.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import os
77
from distutils.core import Command
88
from distutils.errors import *
9-
from distutils.util import get_platform
9+
from distutils.util import get_target_platform
1010

1111

1212
def show_formats():
@@ -29,7 +29,7 @@ class bdist(Command):
2929
"temporary directory for creating built distributions"),
3030
('plat-name=', 'p',
3131
"platform name to embed in generated filenames "
32-
"(default: %s)" % get_platform()),
32+
"(default: %s)" % get_target_platform()),
3333
('formats=', None,
3434
"formats for distribution (comma-separated list)"),
3535
('dist-dir=', 'd',
@@ -91,7 +91,7 @@ def finalize_options(self):
9191
# have to finalize 'plat_name' before 'bdist_base'
9292
if self.plat_name is None:
9393
if self.skip_build:
94-
self.plat_name = get_platform()
94+
self.plat_name = get_target_platform()
9595
else:
9696
self.plat_name = self.get_finalized_command('build').plat_name
9797

Lib/distutils/command/bdist_dumb.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import os
88
from distutils.core import Command
9-
from distutils.util import get_platform
9+
from distutils.util import get_target_platform
1010
from distutils.dir_util import remove_tree, ensure_relative
1111
from distutils.errors import *
1212
from distutils.sysconfig import get_python_version
@@ -20,7 +20,7 @@ class bdist_dumb(Command):
2020
"temporary directory for creating the distribution"),
2121
('plat-name=', 'p',
2222
"platform name to embed in generated filenames "
23-
"(default: %s)" % get_platform()),
23+
"(default: %s)" % get_target_platform()),
2424
('format=', 'f',
2525
"archive format to create (tar, gztar, bztar, xztar, "
2626
"ztar, zip)"),

Lib/distutils/command/bdist_msi.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from distutils.sysconfig import get_python_version
1313
from distutils.version import StrictVersion
1414
from distutils.errors import DistutilsOptionError
15-
from distutils.util import get_platform
15+
from distutils.util import get_target_platform
1616
from distutils import log
1717
import msilib
1818
from msilib import schema, sequence, text
@@ -88,7 +88,7 @@ class bdist_msi(Command):
8888
"temporary directory for creating the distribution"),
8989
('plat-name=', 'p',
9090
"platform name to embed in generated filenames "
91-
"(default: %s)" % get_platform()),
91+
"(default: %s)" % get_target_platform()),
9292
('keep-temp', 'k',
9393
"keep the pseudo-installation tree around after " +
9494
"creating the distribution archive"),

Lib/distutils/command/bdist_wininst.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import sys, os
77
from distutils.core import Command
8-
from distutils.util import get_platform
8+
from distutils.util import get_target_platform
99
from distutils.dir_util import create_tree, remove_tree
1010
from distutils.errors import *
1111
from distutils.sysconfig import get_python_version
@@ -19,7 +19,7 @@ class bdist_wininst(Command):
1919
"temporary directory for creating the distribution"),
2020
('plat-name=', 'p',
2121
"platform name to embed in generated filenames "
22-
"(default: %s)" % get_platform()),
22+
"(default: %s)" % get_target_platform()),
2323
('keep-temp', 'k',
2424
"keep the pseudo-installation tree around after " +
2525
"creating the distribution archive"),

0 commit comments

Comments
 (0)