@@ -33,7 +33,7 @@ async fn fetch_artifact(
33
33
repo : & str ,
34
34
artifact : WorkflowListArtifact ,
35
35
) -> Result < bytes:: Bytes > {
36
- println ! ( "downloading {}" , artifact. name) ;
36
+ println ! ( "downloading artifact {}" , artifact. name) ;
37
37
38
38
let res = client
39
39
. actions ( )
@@ -107,6 +107,8 @@ pub async fn command_fetch_release_distributions(args: &ArgMatches) -> Result<()
107
107
)
108
108
. build ( ) ?;
109
109
110
+ let release_version_range = pep440_rs:: VersionSpecifier :: from_str ( ">=3.9" ) ?;
111
+
110
112
let workflows = client. workflows ( org, repo) ;
111
113
112
114
let mut workflow_names = HashMap :: new ( ) ;
@@ -208,49 +210,69 @@ pub async fn command_fetch_release_distributions(args: &ArgMatches) -> Result<()
208
210
209
211
let name = zf. name ( ) . to_string ( ) ;
210
212
213
+ let parts = name. split ( '-' ) . collect :: < Vec < _ > > ( ) ;
214
+
215
+ if parts[ 0 ] != "cpython" {
216
+ println ! ( "ignoring {} not a cpython artifact" , name) ;
217
+ continue ;
218
+ } ;
219
+
220
+ let python_version = pep440_rs:: Version :: from_str ( parts[ 1 ] ) ?;
221
+ if !release_version_range. contains ( & python_version) {
222
+ println ! (
223
+ "{} not in release version range {}" ,
224
+ name, release_version_range
225
+ ) ;
226
+ continue ;
227
+ }
228
+
211
229
// Iterate over `RELEASE_TRIPLES` in reverse-order to ensure that if any triple is a
212
230
// substring of another, the longest match is used.
213
- if let Some ( ( triple, release) ) =
231
+ let Some ( ( triple, release) ) =
214
232
RELEASE_TRIPLES . iter ( ) . rev ( ) . find_map ( |( triple, release) | {
215
233
if name. contains ( triple) {
216
234
Some ( ( triple, release) )
217
235
} else {
218
236
None
219
237
}
220
238
} )
221
- {
222
- let stripped_name = if let Some ( s ) = name . strip_suffix ( ".tar.zst" ) {
223
- s
224
- } else {
225
- println ! ( "{} not a .tar.zst artifact" , name ) ;
226
- continue ;
227
- } ;
239
+ else {
240
+ println ! (
241
+ "ignoring {} does not match any registered release triples" ,
242
+ name
243
+ ) ;
244
+ continue ;
245
+ } ;
228
246
229
- let stripped_name = & stripped_name[ 0 ..stripped_name. len ( ) - "-YYYYMMDDTHHMM" . len ( ) ] ;
247
+ let stripped_name = if let Some ( s) = name. strip_suffix ( ".tar.zst" ) {
248
+ s
249
+ } else {
250
+ println ! ( "ignoring {} not a .tar.zst artifact" , name) ;
251
+ continue ;
252
+ } ;
230
253
231
- let triple_start = stripped_name
232
- . find ( triple)
233
- . expect ( "validated triple presence above" ) ;
254
+ let stripped_name = & stripped_name[ 0 ..stripped_name. len ( ) - "-YYYYMMDDTHHMM" . len ( ) ] ;
234
255
235
- let build_suffix = & stripped_name[ triple_start + triple. len ( ) + 1 ..] ;
256
+ let triple_start = stripped_name
257
+ . find ( triple)
258
+ . expect ( "validated triple presence above" ) ;
236
259
237
- if !release. suffixes ( None ) . any ( |suffix| build_suffix == suffix) {
238
- println ! ( "{} not a release artifact for triple" , name) ;
239
- continue ;
240
- }
260
+ let build_suffix = & stripped_name[ triple_start + triple. len ( ) + 1 ..] ;
241
261
242
- let dest_path = dest_dir . join ( & name ) ;
243
- let mut buf = vec ! [ ] ;
244
- zf . read_to_end ( & mut buf ) ? ;
245
- std :: fs :: write ( & dest_path , & buf ) ? ;
262
+ if !release . suffixes ( None ) . any ( |suffix| build_suffix == suffix ) {
263
+ println ! ( "ignoring {} not a release artifact for triple" , name ) ;
264
+ continue ;
265
+ }
246
266
247
- println ! ( "releasing {}" , name) ;
267
+ let dest_path = dest_dir. join ( & name) ;
268
+ let mut buf = vec ! [ ] ;
269
+ zf. read_to_end ( & mut buf) ?;
270
+ std:: fs:: write ( & dest_path, & buf) ?;
248
271
249
- if build_suffix == release. install_only_suffix {
250
- install_paths. push ( dest_path) ;
251
- }
252
- } else {
253
- println ! ( "{} does not match any registered release triples" , name) ;
272
+ println ! ( "prepared {} for release" , name) ;
273
+
274
+ if build_suffix == release. install_only_suffix {
275
+ install_paths. push ( dest_path) ;
254
276
}
255
277
}
256
278
}
@@ -271,7 +293,7 @@ pub async fn command_fetch_release_distributions(args: &ArgMatches) -> Result<()
271
293
let dest_path = produce_install_only ( path) ?;
272
294
273
295
println ! (
274
- "releasing {}" ,
296
+ "prepared {} for release " ,
275
297
dest_path
276
298
. file_name( )
277
299
. expect( "should have file name" )
@@ -290,7 +312,7 @@ pub async fn command_fetch_release_distributions(args: &ArgMatches) -> Result<()
290
312
let dest_path = produce_install_only_stripped ( & dest_path, & llvm_dir) ?;
291
313
292
314
println ! (
293
- "releasing {}" ,
315
+ "prepared {} for release " ,
294
316
dest_path
295
317
. file_name( )
296
318
. expect( "should have file name" )
0 commit comments