Skip to content

Commit 60a6830

Browse files
zoobahugovk
andauthored
Add support for new build layout in Windows free-threaded builds (#373)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
1 parent 86d9bf8 commit 60a6830

5 files changed

Lines changed: 80 additions & 33 deletions

File tree

windows-release/azure-pipelines.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ parameters:
4242
displayName: "Signature description"
4343
type: string
4444
default: '(default)'
45+
- name: Post315OutputDir
46+
displayName: "Separate free-threaded outputs (3.15 and later)"
47+
type: boolean
48+
default: false
4549
- name: DoTailCalling
4650
displayName: "Build with tail-calling support (3.15 and later)"
4751
type: boolean
@@ -196,6 +200,8 @@ stages:
196200
TailCallingOption: ''
197201
${{ else }}:
198202
TailCallingOption: '--tail-call-interp'
203+
Post315OutputDir: ${{ parameters.Post315OutputDir }}
204+
199205
- stage: Sign
200206
displayName: Sign binaries
201207
dependsOn: Build
@@ -269,6 +275,7 @@ stages:
269275
DoARM64: ${{ parameters.DoARM64}}
270276
DoFreethreaded: ${{ parameters.DoFreethreaded }}
271277
SigningCertificate: ${{ iif(eq(parameters.SigningCertificate, 'Unsigned'), '', parameters.SigningCertificate) }}
278+
Post315OutputDir: ${{ parameters.Post315OutputDir }}
272279
- ${{ if eq(parameters.DoMSIX, 'true') }}:
273280
- template: stage-pack-msix.yml
274281
parameters:

windows-release/build-steps-pgo.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ steps:
3131
- ${{ if ne(parameters.PGRun, 'true') }}:
3232
# Not running in this job, so we publish our entire build and object files
3333

34-
- publish: '$(Build.BinariesDirectory)\bin\$(Arch)\instrumented'
34+
- publish: '$(Build.BinariesDirectory)\bin\$(ArchDir)\instrumented'
3535
artifact: instrumented_bin_$(Name)
3636
displayName: 'Publish binaries for profiling'
3737

@@ -54,10 +54,10 @@ steps:
5454
inputs:
5555
buildType: current
5656
artifact: instrumented_bin_$(Name)
57-
targetPath: '$(Build.BinariesDirectory)\bin\$(Arch)\instrumented'
57+
targetPath: '$(Build.BinariesDirectory)\bin\$(ArchDir)\instrumented'
5858

5959
- powershell: |
60-
$exe = (gci "$(Build.BinariesDirectory)\bin\$(Arch)\instrumented\$(PythonExePattern)" | select -First 1)
60+
$exe = (gci "$(Build.BinariesDirectory)\bin\$(ArchDir)\instrumented\$(PythonExePattern)" | select -First 1)
6161
& $exe -m test --pgo
6262
ignoreLASTEXITCODE: true
6363
displayName: 'Collect profile'
@@ -67,7 +67,7 @@ steps:
6767
6868
- ${{ if ne(parameters.PGUpdate, 'true') }}:
6969
# Not finishing in this job, so publish the binaries
70-
- publish: '$(Build.BinariesDirectory)\bin\$(Arch)\instrumented'
70+
- publish: '$(Build.BinariesDirectory)\bin\$(ArchDir)\instrumented'
7171
artifact: profile_bin_$(Name)
7272
displayName: 'Publish collected data and binaries'
7373

@@ -80,7 +80,7 @@ steps:
8080
inputs:
8181
buildType: current
8282
artifact: profile_bin_$(Name)
83-
targetPath: '$(Build.BinariesDirectory)\bin\$(Arch)\instrumented'
83+
targetPath: '$(Build.BinariesDirectory)\bin\$(ArchDir)\instrumented'
8484

8585
- task: DownloadPipelineArtifact@2
8686
displayName: 'Download artifact: instrumented_obj_$(Name)'
@@ -125,20 +125,20 @@ steps:
125125
}
126126
displayName: 'Generate catalog'
127127
env:
128-
CAT: $(Build.BinariesDirectory)\bin\$(Arch)\python
128+
CAT: $(Build.BinariesDirectory)\bin\$(ArchDir)\python
129129
PYTHON_HEXVERSION: $(VersionHex)
130130
131131
- powershell: |
132132
del instrumented -r -EA 0
133133
del *.pgc, *.pgd, *.exp
134134
displayName: 'Cleanup build'
135-
workingDirectory: '$(Build.BinariesDirectory)\bin\$(Arch)'
135+
workingDirectory: '$(Build.BinariesDirectory)\bin\$(ArchDir)'
136136
137137
- powershell: |
138138
copy "$(Build.SourcesDirectory)\Lib\venv\scripts\common\Activate.ps1" .
139139
displayName: 'Copy Powershell scripts from source'
140-
workingDirectory: '$(Build.BinariesDirectory)\bin\$(Arch)'
140+
workingDirectory: '$(Build.BinariesDirectory)\bin\$(ArchDir)'
141141
142-
- publish: '$(Build.BinariesDirectory)\bin\$(Arch)'
142+
- publish: '$(Build.BinariesDirectory)\bin\$(ArchDir)'
143143
artifact: $(Artifact)
144144
displayName: 'Publish binaries'

