Skip to content

Commit 1326937

Browse files
Support Windows ARM64 platform (#849)
automerged PR by conda-forge/automerge-action
2 parents 4c191ed + 923b423 commit 1326937

33 files changed

Lines changed: 263 additions & 122 deletions

.azure-pipelines/azure-pipelines-win.yml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
build_type:
2+
- release
3+
bzip2:
4+
- '1'
5+
c_compiler:
6+
- vs2022
7+
c_stdlib:
8+
- vs
9+
channel_sources:
10+
- conda-forge/label/python_rc,conda-forge
11+
channel_targets:
12+
- conda-forge main
13+
cxx_compiler:
14+
- vs2022
15+
expat:
16+
- '2'
17+
freethreading:
18+
- 'no'
19+
libffi:
20+
- '3.5'
21+
liblzma_devel:
22+
- '5'
23+
libsqlite:
24+
- '3'
25+
openssl:
26+
- '3.5'
27+
pin_run_as_build:
28+
python:
29+
min_pin: x.x
30+
max_pin: x.x
31+
python:
32+
- '3.14'
33+
target_platform:
34+
- win-arm64
35+
tk:
36+
- '8.6'
37+
zip_keys:
38+
- - build_type
39+
- channel_targets
40+
zlib:
41+
- '1'
42+
zstd:
43+
- '1.5'
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
build_type:
2+
- release
3+
bzip2:
4+
- '1'
5+
c_compiler:
6+
- vs2022
7+
c_stdlib:
8+
- vs
9+
channel_sources:
10+
- conda-forge/label/python_rc,conda-forge
11+
channel_targets:
12+
- conda-forge main
13+
cxx_compiler:
14+
- vs2022
15+
expat:
16+
- '2'
17+
freethreading:
18+
- 'yes'
19+
libffi:
20+
- '3.5'
21+
liblzma_devel:
22+
- '5'
23+
libsqlite:
24+
- '3'
25+
openssl:
26+
- '3.5'
27+
pin_run_as_build:
28+
python:
29+
min_pin: x.x
30+
max_pin: x.x
31+
python:
32+
- '3.14'
33+
target_platform:
34+
- win-arm64
35+
tk:
36+
- '8.6'
37+
zip_keys:
38+
- - build_type
39+
- channel_targets
40+
zlib:
41+
- '1'
42+
zstd:
43+
- '1.5'

README.md

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

conda-forge.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ build_platform:
99
linux_aarch64: linux_64
1010
linux_ppc64le: linux_64
1111
osx_arm64: osx_64
12+
win_arm64: win_64
1213
conda_build:
1314
pkg_format: '2'
1415
conda_forge_output_validation: true

recipe/build_base.bat

Lines changed: 83 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,30 @@ setlocal EnableDelayedExpansion
22
echo on
33

44
:: Compile python, extensions and external libraries
5-
if "%ARCH%"=="64" (
6-
set PLATFORM=x64
7-
set VC_PATH=x64
8-
set BUILD_PATH=amd64
9-
) else (
10-
set PLATFORM=Win32
11-
set VC_PATH=x86
12-
set BUILD_PATH=win32
5+
if "%target_platform%"=="win-64" (
6+
set HOST_PLATFORM=x64
7+
set HOST_DIR=amd64
8+
)
9+
if "%target_platform%"=="win-32" (
10+
set HOST_PLATFORM=Win32
11+
set HOST_DIR=win32
12+
)
13+
if "%target_platform%"=="win-arm64" (
14+
set HOST_PLATFORM=ARM64
15+
set HOST_DIR=arm64
16+
)
17+
18+
if "%build_platform%"=="win-64" (
19+
set BUILD_PLATFORM=x64
20+
set BUILD_DIR=amd64
21+
)
22+
if "%build_platform%"=="win-32" (
23+
set BUILD_PLATFORM=Win32
24+
set BUILD_DIR=win32
25+
)
26+
if "%build_platform%"=="win-arm64" (
27+
set BUILD_PLATFORM=ARM64
28+
set BUILD_DIR=arm64
1329
)
1430

1531
for /F "tokens=1,2 delims=." %%i in ("%PKG_VERSION%") do (
@@ -37,11 +53,12 @@ if "%PY_INTERP_DEBUG%"=="yes" (
3753
set _D=
3854
)
3955

40-
56+
set PGO=--pgo
4157
if "%DEBUG_C%"=="yes" (
4258
set PGO=
43-
) else (
44-
set PGO=--pgo
59+
)
60+
if "%CONDA_BUILD_CROSS_COMPILATION%" == "1" (
61+
set PGO=
4562
)
4663

4764
if "%PY_FREETHREADING%" == "yes" (
@@ -56,27 +73,37 @@ if "%PY_FREETHREADING%" == "yes" (
5673

5774
cd PCbuild
5875

76+
setlocal EnableDelayedExpansion
77+
if "%CONDA_BUILD_CROSS_COMPILATION%" == "1" (
78+
REM build for the build platform. LIBRARY_PREFIX is used by the patches
79+
REM No PGO. No externals, i.e. remove building extension modules
80+
REM we don't need.
81+
set LIBRARY_PREFIX=%BUILD_PREFIX%\\Library
82+
call build.bat %CONFIG% %FREETHREADING% -m -E -v -p %BUILD_PLATFORM%
83+
if errorlevel 1 exit 1
84+
)
85+
endlocal
5986
:: Twice because:
6087
:: error : importlib_zipimport.h updated. You will need to rebuild pythoncore to see the changes.
61-
call build.bat %PGO% %CONFIG% %FREETHREADING% -m -e -v -p %PLATFORM%
62-
call build.bat %PGO% %CONFIG% %FREETHREADING% -m -e -v -p %PLATFORM%
88+
call build.bat %PGO% %CONFIG% %FREETHREADING% -m -e -v -p %HOST_PLATFORM%
89+
call build.bat %PGO% %CONFIG% %FREETHREADING% -m -e -v -p %HOST_PLATFORM%
6390
if errorlevel 1 exit 1
6491
cd ..
6592

6693
:: Populate the root package directory
6794
for %%x in (python%VERNODOTS%%THREAD%%_D%.dll python3%THREAD%%_D%.dll python%EXE_T%%_D%.exe pythonw%EXE_T%%_D%.exe) do (
68-
if exist %SRC_DIR%\PCbuild\%BUILD_PATH%\%%x (
69-
copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\%%x %PREFIX%
95+
if exist %SRC_DIR%\PCbuild\%HOST_DIR%\%%x (
96+
copy /Y %SRC_DIR%\PCbuild\%HOST_DIR%\%%x %PREFIX%
7097
) else (
71-
echo "WARNING :: %SRC_DIR%\PCbuild\%BUILD_PATH%\%%x does not exist"
98+
echo "WARNING :: %SRC_DIR%\PCbuild\%HOST_DIR%\%%x does not exist"
7299
)
73100
)
74101

75102
for %%x in (python%THREAD%%_D%.pdb python%VERNODOTS%%THREAD%%_D%.pdb pythonw%THREAD%%_D%.pdb) do (
76-
if exist %SRC_DIR%\PCbuild\%BUILD_PATH%\%%x (
77-
copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\%%x %PREFIX%
103+
if exist %SRC_DIR%\PCbuild\%HOST_DIR%\%%x (
104+
copy /Y %SRC_DIR%\PCbuild\%HOST_DIR%\%%x %PREFIX%
78105
) else (
79-
echo "WARNING :: %SRC_DIR%\PCbuild\%BUILD_PATH%\%%x does not exist"
106+
echo "WARNING :: %SRC_DIR%\PCbuild\%HOST_DIR%\%%x does not exist"
80107
)
81108
)
82109

@@ -87,7 +114,7 @@ if errorlevel 1 exit 1
87114

88115
:: Populate the DLLs directory
89116
mkdir %PREFIX%\DLLs
90-
xcopy /s /y %SRC_DIR%\PCBuild\%BUILD_PATH%\*.pyd %PREFIX%\DLLs\
117+
xcopy /s /y %SRC_DIR%\PCBuild\%HOST_DIR%\*.pyd %PREFIX%\DLLs\
91118
if errorlevel 1 exit 1
92119

93120
copy /Y %SRC_DIR%\PC\icons\py.ico %PREFIX%\DLLs\
@@ -129,12 +156,12 @@ for %%x in (idle pydoc) do (
129156

130157
:: Populate the libs directory
131158
if not exist %PREFIX%\libs mkdir %PREFIX%\libs
132-
dir %SRC_DIR%\PCbuild\%BUILD_PATH%\
133-
if exist %SRC_DIR%\PCbuild\%BUILD_PATH%\python%VERNODOTS%%THREAD%%_D%.lib copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\python%VERNODOTS%%THREAD%%_D%.lib %PREFIX%\libs\
159+
dir %SRC_DIR%\PCbuild\%HOST_DIR%\
160+
if exist %SRC_DIR%\PCbuild\%HOST_DIR%\python%VERNODOTS%%THREAD%%_D%.lib copy /Y %SRC_DIR%\PCbuild\%HOST_DIR%\python%VERNODOTS%%THREAD%%_D%.lib %PREFIX%\libs\
134161
if errorlevel 1 exit 1
135-
if exist %SRC_DIR%\PCbuild\%BUILD_PATH%\python3%THREAD%%_D%.lib copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\python3%THREAD%%_D%.lib %PREFIX%\libs\
162+
if exist %SRC_DIR%\PCbuild\%HOST_DIR%\python3%THREAD%%_D%.lib copy /Y %SRC_DIR%\PCbuild\%HOST_DIR%\python3%THREAD%%_D%.lib %PREFIX%\libs\
136163
if errorlevel 1 exit 1
137-
if exist %SRC_DIR%\PCbuild\%BUILD_PATH%\_tkinter%THREAD%%_D%.lib copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\_tkinter%THREAD%%_D%.lib %PREFIX%\libs\
164+
if exist %SRC_DIR%\PCbuild\%HOST_DIR%\_tkinter%THREAD%%_D%.lib copy /Y %SRC_DIR%\PCbuild\%HOST_DIR%\_tkinter%THREAD%%_D%.lib %PREFIX%\libs\
138165
if errorlevel 1 exit 1
139166

140167

@@ -145,20 +172,20 @@ if errorlevel 1 exit 1
145172

146173
:: Copy venv[w]launcher scripts to venv\srcipts\nt
147174
:: See https://github.com/python/cpython/blob/b4a316087c32d83e375087fd35fc511bc430ee8b/Lib/venv/__init__.py#L334-L376
148-
if exist %SRC_DIR%\PCbuild\%BUILD_PATH%\venvlauncher%THREAD%%_D%.exe (
175+
if exist %SRC_DIR%\PCbuild\%HOST_DIR%\venvlauncher%THREAD%%_D%.exe (
149176
@rem We did copy pythonw.exe until 3.12 but starting with 3.13 we seem to need the latter. Should we omit the first?
150-
copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\venvlauncher%THREAD%%_D%.exe %PREFIX%\Lib\venv\scripts\nt\python.exe
151-
copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\venvlauncher%THREAD%%_D%.exe %PREFIX%\Lib\venv\scripts\nt\venvlauncher%THREAD%%_D%.exe
177+
copy /Y %SRC_DIR%\PCbuild\%HOST_DIR%\venvlauncher%THREAD%%_D%.exe %PREFIX%\Lib\venv\scripts\nt\python.exe
178+
copy /Y %SRC_DIR%\PCbuild\%HOST_DIR%\venvlauncher%THREAD%%_D%.exe %PREFIX%\Lib\venv\scripts\nt\venvlauncher%THREAD%%_D%.exe
152179
) else (
153-
echo "WARNING :: %SRC_DIR%\PCbuild\%BUILD_PATH%\venvlauncher%THREAD%%_D%.exe does not exist"
180+
echo "WARNING :: %SRC_DIR%\PCbuild\%HOST_DIR%\venvlauncher%THREAD%%_D%.exe does not exist"
154181
)
155182

156-
if exist %SRC_DIR%\PCbuild\%BUILD_PATH%\venvwlauncher%THREAD%%_D%.exe (
183+
if exist %SRC_DIR%\PCbuild\%HOST_DIR%\venvwlauncher%THREAD%%_D%.exe (
157184
@rem We did copy pythonw.exe until 3.12 but starting with 3.13 we seem to need the latter. Should we omit the first?
158-
copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\venvwlauncher%THREAD%%_D%.exe %PREFIX%\Lib\venv\scripts\nt\pythonw.exe
159-
copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\venvwlauncher%THREAD%%_D%.exe %PREFIX%\Lib\venv\scripts\nt\venvwlauncher%THREAD%%_D%.exe
185+
copy /Y %SRC_DIR%\PCbuild\%HOST_DIR%\venvwlauncher%THREAD%%_D%.exe %PREFIX%\Lib\venv\scripts\nt\pythonw.exe
186+
copy /Y %SRC_DIR%\PCbuild\%HOST_DIR%\venvwlauncher%THREAD%%_D%.exe %PREFIX%\Lib\venv\scripts\nt\venvwlauncher%THREAD%%_D%.exe
160187
) else (
161-
echo "WARNING :: %SRC_DIR%\PCbuild\%BUILD_PATH%\venvwlauncher%THREAD%%_D%.exe does not exist"
188+
echo "WARNING :: %SRC_DIR%\PCbuild\%HOST_DIR%\venvwlauncher%THREAD%%_D%.exe does not exist"
162189
)
163190

164191
:: Remove test data to save space.
@@ -178,30 +205,37 @@ if errorlevel 1 exit 1
178205
if "%_D%" neq "" copy %PREFIX%\python%_D%.exe %PREFIX%\python.exe
179206
if "%EXE_T%" neq "" copy %PREFIX%\python%EXE_T%.exe %PREFIX%\python.exe
180207

208+
if "%CONDA_BUILD_CROSS_COMPILATION%" == "1" (
209+
set "PYTHON=%SRC_DIR%\PCbuild\%BUILD_DIR%\\python%EXE_T%%_D%.exe"
210+
) else (
211+
set "PYTHON=%PREFIX%\python.exe"
212+
)
181213
:: bytecode compile the standard library
182-
%PREFIX%\python.exe -Wi %PREFIX%\Lib\compileall.py -f -q -x "bad_coding|badsyntax|py2_" %PREFIX%\Lib
214+
%PYTHON% -Wi %PREFIX%\Lib\compileall.py -f -q -x "bad_coding|badsyntax|py2_" %PREFIX%\Lib
183215
if errorlevel 1 exit 1
184216

185217
:: Ensure that scripts are generated
186218
:: https://github.com/conda-forge/python-feedstock/issues/384
187-
%PREFIX%\python.exe %RECIPE_DIR%\fix_staged_scripts.py
219+
%PYTHON% %RECIPE_DIR%\fix_staged_scripts.py
188220
if errorlevel 1 exit 1
189221

190-
:: Some quick tests for common failures
191-
echo "Testing print() does not print: Hello"
192-
%PREFIX%\python.exe -c "print()" 2>&1 | findstr /r /c:"Hello"
193-
if %errorlevel% neq 1 exit /b 1
222+
if NOT "%CONDA_BUILD_CROSS_COMPILATION%" == "1" (
223+
REM Some quick tests for common failures
224+
echo "Testing print() does not print: Hello"
225+
%PREFIX%\python.exe -c "print()" 2>&1 | findstr /r /c:"Hello"
226+
if %errorlevel% neq 1 exit /b 1
194227

195-
echo "Testing print('Hello') prints: Hello"
196-
%PREFIX%\python.exe -c "print('Hello')" 2>&1 | findstr /r /c:"Hello"
197-
if %errorlevel% neq 0 exit /b 1
228+
echo "Testing print('Hello') prints: Hello"
229+
%PREFIX%\python.exe -c "print('Hello')" 2>&1 | findstr /r /c:"Hello"
230+
if %errorlevel% neq 0 exit /b 1
198231

199-
echo "Testing import of os (no DLL needed) does not print: The specified module could not be found"
200-
%PREFIX%\python.exe -v -c "import os" 2>&1
201-
%PREFIX%\python.exe -v -c "import os" 2>&1 | findstr /r /c:"The specified module could not be found"
202-
if %errorlevel% neq 1 exit /b 1
232+
echo "Testing import of os (no DLL needed) does not print: The specified module could not be found"
233+
%PREFIX%\python.exe -v -c "import os" 2>&1
234+
%PREFIX%\python.exe -v -c "import os" 2>&1 | findstr /r /c:"The specified module could not be found"
235+
if %errorlevel% neq 1 exit /b 1
203236

204-
echo "Testing import of _sqlite3 (DLL located via PATH needed) does not print: The specified module could not be found"
205-
%PREFIX%\python.exe -v -c "import _sqlite3" 2>&1
206-
%PREFIX%\python.exe -v -c "import _sqlite3" 2>&1 | findstr /r /c:"The specified module could not be found"
207-
if %errorlevel% neq 1 exit /b 1
237+
echo "Testing import of _sqlite3 (DLL located via PATH needed) does not print: The specified module could not be found"
238+
%PREFIX%\python.exe -v -c "import _sqlite3" 2>&1
239+
%PREFIX%\python.exe -v -c "import _sqlite3" 2>&1 | findstr /r /c:"The specified module could not be found"
240+
if %errorlevel% neq 1 exit /b 1
241+
)

recipe/meta.yaml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -163,19 +163,19 @@ outputs:
163163
- llvm-tools-19 # [not win]
164164
- clang 19.* # [win]
165165
- llvm-tools 19.* # [win]
166-
- bzip2 # [build_platform != target_platform]
167-
- libsqlite # [build_platform != target_platform]
168-
- liblzma-devel # [build_platform != target_platform]
169-
- zlib # [build_platform != target_platform]
170-
- zstd # [build_platform != target_platform]
171-
- openssl # [build_platform != target_platform]
172-
- readline # [not win and build_platform != target_platform]
173-
- tk # [build_platform != target_platform]
174-
- ncurses # [unix and build_platform != target_platform]
175-
- libffi # [build_platform != target_platform]
176-
- libuuid # [linux and build_platform != target_platform]
177-
- libxcrypt # [linux and build_platform != target_platform]
178-
- expat # [build_platform != target_platform]
166+
- bzip2 # [build_platform != target_platform]
167+
- libsqlite # [build_platform != target_platform]
168+
- liblzma-devel # [build_platform != target_platform]
169+
- zlib # [build_platform != target_platform]
170+
- zstd # [build_platform != target_platform]
171+
- openssl # [build_platform != target_platform]
172+
- readline # [not win and build_platform != target_platform]
173+
- tk # [build_platform != target_platform]
174+
- ncurses # [unix and build_platform != target_platform]
175+
- libffi # [build_platform != target_platform]
176+
- libuuid # [linux and build_platform != target_platform]
177+
- libmpdec-devel # [build_platform != target_platform]
178+
- expat # [build_platform != target_platform]
179179
host:
180180
- bzip2
181181
- libsqlite

recipe/patches/0001-Win32-Change-FD_SETSIZE-from-512-to-2048.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
From 3dff368f2f15764584cd9d90234ae7e8248e4e4d Mon Sep 17 00:00:00 2001
1+
From f08d8a962782a81d96f1b4eae2349e99761f625c Mon Sep 17 00:00:00 2001
22
From: Ray Donnelly <mingw.android@gmail.com>
33
Date: Wed, 16 Aug 2017 11:53:55 +0100
44
Subject: [PATCH 01/26] Win32: Change FD_SETSIZE from 512 to 2048

0 commit comments

Comments
 (0)