88
99env :
1010 PYTHON_VERSION : 3.12.12
11- PYTHON_WINDOWS_VERSION : 3.12.10
1211 PYTHON_VERSION_SHORT : 3.12
1312 PYTHON_DIST_RELEASE : 20260203
1413
1514jobs :
16- build-darwin :
17- name : Build Python for iOS and macOS
18- runs-on : macos-15
19- permissions :
20- contents : write
15+ # build-darwin:
16+ # name: Build Python for iOS and macOS
17+ # runs-on: macos-15
18+ # permissions:
19+ # contents: write
2120
22- steps :
23- - name : Checkout
24- uses : actions/checkout@v4
21+ # steps:
22+ # - name: Checkout
23+ # uses: actions/checkout@v4
2524
26- - name : Setup Python
27- uses : actions/setup-python@v6
28- with :
29- python-version : ${{ env.PYTHON_VERSION_SHORT }}
25+ # - name: Setup Python
26+ # uses: actions/setup-python@v6
27+ # with:
28+ # python-version: ${{ env.PYTHON_VERSION_SHORT }}
3029
31- - name : Show Python version
32- run : python --version
30+ # - name: Show Python version
31+ # run: python --version
3332
34- - name : Build Python for iOS and macOS
35- working-directory : darwin
36- shell : bash
37- run : |
38- git clone --branch="$PYTHON_VERSION_SHORT" https://github.com/beeware/Python-Apple-support.git
39- mkdir -p dist
33+ # - name: Build Python for iOS and macOS
34+ # working-directory: darwin
35+ # shell: bash
36+ # run: |
37+ # git clone --branch="$PYTHON_VERSION_SHORT" https://github.com/beeware/Python-Apple-support.git
38+ # mkdir -p dist
4039
41- pushd Python-Apple-support
42- make iOS
43- tar -czf ../dist/python-ios-mobile-forge-$PYTHON_VERSION_SHORT.tar.gz install support -C .
44- make macOS
45- popd
40+ # pushd Python-Apple-support
41+ # make iOS
42+ # tar -czf ../dist/python-ios-mobile-forge-$PYTHON_VERSION_SHORT.tar.gz install support -C .
43+ # make macOS
44+ # popd
4645
47- bash ./package-ios-for-dart.sh Python-Apple-support "$PYTHON_VERSION_SHORT"
48- bash ./package-macos-for-dart.sh Python-Apple-support "$PYTHON_VERSION_SHORT"
46+ # bash ./package-ios-for-dart.sh Python-Apple-support "$PYTHON_VERSION_SHORT"
47+ # bash ./package-macos-for-dart.sh Python-Apple-support "$PYTHON_VERSION_SHORT"
4948
50- - name : Upload Darwin build artifacts
51- uses : actions/upload-artifact@v4
52- with :
53- name : python-darwin
54- path : darwin/dist/python-*.tar.gz
55- if-no-files-found : error
49+ # - name: Upload Darwin build artifacts
50+ # uses: actions/upload-artifact@v4
51+ # with:
52+ # name: python-darwin
53+ # path: darwin/dist/python-*.tar.gz
54+ # if-no-files-found: error
5655
57- build-android :
58- name : Build Python for Android
59- runs-on : ubuntu-latest
60- permissions :
61- contents : write
62- steps :
63- - uses : actions/checkout@v4
64- - uses : actions/setup-python@v5
65- with :
66- python-version : ${{ env.PYTHON_VERSION }}
67- - run : python --version
68- - working-directory : android
69- shell : bash
70- run : |
71- bash ./build-all.sh "$PYTHON_VERSION"
72- mkdir -p dist
73- tar -czf dist/python-android-mobile-forge-$PYTHON_VERSION_SHORT.tar.gz install support
74- bash ./package-for-dart.sh install "$PYTHON_VERSION" arm64-v8a
75- bash ./package-for-dart.sh install "$PYTHON_VERSION" armeabi-v7a
76- bash ./package-for-dart.sh install "$PYTHON_VERSION" x86_64
77- - uses : actions/upload-artifact@v4
78- with :
79- name : python-android
80- path : android/dist/python-android-*.tar.gz
81- if-no-files-found : error
56+ # build-android:
57+ # name: Build Python for Android
58+ # runs-on: ubuntu-latest
59+ # permissions:
60+ # contents: write
61+ # steps:
62+ # - uses: actions/checkout@v4
63+ # - uses: actions/setup-python@v5
64+ # with:
65+ # python-version: ${{ env.PYTHON_VERSION }}
66+ # - run: python --version
67+ # - working-directory: android
68+ # shell: bash
69+ # run: |
70+ # bash ./build-all.sh "$PYTHON_VERSION"
71+ # mkdir -p dist
72+ # tar -czf dist/python-android-mobile-forge-$PYTHON_VERSION_SHORT.tar.gz install support
73+ # bash ./package-for-dart.sh install "$PYTHON_VERSION" arm64-v8a
74+ # bash ./package-for-dart.sh install "$PYTHON_VERSION" armeabi-v7a
75+ # bash ./package-for-dart.sh install "$PYTHON_VERSION" x86_64
76+ # - uses: actions/upload-artifact@v4
77+ # with:
78+ # name: python-android
79+ # path: android/dist/python-android-*.tar.gz
80+ # if-no-files-found: error
8281
83- build-linux :
84- name : Build Python for Linux
85- runs-on : ubuntu-latest
86- permissions :
87- contents : write
88- steps :
89- - uses : actions/checkout@v4
90- - working-directory : linux
91- shell : bash
92- run : |
93- bash ./package-for-linux.sh x86_64 "_v2"
94- bash ./package-for-linux.sh aarch64 ""
95- - uses : actions/upload-artifact@v4
96- with :
97- name : python-linux
98- path : linux/python-linux-dart-*.tar.gz
99- if-no-files-found : error
82+ # build-linux:
83+ # name: Build Python for Linux
84+ # runs-on: ubuntu-latest
85+ # permissions:
86+ # contents: write
87+ # steps:
88+ # - uses: actions/checkout@v4
89+ # - working-directory: linux
90+ # shell: bash
91+ # run: |
92+ # bash ./package-for-linux.sh x86_64 "_v2"
93+ # bash ./package-for-linux.sh aarch64 ""
94+ # - uses: actions/upload-artifact@v4
95+ # with:
96+ # name: python-linux
97+ # path: linux/python-linux-dart-*.tar.gz
98+ # if-no-files-found: error
10099
101100 build-windows :
102101 name : Build Python for Windows
@@ -105,14 +104,111 @@ jobs:
105104 contents : write
106105 steps :
107106 - uses : actions/checkout@v4
108- - name : Install requested Python version
109- working-directory : windows
110- shell : cmd
107+ - name : Build CPython from sources and package for Dart
108+ shell : pwsh
111109 run : |
112- curl -OL https://www.python.org/ftp/python/${{ env.PYTHON_WINDOWS_VERSION }}/python-${{ env.PYTHON_WINDOWS_VERSION }}-amd64.exe
113- start /wait python-${{ env.PYTHON_WINDOWS_VERSION }}-amd64.exe /quiet
114- C:\python312-dist\python -m compileall -b C:\python312-dist\Lib
115- 7z a -xr@exclude.txt python-windows-for-dart-%PYTHON_VERSION_SHORT%.zip C:\python312-dist\*
110+ $ErrorActionPreference = "Stop"
111+
112+ $pyVer = "${{ env.PYTHON_VERSION }}"
113+ $pyShort = "${{ env.PYTHON_VERSION_SHORT }}"
114+ $workspace = $env:GITHUB_WORKSPACE
115+
116+ $srcRoot = Join-Path $workspace "windows\build"
117+ $srcArchive = Join-Path $srcRoot "Python-$pyVer.tgz"
118+ $srcDir = Join-Path $srcRoot "Python-$pyVer"
119+ $pcbuildDir = Join-Path $srcDir "PCbuild\amd64"
120+
121+ $packageRoot = Join-Path $workspace "windows\python-windows-for-dart-$pyShort"
122+ $zipPath = Join-Path $workspace "windows\python-windows-for-dart-$pyShort.zip"
123+
124+ New-Item -ItemType Directory -Force -Path $srcRoot | Out-Null
125+
126+ Write-Host "Downloading CPython source $pyVer"
127+ Invoke-WebRequest -Uri "https://www.python.org/ftp/python/$pyVer/Python-$pyVer.tgz" -OutFile $srcArchive
128+ tar -xf $srcArchive -C $srcRoot
129+
130+ Push-Location $srcDir
131+ cmd /c "PCbuild\build.bat -e -p x64 -c Release"
132+ cmd /c "PCbuild\build.bat -e -p x64 -c Debug"
133+ Pop-Location
134+
135+ Remove-Item -Recurse -Force $packageRoot -ErrorAction SilentlyContinue
136+ New-Item -ItemType Directory -Force -Path "$packageRoot\DLLs", "$packageRoot\include", "$packageRoot\Lib", "$packageRoot\libs", "$packageRoot\Scripts" | Out-Null
137+
138+ Copy-Item -Path "$srcDir\Include\*" -Destination "$packageRoot\include" -Recurse -Force
139+ Copy-Item -Path "$srcDir\Lib\*" -Destination "$packageRoot\Lib" -Recurse -Force
140+
141+ # Root binaries and symbols.
142+ foreach ($name in @("LICENSE.txt", "NEWS.txt")) {
143+ $src = Join-Path $srcDir $name
144+ if (Test-Path $src) {
145+ Copy-Item -Path $src -Destination $packageRoot -Force
146+ }
147+ }
148+
149+ $rootFiles = @(
150+ "python3.dll",
151+ "python3_d.dll",
152+ "python312.dll",
153+ "python312_d.dll",
154+ "python312_d.pdb",
155+ "python_d.pdb",
156+ "pythonw_d.pdb"
157+ )
158+ foreach ($name in $rootFiles) {
159+ $src = Join-Path $pcbuildDir $name
160+ if (Test-Path $src) {
161+ Copy-Item -Path $src -Destination $packageRoot -Force
162+ }
163+ }
164+
165+ foreach ($name in @("vcruntime140.dll", "vcruntime140_1.dll")) {
166+ $fromBuild = Join-Path $pcbuildDir $name
167+ $fromSystem = Join-Path "$env:WINDIR\System32" $name
168+ if (Test-Path $fromBuild) {
169+ Copy-Item -Path $fromBuild -Destination $packageRoot -Force
170+ } elseif (Test-Path $fromSystem) {
171+ Copy-Item -Path $fromSystem -Destination $packageRoot -Force
172+ }
173+ }
174+
175+ # Extension modules and supporting DLLs.
176+ Get-ChildItem -Path $pcbuildDir -Filter "*.pyd" -File | Copy-Item -Destination "$packageRoot\DLLs" -Force
177+ Get-ChildItem -Path $pcbuildDir -Filter "*.dll" -File |
178+ Where-Object { $_.Name -notin @("python3.dll", "python3_d.dll", "python312.dll", "python312_d.dll", "vcruntime140.dll", "vcruntime140_1.dll") } |
179+ Copy-Item -Destination "$packageRoot\DLLs" -Force
180+ Get-ChildItem -Path $pcbuildDir -Filter "*.lib" -File | Copy-Item -Destination "$packageRoot\libs" -Force
181+
182+ # Match existing packaging behavior: bytecode-only stdlib.
183+ py -3 -m compileall -b "$packageRoot\Lib"
184+ Get-ChildItem -Path "$packageRoot\Lib" -Recurse -File -Include *.py,*.typed | Remove-Item -Force
185+ Get-ChildItem -Path "$packageRoot\Lib" -Recurse -Directory -Filter __pycache__ | Remove-Item -Recurse -Force
186+
187+ # Fail fast if required layout entries are missing.
188+ $requiredEntries = @(
189+ "$packageRoot\DLLs",
190+ "$packageRoot\include",
191+ "$packageRoot\Lib",
192+ "$packageRoot\libs",
193+ "$packageRoot\Scripts",
194+ "$packageRoot\LICENSE.txt",
195+ "$packageRoot\NEWS.txt",
196+ "$packageRoot\python3.dll",
197+ "$packageRoot\python3_d.dll",
198+ "$packageRoot\python312.dll",
199+ "$packageRoot\python312_d.dll",
200+ "$packageRoot\python312_d.pdb",
201+ "$packageRoot\python_d.pdb",
202+ "$packageRoot\pythonw_d.pdb"
203+ )
204+ foreach ($entry in $requiredEntries) {
205+ if (-not (Test-Path $entry)) {
206+ throw "Missing required package entry: $entry"
207+ }
208+ }
209+
210+ Remove-Item -Force $zipPath -ErrorAction SilentlyContinue
211+ 7z a $zipPath "$packageRoot\*"
116212 - uses : actions/upload-artifact@v4
117213 with :
118214 name : python-windows
0 commit comments