windows-release/build-steps.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,19 @@ steps:
5252
}
5353
displayName: 'Generate catalog'
5454
env:
55-
CAT: $(Build.BinariesDirectory)\bin\$(Arch)\python
55+
CAT: $(Build.BinariesDirectory)\bin\$(ArchDir)\python
5656
PYTHON_HEXVERSION: $(VersionHex)
5757

5858
- powershell: |
5959
del *.pgc, *.pgd, *.exp
6060
displayName: 'Cleanup binaries'
61-
workingDirectory: '$(Build.BinariesDirectory)\bin\$(Arch)'
61+
workingDirectory: '$(Build.BinariesDirectory)\bin\$(ArchDir)'
6262

6363
- powershell: |
6464
copy "$(Build.SourcesDirectory)\Lib\venv\scripts\common\Activate.ps1" .
6565
displayName: 'Copy Powershell scripts from source'
66-
workingDirectory: '$(Build.BinariesDirectory)\bin\$(Arch)'
66+
workingDirectory: '$(Build.BinariesDirectory)\bin\$(ArchDir)'
6767

68-
- publish: '$(Build.BinariesDirectory)\bin\$(Arch)'
68+
- publish: '$(Build.BinariesDirectory)\bin\$(ArchDir)'
6969
artifact: $(Artifact)
7070
displayName: 'Publish binaries'

windows-release/stage-build.yml

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ parameters:
77
ExtraOptions: ''
88
ExtraOptionsFreethreaded: '--disable-gil'
99
TailCallingOption: ''
10+
Post315OutputDir: false
1011

