diff options
| author | Niyas Sait <niyas.sait@linaro.org> | 2021-08-26 09:07:57 +0100 |
|---|---|---|
| committer | Niyas Sait <niyas.sait@linaro.org> | 2021-08-26 09:07:57 +0100 |
| commit | 57ac11b78470a41480c1b056ed11744e8de1fe09 (patch) | |
| tree | f581ca14cb4128a86d91f7d9cd28d05de8724c47 | |
| parent | 0c302d232dd1a1f4ec531050532a84274edac2f4 (diff) | |
| download | python-setuptools-git-57ac11b78470a41480c1b056ed11744e8de1fe09.tar.gz | |
add win/arm64 launchers
| -rw-r--r-- | msvc-build-launcher.cmd | 10 | ||||
| -rw-r--r-- | setuptools/cli-arm64.exe | bin | 0 -> 137216 bytes | |||
| -rw-r--r-- | setuptools/command/easy_install.py | 6 | ||||
| -rw-r--r-- | setuptools/gui-arm64.exe | bin | 0 -> 137216 bytes | |||
| -rw-r--r-- | setuptools/tests/test_windows_wrappers.py | 13 |
5 files changed, 26 insertions, 3 deletions
diff --git a/msvc-build-launcher.cmd b/msvc-build-launcher.cmd index 92da290e..9c9d4d23 100644 --- a/msvc-build-launcher.cmd +++ b/msvc-build-launcher.cmd @@ -35,5 +35,15 @@ if "%ERRORLEVEL%"=="0" ( echo Windows SDK 6.1 not found to build Windows 64-bit version
)
+REM now for arm 64-bit
+REM Cross compile for arm64
+call VCVARSx86_arm64
+if "%ERRORLEVEL%"=="0" (
+ cl /D "GUI=0" /D "WIN32_LEAN_AND_MEAN" launcher.c /O2 /link /MACHINE:arm64 /SUBSYSTEM:CONSOLE /out:setuptools/cli-arm64.exe
+ cl /D "GUI=1" /D "WIN32_LEAN_AND_MEAN" launcher.c /O2 /link /MACHINE:arm64 /SUBSYSTEM:WINDOWS /out:setuptools/gui-arm64.exe
+) else (
+ echo Windows SDK 6.1 not found to build Windows 64-bit version
+)
+
set PATH=%PATH_OLD%
diff --git a/setuptools/cli-arm64.exe b/setuptools/cli-arm64.exe Binary files differnew file mode 100644 index 00000000..95badd96 --- /dev/null +++ b/setuptools/cli-arm64.exe diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index 43bd2952..bd2f6235 100644 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -22,6 +22,7 @@ from distutils import log, dir_util from distutils.command.build_scripts import first_line_re from distutils.spawn import find_executable import sys +import platform import os import zipimport import shutil @@ -2263,7 +2264,10 @@ def get_win_launcher(type): """ launcher_fn = '%s.exe' % type if is_64bit(): - launcher_fn = launcher_fn.replace(".", "-64.") + if platform.machine() == "ARM64": + launcher_fn = launcher_fn.replace(".", "-arm64.") + else: + launcher_fn = launcher_fn.replace(".", "-64.") else: launcher_fn = launcher_fn.replace(".", "-32.") return resource_string('setuptools', launcher_fn) diff --git a/setuptools/gui-arm64.exe b/setuptools/gui-arm64.exe Binary files differnew file mode 100644 index 00000000..489eef1d --- /dev/null +++ b/setuptools/gui-arm64.exe diff --git a/setuptools/tests/test_windows_wrappers.py b/setuptools/tests/test_windows_wrappers.py index 27853aae..05a604b2 100644 --- a/setuptools/tests/test_windows_wrappers.py +++ b/setuptools/tests/test_windows_wrappers.py @@ -13,6 +13,7 @@ are to wrap. """ import sys +import platform import textwrap import subprocess @@ -50,11 +51,19 @@ class WrapperTester: w = pkg_resources.resource_string('setuptools', cls.wrapper_source) f.write(w) +def win_launcher_exe(prefix): + """ A simple routine to select launcher script based on platform.""" + assert prefix in ('cli', 'gui') + if platform.machine() == "ARM64": + return "{}-arm64.exe".format(prefix) + else: + return "{}-32.exe".format(prefix) class TestCLI(WrapperTester): script_name = 'foo-script.py' - wrapper_source = 'cli-32.exe' wrapper_name = 'foo.exe' + wrapper_source = win_launcher_exe('cli') + script_tmpl = textwrap.dedent(""" #!%(python_exe)s import sys @@ -155,7 +164,7 @@ class TestGUI(WrapperTester): ----------------------- """ script_name = 'bar-script.pyw' - wrapper_source = 'gui-32.exe' + wrapper_source = win_launcher_exe('gui') wrapper_name = 'bar.exe' script_tmpl = textwrap.dedent(""" |
