Skip to content

Commit fb382b4

Browse files
authored
create and upload to releases additional install only free-threaded assets (#1014)
Create install_only assets for the free-threaded builds of Python 3.13+. This is in addition to the install_only assets for the GIL configuration of these builds. These assets are upload to a GitHub release by the appropriate action. Based upon #537 Closes #536
1 parent 517bea8 commit fb382b4

2 files changed

Lines changed: 52 additions & 2 deletions

File tree

src/github.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,8 @@ pub async fn command_fetch_release_distributions(args: &ArgMatches) -> Result<()
342342

343343
if build_suffix == release.install_only_suffix {
344344
install_paths.push(dest_path);
345+
} else if build_suffix == release.freethreaded_install_only_suffix {
346+
install_paths.push(dest_path);
345347
}
346348
}
347349
}

src/release.rs

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ pub struct TripleRelease {
2929
pub suffixes: Vec<&'static str>,
3030
/// Build suffix to use for the `install_only` artifact.
3131
pub install_only_suffix: &'static str,
32+
/// Build suffix to use for the freethreaded `install_only` artifact.
33+
pub freethreaded_install_only_suffix: &'static str,
3234
/// Minimum Python version this triple is released for.
3335
pub python_version_requirement: Option<VersionSpecifier>,
3436
/// Additional build suffixes to release conditional on the Python version.
@@ -84,6 +86,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
8486
TripleRelease {
8587
suffixes: macos_suffixes.clone(),
8688
install_only_suffix: "pgo+lto",
89+
freethreaded_install_only_suffix: "freethreaded+pgo+lto",
8790
python_version_requirement: None,
8891
conditional_suffixes: vec![ConditionalSuffixes {
8992
python_version_requirement: VersionSpecifier::from_str(">=3.13.0rc0").unwrap(),
@@ -96,6 +99,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
9699
TripleRelease {
97100
suffixes: macos_suffixes,
98101
install_only_suffix: "pgo+lto",
102+
freethreaded_install_only_suffix: "freethreaded+pgo+lto",
99103
python_version_requirement: None,
100104
conditional_suffixes: vec![ConditionalSuffixes {
101105
python_version_requirement: VersionSpecifier::from_str(">=3.13.0rc0").unwrap(),
@@ -110,6 +114,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
110114
TripleRelease {
111115
suffixes: vec!["pgo"],
112116
install_only_suffix: "pgo",
117+
freethreaded_install_only_suffix: "freethreaded+pgo",
113118
python_version_requirement: None,
114119
conditional_suffixes: vec![ConditionalSuffixes {
115120
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
@@ -122,6 +127,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
122127
TripleRelease {
123128
suffixes: vec!["pgo"],
124129
install_only_suffix: "pgo",
130+
freethreaded_install_only_suffix: "freethreaded+pgo",
125131
python_version_requirement: None,
126132
conditional_suffixes: vec![ConditionalSuffixes {
127133
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
@@ -134,6 +140,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
134140
TripleRelease {
135141
suffixes: vec!["pgo"],
136142
install_only_suffix: "pgo",
143+
freethreaded_install_only_suffix: "freethreaded+pgo",
137144
python_version_requirement: Some(VersionSpecifier::from_str(">=3.11").unwrap()),
138145
conditional_suffixes: vec![ConditionalSuffixes {
139146
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
@@ -170,6 +177,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
170177
TripleRelease {
171178
suffixes: linux_suffixes_pgo.clone(),
172179
install_only_suffix: "pgo+lto",
180+
freethreaded_install_only_suffix: "freethreaded+pgo+lto",
173181
python_version_requirement: None,
174182
conditional_suffixes: vec![ConditionalSuffixes {
175183
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
@@ -183,6 +191,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
183191
TripleRelease {
184192
suffixes: linux_suffixes_nopgo.clone(),
185193
install_only_suffix: "lto",
194+
freethreaded_install_only_suffix: "freethreaded+lto",
186195
python_version_requirement: Some(VersionSpecifier::from_str(">=3.10").unwrap()),
187196
conditional_suffixes: vec![ConditionalSuffixes {
188197
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
@@ -196,6 +205,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
196205
TripleRelease {
197206
suffixes: linux_suffixes_nopgo.clone(),
198207
install_only_suffix: "lto",
208+
freethreaded_install_only_suffix: "freethreaded+lto",
199209
python_version_requirement: Some(VersionSpecifier::from_str(">=3.10").unwrap()),
200210
conditional_suffixes: vec![ConditionalSuffixes {
201211
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
@@ -209,6 +219,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
209219
TripleRelease {
210220
suffixes: linux_suffixes_nopgo.clone(),
211221
install_only_suffix: "lto",
222+
freethreaded_install_only_suffix: "freethreaded+lto",
212223
python_version_requirement: Some(VersionSpecifier::from_str(">=3.10").unwrap()),
213224
conditional_suffixes: vec![ConditionalSuffixes {
214225
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
@@ -222,6 +233,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
222233
TripleRelease {
223234
suffixes: linux_suffixes_nopgo.clone(),
224235
install_only_suffix: "lto",
236+
freethreaded_install_only_suffix: "freethreaded+lto",
225237
python_version_requirement: Some(VersionSpecifier::from_str(">=3.10").unwrap()),
226238
conditional_suffixes: vec![ConditionalSuffixes {
227239
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
@@ -235,6 +247,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
235247
TripleRelease {
236248
suffixes: linux_suffixes_nopgo.clone(),
237249
install_only_suffix: "lto",
250+
freethreaded_install_only_suffix: "freethreaded+lto",
238251
python_version_requirement: Some(VersionSpecifier::from_str(">=3.10").unwrap()),
239252
conditional_suffixes: vec![ConditionalSuffixes {
240253
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
@@ -248,6 +261,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
248261
TripleRelease {
249262
suffixes: linux_suffixes_pgo.clone(),
250263
install_only_suffix: "pgo+lto",
264+
freethreaded_install_only_suffix: "freethreaded+pgo+lto",
251265
python_version_requirement: None,
252266
conditional_suffixes: vec![ConditionalSuffixes {
253267
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
@@ -260,6 +274,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
260274
TripleRelease {
261275
suffixes: linux_suffixes_pgo.clone(),
262276
install_only_suffix: "pgo+lto",
277+
freethreaded_install_only_suffix: "freethreaded+pgo+lto",
263278
python_version_requirement: Some(VersionSpecifier::from_str(">=3.10").unwrap()),
264279
conditional_suffixes: vec![ConditionalSuffixes {
265280
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
@@ -272,6 +287,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
272287
TripleRelease {
273288
suffixes: linux_suffixes_pgo.clone(),
274289
install_only_suffix: "pgo+lto",
290+
freethreaded_install_only_suffix: "freethreaded+pgo+lto",
275291
python_version_requirement: Some(VersionSpecifier::from_str(">=3.10").unwrap()),
276292
conditional_suffixes: vec![ConditionalSuffixes {
277293
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
@@ -284,6 +300,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
284300
TripleRelease {
285301
suffixes: linux_suffixes_pgo.clone(),
286302
install_only_suffix: "pgo+lto",
303+
freethreaded_install_only_suffix: "freethreaded+pgo+lto",
287304
python_version_requirement: Some(VersionSpecifier::from_str(">=3.10").unwrap()),
288305
conditional_suffixes: vec![ConditionalSuffixes {
289306
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
@@ -296,6 +313,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
296313
TripleRelease {
297314
suffixes: linux_suffixes_musl.clone(),
298315
install_only_suffix: "lto",
316+
freethreaded_install_only_suffix: "freethreaded+lto",
299317
python_version_requirement: None,
300318
conditional_suffixes: vec![ConditionalSuffixes {
301319
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
@@ -308,6 +326,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
308326
TripleRelease {
309327
suffixes: linux_suffixes_musl.clone(),
310328
install_only_suffix: "lto",
329+
freethreaded_install_only_suffix: "freethreaded+lto",
311330
python_version_requirement: None,
312331
conditional_suffixes: vec![ConditionalSuffixes {
313332
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
@@ -320,6 +339,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
320339
TripleRelease {
321340
suffixes: linux_suffixes_musl.clone(),
322341
install_only_suffix: "lto",
342+
freethreaded_install_only_suffix: "freethreaded+lto",
323343
python_version_requirement: None,
324344
conditional_suffixes: vec![ConditionalSuffixes {
325345
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
@@ -332,6 +352,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
332352
TripleRelease {
333353
suffixes: linux_suffixes_musl.clone(),
334354
install_only_suffix: "lto",
355+
freethreaded_install_only_suffix: "freethreaded+lto",
335356
python_version_requirement: None,
336357
conditional_suffixes: vec![ConditionalSuffixes {
337358
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
@@ -344,6 +365,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
344365
TripleRelease {
345366
suffixes: vec!["debug", "lto", "noopt"],
346367
install_only_suffix: "lto",
368+
freethreaded_install_only_suffix: "freethreaded+lto",
347369
python_version_requirement: None,
348370
conditional_suffixes: vec![ConditionalSuffixes {
349371
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
@@ -404,6 +426,22 @@ pub fn build_wanted_filenames(
404426
format!("cpython-{version}-{triple}-install_only_stripped-{datetime}.tar.gz"),
405427
format!("cpython-{version}+{tag}-{triple}-install_only_stripped.tar.gz"),
406428
);
429+
430+
// Free-threading only available for Python 3.13+
431+
let freethreaded_conditional = VersionSpecifier::from_str(">=3.13.0rc0").unwrap();
432+
if freethreaded_conditional.contains(&python_version) {
433+
wanted_filenames.insert(
434+
format!(
435+
"cpython-{version}-{triple}-freethreaded-install_only-{datetime}.tar.gz"
436+
),
437+
format!("cpython-{version}+{tag}-{triple}-freethreaded-install_only.tar.gz"),
438+
);
439+
440+
wanted_filenames.insert(
441+
format!("cpython-{version}-{triple}-freethreaded-install_only_stripped-{datetime}.tar.gz"),
442+
format!("cpython-{version}+{tag}-{triple}-freethreaded-install_only_stripped.tar.gz"),
443+
);
444+
}
407445
}
408446
}
409447

@@ -605,8 +643,18 @@ pub fn produce_install_only(tar_zst_path: &Path) -> Result<PathBuf> {
605643
.map(|x| x.to_string())
606644
.collect::<Vec<_>>();
607645
let parts_len = name_parts.len();
646+
let flavor_idx = parts_len - 2;
608647

609-
name_parts[parts_len - 2] = "install_only".to_string();
648+
if name_parts[flavor_idx].contains("freethreaded") {
649+
name_parts
650+
.splice(
651+
flavor_idx..flavor_idx + 1,
652+
["freethreaded".to_string(), "install_only".to_string()],
653+
)
654+
.for_each(drop);
655+
} else {
656+
name_parts[flavor_idx] = "install_only".to_string();
657+
}
610658

611659
let install_only_name = name_parts.join("-");
612660
let install_only_name = install_only_name.replace(".tar.zst", ".tar.gz");
@@ -728,7 +776,7 @@ pub async fn bootstrap_llvm() -> Result<PathBuf> {
728776
Err(err) if err.kind() == std::io::ErrorKind::NotFound => {}
729777
Err(err) => return Err(err).context("failed to remove existing llvm directory"),
730778
}
731-
tokio::fs::rename(temp_dir.into_path(), &llvm_dir).await?;
779+
tokio::fs::rename(temp_dir.keep(), &llvm_dir).await?;
732780

733781
Ok(llvm_dir.join("llvm"))
734782
}

0 commit comments

Comments
 (0)