From 8361f6c96189ecc2bb39b0772ba1e83a65743c91 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Fri, 15 Apr 2022 12:26:56 +0100 Subject: [PATCH 1/4] Allow cross-compiling for Windows ARM64 --- buildlibxml.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildlibxml.py b/buildlibxml.py index fc5f5441d..6957ab9fb 100644 --- a/buildlibxml.py +++ b/buildlibxml.py @@ -38,7 +38,7 @@ def download_and_extract_windows_binaries(destdir): if release_path in filename ] - if platform.machine() == 'ARM64': + if platform.machine() == 'ARM64' or os.getenv('VSCMD_ARG_TGT_ARCH') == 'arm64': arch = "win-arm64" elif sys.maxsize > 2**32: arch = "win64" From e5a4a4dd856f18a51e1c1aaeb26b710b88c01995 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Fri, 15 Apr 2022 13:13:27 +0100 Subject: [PATCH 2/4] Use setuptools build_ext command This allow proper handling of cross-compilation added to setuptools but not to [deprecated] distutils. --- setupinfo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setupinfo.py b/setupinfo.py index c1247c6d6..cef485938 100644 --- a/setupinfo.py +++ b/setupinfo.py @@ -5,7 +5,7 @@ import subprocess from distutils.core import Extension from distutils.errors import CompileError, DistutilsOptionError -from distutils.command.build_ext import build_ext as _build_ext +from setuptools.command.build_ext import build_ext as _build_ext from versioninfo import get_base_dir try: From db33e583d2ab0f181a47b093c6ad8dd730d8fbab Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Mon, 18 Apr 2022 16:52:19 +0100 Subject: [PATCH 3/4] Update buildlibxml.py Co-authored-by: scoder --- buildlibxml.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/buildlibxml.py b/buildlibxml.py index 6957ab9fb..e0c558fad 100644 --- a/buildlibxml.py +++ b/buildlibxml.py @@ -38,6 +38,8 @@ def download_and_extract_windows_binaries(destdir): if release_path in filename ] + # Check for native ARM64 build or the environment variable that is set by + # Visual Studio for cross-compilation (same variable as setuptools uses) if platform.machine() == 'ARM64' or os.getenv('VSCMD_ARG_TGT_ARCH') == 'arm64': arch = "win-arm64" elif sys.maxsize > 2**32: From 972d8a9a04112fac861d45722539660d2abcf533 Mon Sep 17 00:00:00 2001 From: scoder Date: Tue, 17 May 2022 10:15:24 +0200 Subject: [PATCH 4/4] Move import to make sure we let setuptools do its patching first --- setupinfo.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setupinfo.py b/setupinfo.py index cef485938..675891478 100644 --- a/setupinfo.py +++ b/setupinfo.py @@ -3,9 +3,10 @@ import os import os.path import subprocess + +from setuptools.command.build_ext import build_ext as _build_ext from distutils.core import Extension from distutils.errors import CompileError, DistutilsOptionError -from setuptools.command.build_ext import build_ext as _build_ext from versioninfo import get_base_dir try: