Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/github.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,8 @@ pub async fn command_fetch_release_distributions(args: &ArgMatches) -> Result<()

if build_suffix == release.install_only_suffix {
install_paths.push(dest_path);
} else if build_suffix == release.freethreaded_install_only_suffix {
install_paths.push(dest_path);
}
}
}
Expand Down
52 changes: 50 additions & 2 deletions src/release.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ pub struct TripleRelease {
pub suffixes: Vec<&'static str>,
/// Build suffix to use for the `install_only` artifact.
pub install_only_suffix: &'static str,
/// Build suffix to use for the freethreaded `install_only` artifact.
pub freethreaded_install_only_suffix: &'static str,
/// Minimum Python version this triple is released for.
pub python_version_requirement: Option<VersionSpecifier>,
/// Additional build suffixes to release conditional on the Python version.
Expand Down Expand Up @@ -84,6 +86,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
TripleRelease {
suffixes: macos_suffixes.clone(),
install_only_suffix: "pgo+lto",
freethreaded_install_only_suffix: "freethreaded+pgo+lto",
python_version_requirement: None,
conditional_suffixes: vec![ConditionalSuffixes {
python_version_requirement: VersionSpecifier::from_str(">=3.13.0rc0").unwrap(),
Expand All @@ -96,6 +99,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
TripleRelease {
suffixes: macos_suffixes,
install_only_suffix: "pgo+lto",
freethreaded_install_only_suffix: "freethreaded+pgo+lto",
python_version_requirement: None,
conditional_suffixes: vec![ConditionalSuffixes {
python_version_requirement: VersionSpecifier::from_str(">=3.13.0rc0").unwrap(),
Expand All @@ -110,6 +114,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
TripleRelease {
suffixes: vec!["pgo"],
install_only_suffix: "pgo",
freethreaded_install_only_suffix: "freethreaded+pgo",
python_version_requirement: None,
conditional_suffixes: vec![ConditionalSuffixes {
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
Expand All @@ -122,6 +127,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
TripleRelease {
suffixes: vec!["pgo"],
install_only_suffix: "pgo",
freethreaded_install_only_suffix: "freethreaded+pgo",
python_version_requirement: None,
conditional_suffixes: vec![ConditionalSuffixes {
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
Expand All @@ -134,6 +140,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
TripleRelease {
suffixes: vec!["pgo"],
install_only_suffix: "pgo",
freethreaded_install_only_suffix: "freethreaded+pgo",
python_version_requirement: Some(VersionSpecifier::from_str(">=3.11").unwrap()),
conditional_suffixes: vec![ConditionalSuffixes {
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
Expand Down Expand Up @@ -170,6 +177,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
TripleRelease {
suffixes: linux_suffixes_pgo.clone(),
install_only_suffix: "pgo+lto",
freethreaded_install_only_suffix: "freethreaded+pgo+lto",
python_version_requirement: None,
conditional_suffixes: vec![ConditionalSuffixes {
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
Expand All @@ -183,6 +191,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
TripleRelease {
suffixes: linux_suffixes_nopgo.clone(),
install_only_suffix: "lto",
freethreaded_install_only_suffix: "freethreaded+lto",
python_version_requirement: Some(VersionSpecifier::from_str(">=3.10").unwrap()),
conditional_suffixes: vec![ConditionalSuffixes {
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
Expand All @@ -196,6 +205,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
TripleRelease {
suffixes: linux_suffixes_nopgo.clone(),
install_only_suffix: "lto",
freethreaded_install_only_suffix: "freethreaded+lto",
python_version_requirement: Some(VersionSpecifier::from_str(">=3.10").unwrap()),
conditional_suffixes: vec![ConditionalSuffixes {
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
Expand All @@ -209,6 +219,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
TripleRelease {
suffixes: linux_suffixes_nopgo.clone(),
install_only_suffix: "lto",
freethreaded_install_only_suffix: "freethreaded+lto",
python_version_requirement: Some(VersionSpecifier::from_str(">=3.10").unwrap()),
conditional_suffixes: vec![ConditionalSuffixes {
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
Expand All @@ -222,6 +233,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
TripleRelease {
suffixes: linux_suffixes_nopgo.clone(),
install_only_suffix: "lto",
freethreaded_install_only_suffix: "freethreaded+lto",
python_version_requirement: Some(VersionSpecifier::from_str(">=3.10").unwrap()),
conditional_suffixes: vec![ConditionalSuffixes {
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
Expand All @@ -235,6 +247,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
TripleRelease {
suffixes: linux_suffixes_nopgo.clone(),
install_only_suffix: "lto",
freethreaded_install_only_suffix: "freethreaded+lto",
python_version_requirement: Some(VersionSpecifier::from_str(">=3.10").unwrap()),
conditional_suffixes: vec![ConditionalSuffixes {
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
Expand All @@ -248,6 +261,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
TripleRelease {
suffixes: linux_suffixes_pgo.clone(),
install_only_suffix: "pgo+lto",
freethreaded_install_only_suffix: "freethreaded+pgo+lto",
python_version_requirement: None,
conditional_suffixes: vec![ConditionalSuffixes {
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
Expand All @@ -260,6 +274,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
TripleRelease {
suffixes: linux_suffixes_pgo.clone(),
install_only_suffix: "pgo+lto",
freethreaded_install_only_suffix: "freethreaded+pgo+lto",
python_version_requirement: Some(VersionSpecifier::from_str(">=3.10").unwrap()),
conditional_suffixes: vec![ConditionalSuffixes {
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
Expand All @@ -272,6 +287,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
TripleRelease {
suffixes: linux_suffixes_pgo.clone(),
install_only_suffix: "pgo+lto",
freethreaded_install_only_suffix: "freethreaded+pgo+lto",
python_version_requirement: Some(VersionSpecifier::from_str(">=3.10").unwrap()),
conditional_suffixes: vec![ConditionalSuffixes {
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
Expand All @@ -284,6 +300,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
TripleRelease {
suffixes: linux_suffixes_pgo.clone(),
install_only_suffix: "pgo+lto",
freethreaded_install_only_suffix: "freethreaded+pgo+lto",
python_version_requirement: Some(VersionSpecifier::from_str(">=3.10").unwrap()),
conditional_suffixes: vec![ConditionalSuffixes {
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
Expand All @@ -296,6 +313,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
TripleRelease {
suffixes: linux_suffixes_musl.clone(),
install_only_suffix: "lto",
freethreaded_install_only_suffix: "freethreaded+lto",
python_version_requirement: None,
conditional_suffixes: vec![ConditionalSuffixes {
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
Expand All @@ -308,6 +326,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
TripleRelease {
suffixes: linux_suffixes_musl.clone(),
install_only_suffix: "lto",
freethreaded_install_only_suffix: "freethreaded+lto",
python_version_requirement: None,
conditional_suffixes: vec![ConditionalSuffixes {
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
Expand All @@ -320,6 +339,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
TripleRelease {
suffixes: linux_suffixes_musl.clone(),
install_only_suffix: "lto",
freethreaded_install_only_suffix: "freethreaded+lto",
python_version_requirement: None,
conditional_suffixes: vec![ConditionalSuffixes {
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
Expand All @@ -332,6 +352,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
TripleRelease {
suffixes: linux_suffixes_musl.clone(),
install_only_suffix: "lto",
freethreaded_install_only_suffix: "freethreaded+lto",
python_version_requirement: None,
conditional_suffixes: vec![ConditionalSuffixes {
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
Expand All @@ -344,6 +365,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
TripleRelease {
suffixes: vec!["debug", "lto", "noopt"],
install_only_suffix: "lto",
freethreaded_install_only_suffix: "freethreaded+lto",
python_version_requirement: None,
conditional_suffixes: vec![ConditionalSuffixes {
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
Expand Down Expand Up @@ -404,6 +426,22 @@ pub fn build_wanted_filenames(
format!("cpython-{version}-{triple}-install_only_stripped-{datetime}.tar.gz"),
format!("cpython-{version}+{tag}-{triple}-install_only_stripped.tar.gz"),
);

// Free-threading only available for Python 3.13+
let freethreaded_conditional = VersionSpecifier::from_str(">=3.13.0rc0").unwrap();
if freethreaded_conditional.contains(&python_version) {
wanted_filenames.insert(
format!(
"cpython-{version}-{triple}-freethreaded-install_only-{datetime}.tar.gz"
),
format!("cpython-{version}+{tag}-{triple}-freethreaded-install_only.tar.gz"),
);

wanted_filenames.insert(
format!("cpython-{version}-{triple}-freethreaded-install_only_stripped-{datetime}.tar.gz"),
format!("cpython-{version}+{tag}-{triple}-freethreaded-install_only_stripped.tar.gz"),
);
}
}
}

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

name_parts[parts_len - 2] = "install_only".to_string();
if name_parts[flavor_idx].contains("freethreaded") {
name_parts
.splice(
flavor_idx..flavor_idx + 1,
["freethreaded".to_string(), "install_only".to_string()],
)
.for_each(drop);
} else {
name_parts[flavor_idx] = "install_only".to_string();
}

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

Ok(llvm_dir.join("llvm"))
}
Loading