@@ -31,19 +31,68 @@ pub struct TripleRelease {
31
31
pub install_only_suffix : & ' static str ,
32
32
/// Minimum Python version this triple is released for.
33
33
pub python_version_requirement : Option < VersionSpecifier > ,
34
+ /// Additional build suffixes to release conditional on the Python version.
35
+ pub conditional_suffixes : Vec < ConditionalSuffixes > ,
36
+ }
37
+
38
+ /// Describes additional build suffixes conditional on the Python version.
39
+ ///
40
+ /// e.g., free-threaded builds which are only available for Python 3.13+.
41
+ pub struct ConditionalSuffixes {
42
+ /// The minimum Python version to include these suffixes for.
43
+ pub python_version_requirement : VersionSpecifier ,
44
+ /// Build suffixes to release.
45
+ pub suffixes : Vec < & ' static str > ,
46
+ }
47
+
48
+ impl TripleRelease {
49
+ pub fn suffixes < ' a > (
50
+ & ' a self ,
51
+ python_version : Option < & ' a pep440_rs:: Version > ,
52
+ ) -> impl Iterator < Item = & ' static str > + ' a {
53
+ self . suffixes
54
+ . iter ( )
55
+ . copied ( )
56
+ . chain (
57
+ self . conditional_suffixes
58
+ . iter ( )
59
+ . flat_map ( move |conditional| {
60
+ if python_version. is_none ( )
61
+ || python_version. is_some_and ( |python_version| {
62
+ conditional
63
+ . python_version_requirement
64
+ . contains ( python_version)
65
+ } )
66
+ {
67
+ conditional. suffixes . iter ( ) . copied ( )
68
+ } else {
69
+ [ ] . iter ( ) . copied ( )
70
+ }
71
+ } ) ,
72
+ )
73
+ }
34
74
}
35
75
36
76
pub static RELEASE_TRIPLES : Lazy < BTreeMap < & ' static str , TripleRelease > > = Lazy :: new ( || {
37
77
let mut h = BTreeMap :: new ( ) ;
38
78
39
79
// macOS.
40
80
let macos_suffixes = vec ! [ "debug" , "pgo" , "pgo+lto" ] ;
81
+ let macos_suffixes_313 = vec ! [
82
+ "freethreaded+debug" ,
83
+ "freethreaded+pgo" ,
84
+ "freethreaded+pgo+lto" ,
85
+ ] ;
41
86
h. insert (
42
87
"aarch64-apple-darwin" ,
43
88
TripleRelease {
44
89
suffixes : macos_suffixes. clone ( ) ,
45
90
install_only_suffix : "pgo+lto" ,
46
91
python_version_requirement : None ,
92
+ conditional_suffixes : vec ! [ ConditionalSuffixes {
93
+ python_version_requirement: VersionSpecifier :: from_str( ">=3.13.0rc0" ) . unwrap( ) ,
94
+ suffixes: macos_suffixes_313. clone( ) ,
95
+ } ] ,
47
96
} ,
48
97
) ;
49
98
h. insert (
@@ -52,6 +101,10 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
52
101
suffixes : macos_suffixes,
53
102
install_only_suffix : "pgo+lto" ,
54
103
python_version_requirement : None ,
104
+ conditional_suffixes : vec ! [ ConditionalSuffixes {
105
+ python_version_requirement: VersionSpecifier :: from_str( ">=3.13.0rc0" ) . unwrap( ) ,
106
+ suffixes: macos_suffixes_313. clone( ) ,
107
+ } ] ,
55
108
} ,
56
109
) ;
57
110
@@ -62,6 +115,10 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
62
115
suffixes : vec ! [ "pgo" ] ,
63
116
install_only_suffix : "pgo" ,
64
117
python_version_requirement : None ,
118
+ conditional_suffixes : vec ! [ ConditionalSuffixes {
119
+ python_version_requirement: VersionSpecifier :: from_str( ">=3.13" ) . unwrap( ) ,
120
+ suffixes: vec![ "freethreaded+pgo" ] ,
121
+ } ] ,
65
122
} ,
66
123
) ;
67
124
h. insert (
@@ -70,6 +127,10 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
70
127
suffixes : vec ! [ "pgo" ] ,
71
128
install_only_suffix : "pgo" ,
72
129
python_version_requirement : None ,
130
+ conditional_suffixes : vec ! [ ConditionalSuffixes {
131
+ python_version_requirement: VersionSpecifier :: from_str( ">=3.13" ) . unwrap( ) ,
132
+ suffixes: vec![ "freethreaded+pgo" ] ,
133
+ } ] ,
73
134
} ,
74
135
) ;
75
136
@@ -81,6 +142,10 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
81
142
suffixes : vec ! [ "pgo" ] ,
82
143
install_only_suffix : "pgo" ,
83
144
python_version_requirement : None ,
145
+ conditional_suffixes : vec ! [ ConditionalSuffixes {
146
+ python_version_requirement: VersionSpecifier :: from_str( ">=3.13" ) . unwrap( ) ,
147
+ suffixes: vec![ "freethreaded+pgo" ] ,
148
+ } ] ,
84
149
} ,
85
150
) ;
86
151
h. insert (
@@ -89,19 +154,37 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
89
154
suffixes : vec ! [ "pgo" ] ,
90
155
install_only_suffix : "pgo" ,
91
156
python_version_requirement : None ,
157
+ conditional_suffixes : vec ! [ ConditionalSuffixes {
158
+ python_version_requirement: VersionSpecifier :: from_str( ">=3.13" ) . unwrap( ) ,
159
+ suffixes: vec![ "freethreaded+pgo" ] ,
160
+ } ] ,
92
161
} ,
93
162
) ;
94
163
95
164
// Linux.
96
165
let linux_suffixes_pgo = vec ! [ "debug" , "pgo" , "pgo+lto" ] ;
97
166
let linux_suffixes_nopgo = vec ! [ "debug" , "lto" , "noopt" ] ;
167
+ let linux_suffixes_pgo_freethreaded = vec ! [
168
+ "freethreaded+debug" ,
169
+ "freethreaded+pgo" ,
170
+ "freethreaded+pgo+lto" ,
171
+ ] ;
172
+ let linux_suffixes_nopgo_freethreaded = vec ! [
173
+ "freethreaded+debug" ,
174
+ "freethreaded+lto" ,
175
+ "freethreaded+noopt" ,
176
+ ] ;
98
177
99
178
h. insert (
100
179
"aarch64-unknown-linux-gnu" ,
101
180
TripleRelease {
102
181
suffixes : linux_suffixes_nopgo. clone ( ) ,
103
182
install_only_suffix : "lto" ,
104
183
python_version_requirement : None ,
184
+ conditional_suffixes : vec ! [ ConditionalSuffixes {
185
+ python_version_requirement: VersionSpecifier :: from_str( ">=3.13" ) . unwrap( ) ,
186
+ suffixes: linux_suffixes_nopgo_freethreaded. clone( ) ,
187
+ } ] ,
105
188
} ,
106
189
) ;
107
190
@@ -111,6 +194,10 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
111
194
suffixes : linux_suffixes_nopgo. clone ( ) ,
112
195
install_only_suffix : "lto" ,
113
196
python_version_requirement : Some ( VersionSpecifier :: from_str ( ">=3.9" ) . unwrap ( ) ) ,
197
+ conditional_suffixes : vec ! [ ConditionalSuffixes {
198
+ python_version_requirement: VersionSpecifier :: from_str( ">=3.13" ) . unwrap( ) ,
199
+ suffixes: linux_suffixes_nopgo_freethreaded. clone( ) ,
200
+ } ] ,
114
201
} ,
115
202
) ;
116
203
@@ -120,6 +207,10 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
120
207
suffixes : linux_suffixes_nopgo. clone ( ) ,
121
208
install_only_suffix : "lto" ,
122
209
python_version_requirement : Some ( VersionSpecifier :: from_str ( ">=3.9" ) . unwrap ( ) ) ,
210
+ conditional_suffixes : vec ! [ ConditionalSuffixes {
211
+ python_version_requirement: VersionSpecifier :: from_str( ">=3.13" ) . unwrap( ) ,
212
+ suffixes: linux_suffixes_nopgo_freethreaded. clone( ) ,
213
+ } ] ,
123
214
} ,
124
215
) ;
125
216
@@ -129,6 +220,10 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
129
220
suffixes : linux_suffixes_nopgo. clone ( ) ,
130
221
install_only_suffix : "lto" ,
131
222
python_version_requirement : Some ( VersionSpecifier :: from_str ( ">=3.9" ) . unwrap ( ) ) ,
223
+ conditional_suffixes : vec ! [ ConditionalSuffixes {
224
+ python_version_requirement: VersionSpecifier :: from_str( ">=3.13" ) . unwrap( ) ,
225
+ suffixes: linux_suffixes_nopgo_freethreaded. clone( ) ,
226
+ } ] ,
132
227
} ,
133
228
) ;
134
229
@@ -138,6 +233,10 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
138
233
suffixes : linux_suffixes_nopgo. clone ( ) ,
139
234
install_only_suffix : "lto" ,
140
235
python_version_requirement : Some ( VersionSpecifier :: from_str ( ">=3.9" ) . unwrap ( ) ) ,
236
+ conditional_suffixes : vec ! [ ConditionalSuffixes {
237
+ python_version_requirement: VersionSpecifier :: from_str( ">=3.13" ) . unwrap( ) ,
238
+ suffixes: linux_suffixes_nopgo_freethreaded. clone( ) ,
239
+ } ] ,
141
240
} ,
142
241
) ;
143
242
@@ -147,6 +246,10 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
147
246
suffixes : linux_suffixes_pgo. clone ( ) ,
148
247
install_only_suffix : "pgo+lto" ,
149
248
python_version_requirement : None ,
249
+ conditional_suffixes : vec ! [ ConditionalSuffixes {
250
+ python_version_requirement: VersionSpecifier :: from_str( ">=3.13" ) . unwrap( ) ,
251
+ suffixes: linux_suffixes_pgo_freethreaded. clone( ) ,
252
+ } ] ,
150
253
} ,
151
254
) ;
152
255
h. insert (
@@ -155,6 +258,10 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
155
258
suffixes : linux_suffixes_pgo. clone ( ) ,
156
259
install_only_suffix : "pgo+lto" ,
157
260
python_version_requirement : Some ( VersionSpecifier :: from_str ( ">=3.9" ) . unwrap ( ) ) ,
261
+ conditional_suffixes : vec ! [ ConditionalSuffixes {
262
+ python_version_requirement: VersionSpecifier :: from_str( ">=3.13" ) . unwrap( ) ,
263
+ suffixes: linux_suffixes_pgo_freethreaded. clone( ) ,
264
+ } ] ,
158
265
} ,
159
266
) ;
160
267
h. insert (
@@ -163,6 +270,10 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
163
270
suffixes : linux_suffixes_pgo. clone ( ) ,
164
271
install_only_suffix : "pgo+lto" ,
165
272
python_version_requirement : Some ( VersionSpecifier :: from_str ( ">=3.9" ) . unwrap ( ) ) ,
273
+ conditional_suffixes : vec ! [ ConditionalSuffixes {
274
+ python_version_requirement: VersionSpecifier :: from_str( ">=3.13" ) . unwrap( ) ,
275
+ suffixes: linux_suffixes_pgo_freethreaded. clone( ) ,
276
+ } ] ,
166
277
} ,
167
278
) ;
168
279
h. insert (
@@ -171,6 +282,10 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
171
282
suffixes : linux_suffixes_nopgo. clone ( ) ,
172
283
install_only_suffix : "lto" ,
173
284
python_version_requirement : Some ( VersionSpecifier :: from_str ( ">=3.9" ) . unwrap ( ) ) ,
285
+ conditional_suffixes : vec ! [ ConditionalSuffixes {
286
+ python_version_requirement: VersionSpecifier :: from_str( ">=3.13" ) . unwrap( ) ,
287
+ suffixes: linux_suffixes_nopgo_freethreaded. clone( ) ,
288
+ } ] ,
174
289
} ,
175
290
) ;
176
291
h. insert (
@@ -179,6 +294,10 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
179
294
suffixes : linux_suffixes_nopgo. clone ( ) ,
180
295
install_only_suffix : "lto" ,
181
296
python_version_requirement : None ,
297
+ conditional_suffixes : vec ! [ ConditionalSuffixes {
298
+ python_version_requirement: VersionSpecifier :: from_str( ">=3.13" ) . unwrap( ) ,
299
+ suffixes: linux_suffixes_nopgo_freethreaded. clone( ) ,
300
+ } ] ,
182
301
} ,
183
302
) ;
184
303
h. insert (
@@ -187,6 +306,10 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
187
306
suffixes : linux_suffixes_nopgo. clone ( ) ,
188
307
install_only_suffix : "lto" ,
189
308
python_version_requirement : Some ( VersionSpecifier :: from_str ( ">=3.9" ) . unwrap ( ) ) ,
309
+ conditional_suffixes : vec ! [ ConditionalSuffixes {
310
+ python_version_requirement: VersionSpecifier :: from_str( ">=3.13" ) . unwrap( ) ,
311
+ suffixes: linux_suffixes_nopgo_freethreaded. clone( ) ,
312
+ } ] ,
190
313
} ,
191
314
) ;
192
315
h. insert (
@@ -195,6 +318,10 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
195
318
suffixes : linux_suffixes_nopgo. clone ( ) ,
196
319
install_only_suffix : "lto" ,
197
320
python_version_requirement : Some ( VersionSpecifier :: from_str ( ">=3.9" ) . unwrap ( ) ) ,
321
+ conditional_suffixes : vec ! [ ConditionalSuffixes {
322
+ python_version_requirement: VersionSpecifier :: from_str( ">=3.13" ) . unwrap( ) ,
323
+ suffixes: linux_suffixes_nopgo_freethreaded. clone( ) ,
324
+ } ] ,
198
325
} ,
199
326
) ;
200
327
h. insert (
@@ -203,6 +330,10 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
203
330
suffixes : linux_suffixes_nopgo. clone ( ) ,
204
331
install_only_suffix : "lto" ,
205
332
python_version_requirement : Some ( VersionSpecifier :: from_str ( ">=3.9" ) . unwrap ( ) ) ,
333
+ conditional_suffixes : vec ! [ ConditionalSuffixes {
334
+ python_version_requirement: VersionSpecifier :: from_str( ">=3.13" ) . unwrap( ) ,
335
+ suffixes: linux_suffixes_nopgo_freethreaded. clone( ) ,
336
+ } ] ,
206
337
} ,
207
338
) ;
208
339
0 commit comments