1112
jobs:
1213
- job: Build_Docs
@@ -49,6 +50,7 @@ jobs:
4950
win32:
5051
Name: win32
5152
Arch: win32
53+
ArchDir: win32
5254
Platform: x86
5355
Configuration: Release
5456
_HostPython: .\python
@@ -60,6 +62,7 @@ jobs:
6062
win32_d:
6163
Name: win32_d
6264
Arch: win32
65+
ArchDir: win32
6366
Platform: x86
6467
Configuration: Debug
6568
_HostPython: .\python
@@ -69,6 +72,7 @@ jobs:
6972
amd64:
7073
Name: amd64
7174
Arch: amd64
75+
ArchDir: amd64
7276
Platform: x64
7377
Configuration: Release
7478
_HostPython: .\python
@@ -80,6 +84,7 @@ jobs:
8084
amd64_d:
8185
Name: amd64_d
8286
Arch: amd64
87+
ArchDir: amd64
8388
Platform: x64
8489
Configuration: Debug
8590
_HostPython: .\python
@@ -89,6 +94,7 @@ jobs:
8994
arm64:
9095
Name: arm64
9196
Arch: arm64
97+
ArchDir: arm64
9298
Platform: ARM64
9399
Configuration: Release
94100
_HostPython: python
@@ -100,6 +106,7 @@ jobs:
100106
arm64_d:
101107
Name: arm64_d
102108
Arch: arm64
109+
ArchDir: arm64
103110
Platform: ARM64
104111
Configuration: Debug
105112
_HostPython: python
@@ -109,6 +116,7 @@ jobs:
109116
win32_t:
110117
Name: win32_t
111118
Arch: win32
119+
ArchDir: ${{ iif(eq(parameters.Post315OutputDir, 'true'), 'win32t', 'win32') }}
112120
Platform: x86
113121
Configuration: Release
114122
_HostPython: .\python
@@ -120,6 +128,7 @@ jobs:
120128
win32_td:
121129
Name: win32_td
122130
Arch: win32
131+
ArchDir: ${{ iif(eq(parameters.Post315OutputDir, 'true'), 'win32t', 'win32') }}
123132
Platform: x86
124133
Configuration: Debug
125134
_HostPython: .\python
@@ -129,6 +138,7 @@ jobs:
129138
amd64_t:
130139
Name: amd64_t
131140
Arch: amd64
141+
ArchDir: ${{ iif(eq(parameters.Post315OutputDir, 'true'), 'amd64t', 'amd64') }}
132142
Platform: x64
133143
Configuration: Release
134144
_HostPython: .\python
@@ -140,6 +150,7 @@ jobs:
140150
amd64_td:
141151
Name: amd64_td
142152
Arch: amd64
153+
ArchDir: ${{ iif(eq(parameters.Post315OutputDir, 'true'), 'amd64t', 'amd64') }}
143154
Platform: x64
144155
Configuration: Debug
145156
_HostPython: .\python
@@ -149,6 +160,7 @@ jobs:
149160
arm64_t:
150161
Name: arm64_t
151162
Arch: arm64
163+
ArchDir: ${{ iif(eq(parameters.Post315OutputDir, 'true'), 'arm64t', 'arm64') }}
152164
Platform: ARM64
153165
Configuration: Release
154166
_HostPython: python
@@ -160,6 +172,7 @@ jobs:
160172
arm64_td:
161173
Name: arm64_td
162174
Arch: arm64
175+
ArchDir: ${{ iif(eq(parameters.Post315OutputDir, 'true'), 'arm64t', 'arm64') }}
163176
Platform: ARM64
164177
Configuration: Debug
165178
_HostPython: python
@@ -183,6 +196,7 @@ jobs:
183196
amd64:
184197
Name: amd64
185198
Arch: amd64
199+
ArchDir: amd64
186200
Platform: x64
187201
_HostPython: .\python
188202
PythonExePattern: python.exe
@@ -195,9 +209,10 @@ jobs:
195209
amd64_t:
196210
Name: amd64_t
197211
Arch: amd64
212+
ArchDir: ${{ iif(eq(parameters.Post315OutputDir, 'true'), 'amd64t', 'amd64') }}
198213
Platform: x64
199214
_HostPython: .\python
200-
PythonExePattern: python3*t.exe
215+
PythonExePattern: ${{ iif(eq(parameters.Post315OutputDir, 'true'), 'python.exe', 'python3*t.exe') }}
201216
ExtraOptions: ${{ parameters.ExtraOptionsFreethreaded }} ${{ parameters.TailCallingOption }}
202217
${{ if eq(parameters.ToBeSigned, 'true') }}:
203218
Artifact: unsigned_amd64_t
@@ -220,14 +235,15 @@ jobs:
220235
clean: all
221236

222237
variables:
223-
Arch: arm64
224238
Platform: ARM64
225239
_HostPython: python
226240

227241
strategy:
228242
matrix:
229243
arm64:
230244
Name: arm64
245+
Arch: arm64
246+
ArchDir: arm64
231247
PythonExePattern: python.exe
232248
ExtraOptions: ${{ parameters.ExtraOptions }}
233249
${{ if eq(parameters.ToBeSigned, 'true') }}:
@@ -237,7 +253,9 @@ jobs:
237253
${{ if eq(parameters.DoFreethreaded, 'true') }}:
238254
arm64_t:
239255
Name: arm64_t
240-
PythonExePattern: python3*t.exe
256+
Arch: arm64
257+
ArchDir: ${{ iif(eq(parameters.Post315OutputDir, 'true'), 'arm64t', 'arm64') }}
258+
PythonExePattern: ${{ iif(eq(parameters.Post315OutputDir, 'true'), 'python.exe', 'python3*t.exe') }}
241259
ExtraOptions: ${{ parameters.ExtraOptionsFreethreaded }}
242260
${{ if eq(parameters.ToBeSigned, 'true') }}:
243261
Artifact: unsigned_arm64_t
@@ -263,13 +281,14 @@ jobs:
263281
clean: all
264282

265283
variables:
266-
Arch: arm64
267284
Platform: ARM64
268285

