Skip to content

Commit 82e9015

Browse files
authored
Drop Python 3.8 artifacts from the release (#340)
We need more disk space for 3.13t and this seems like the most straight-forward way to get it?
1 parent 075ad3d commit 82e9015

File tree

1 file changed

+52
-30
lines changed

1 file changed

+52
-30
lines changed

src/github.rs

Lines changed: 52 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ async fn fetch_artifact(
3333
repo: &str,
3434
artifact: WorkflowListArtifact,
3535
) -> Result<bytes::Bytes> {
36-
println!("downloading {}", artifact.name);
36+
println!("downloading artifact {}", artifact.name);
3737

3838
let res = client
3939
.actions()
@@ -107,6 +107,8 @@ pub async fn command_fetch_release_distributions(args: &ArgMatches) -> Result<()
107107
)
108108
.build()?;
109109

110+
let release_version_range = pep440_rs::VersionSpecifier::from_str(">=3.9")?;
111+
110112
let workflows = client.workflows(org, repo);
111113

112114
let mut workflow_names = HashMap::new();
@@ -208,49 +210,69 @@ pub async fn command_fetch_release_distributions(args: &ArgMatches) -> Result<()
208210

209211
let name = zf.name().to_string();
210212

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+
211229
// Iterate over `RELEASE_TRIPLES` in reverse-order to ensure that if any triple is a
212230
// substring of another, the longest match is used.
213-
if let Some((triple, release)) =
231+
let Some((triple, release)) =
214232
RELEASE_TRIPLES.iter().rev().find_map(|(triple, release)| {
215233
if name.contains(triple) {
216234
Some((triple, release))
217235
} else {
218236
None
219237
}
220238
})
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+
};
228246

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+
};
230253

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()];
234255

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");
236259

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..];
241261

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+
}
246266

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)?;
248271

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);
254276
}
255277
}
256278
}
@@ -271,7 +293,7 @@ pub async fn command_fetch_release_distributions(args: &ArgMatches) -> Result<()
271293
let dest_path = produce_install_only(path)?;
272294

273295
println!(
274-
"releasing {}",
296+
"prepared {} for release",
275297
dest_path
276298
.file_name()
277299
.expect("should have file name")
@@ -290,7 +312,7 @@ pub async fn command_fetch_release_distributions(args: &ArgMatches) -> Result<()
290312
let dest_path = produce_install_only_stripped(&dest_path, &llvm_dir)?;
291313

292314
println!(
293-
"releasing {}",
315+
"prepared {} for release",
294316
dest_path
295317
.file_name()
296318
.expect("should have file name")

0 commit comments

Comments
 (0)