269286
strategy:
270287
matrix:
271288
arm64:
272289
Name: arm64
290+
Arch: arm64
291+
ArchDir: arm64
273292
PythonExePattern: python.exe
274293
${{ if eq(parameters.ToBeSigned, 'true') }}:
275294
Artifact: unsigned_arm64
@@ -278,7 +297,9 @@ jobs:
278297
${{ if eq(parameters.DoFreethreaded, 'true') }}:
279298
arm64_t:
280299
Name: arm64_t
281-
PythonExePattern: python3*t.exe
300+
Arch: arm64
301+
ArchDir: ${{ iif(eq(parameters.Post315OutputDir, 'true'), 'arm64t', 'arm64') }}
302+
PythonExePattern: ${{ iif(eq(parameters.Post315OutputDir, 'true'), 'python.exe', 'python3*t.exe') }}
282303
${{ if eq(parameters.ToBeSigned, 'true') }}:
283304
Artifact: unsigned_arm64_t
284305
${{ else }}:
@@ -297,14 +318,15 @@ jobs:
297318
clean: all
298319

299320
variables:
300-
Arch: arm64
301321
Platform: ARM64
302322
_HostPython: python
303323

304324
strategy:
305325
matrix:
306326
arm64:
307327
Name: arm64
328+
Arch: arm64
329+
ArchDir: arm64
308330
PythonExePattern: python.exe
309331
ExtraOptions: ${{ parameters.ExtraOptions }}
310332
${{ if eq(parameters.ToBeSigned, 'true') }}:
@@ -314,7 +336,9 @@ jobs:
314336
${{ if eq(parameters.DoFreethreaded, 'true') }}:
315337
arm64_t:
316338
Name: arm64_t
317-
PythonExePattern: python3*t.exe
339+
Arch: arm64
340+
ArchDir: ${{ iif(eq(parameters.Post315OutputDir, 'true'), 'arm64t', 'arm64') }}
341+
PythonExePattern: ${{ iif(eq(parameters.Post315OutputDir, 'true'), 'python.exe', 'python3*t.exe') }}
318342
ExtraOptions: ${{ parameters.ExtraOptionsFreethreaded }}
319343
${{ if eq(parameters.ToBeSigned, 'true') }}:
320344
Artifact: unsigned_arm64_t

windows-release/stage-msi.yml

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ parameters:
33
DoARM64: true
44
DoFreethreaded: false
55
SigningCertificate: ''
6+
Post315OutputDir: false
67

78
jobs:
89
- job: Make_MSI
@@ -51,19 +52,34 @@ jobs:
5152
# Freethreaded binaries copy into the same target directory, but files
5253
# are not overwritten.
5354
- ${{ if eq(parameters.DoFreethreaded, 'true') }}:
54-
- artifact: bin_win32_t
55-
target: $(Build.BinariesDirectory)\win32
56-
- artifact: bin_win32_td
57-
target: $(Build.BinariesDirectory)\win32
58-
- artifact: bin_amd64_t
59-
target: $(Build.BinariesDirectory)\amd64
60-
- artifact: bin_amd64_td
61-
target: $(Build.BinariesDirectory)\amd64
62-
- ${{ if eq(parameters.DoARM64, 'true') }}:
63-
- artifact: bin_arm64_t
64-
target: $(Build.BinariesDirectory)\arm64
65-
- artifact: bin_arm64_td
66-
target: $(Build.BinariesDirectory)\arm64
55+
- ${{ if eq(parameters.Post315OutputDir, 'true') }}:
56+
- artifact: bin_win32_t
57+
target: $(Build.BinariesDirectory)\win32t
58+
- artifact: bin_win32_td
59+
target: $(Build.BinariesDirectory)\win32t
60+
- artifact: bin_amd64_t
61+
target: $(Build.BinariesDirectory)\amd64t
62+
- artifact: bin_amd64_td
63+
target: $(Build.BinariesDirectory)\amd64t
64+
- ${{ if eq(parameters.DoARM64, 'true') }}:
65+
- artifact: bin_arm64_t
66+
target: $(Build.BinariesDirectory)\arm64t
67+
- artifact: bin_arm64_td
68+
target: $(Build.BinariesDirectory)\arm64t
69+
- ${{ else }}:
70+
- artifact: bin_win32_t
71+
target: $(Build.BinariesDirectory)\win32
72+
- artifact: bin_win32_td
73+
target: $(Build.BinariesDirectory)\win32
74+
- artifact: bin_amd64_t
75+
target: $(Build.BinariesDirectory)\amd64
76+
- artifact: bin_amd64_td
77+
target: $(Build.BinariesDirectory)\amd64
78+
- ${{ if eq(parameters.DoARM64, 'true') }}:
79+
- artifact: bin_arm64_t
80+
target: $(Build.BinariesDirectory)\arm64
81+
- artifact: bin_arm64_td
82+
target: $(Build.BinariesDirectory)\arm64
6783
Bundles:
6884
- bundle: win32
6985
Platform: x86

0 commit comments

Comments
 (0)