From 516001ff4eea3cbb81f1af1cc038ec30c5559f9a Mon Sep 17 00:00:00 2001 From: Zsolt Dollenstein Date: Mon, 24 Feb 2025 10:54:00 +0000 Subject: [PATCH 1/2] create install only archives for conditional versions --- src/github.rs | 2 +- src/release.rs | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/github.rs b/src/github.rs index 8a432841..4930358e 100644 --- a/src/github.rs +++ b/src/github.rs @@ -293,7 +293,7 @@ pub async fn command_fetch_release_distributions(args: &ArgMatches) -> Result<() println!("prepared {} for release", name); - if build_suffix == release.install_only_suffix { + if build_suffix == release.install_only_suffix(Some(&python_version)) { install_paths.push(dest_path); } } diff --git a/src/release.rs b/src/release.rs index f0c70f62..8b8a0e33 100644 --- a/src/release.rs +++ b/src/release.rs @@ -43,6 +43,8 @@ pub struct ConditionalSuffixes { pub python_version_requirement: VersionSpecifier, /// Build suffixes to release. pub suffixes: Vec<&'static str>, + /// Build suffix to use for the `install_only` artifact. + pub install_only_suffix: &'static str, } impl TripleRelease { @@ -71,6 +73,20 @@ impl TripleRelease { }), ) } + + pub fn install_only_suffix<'a>( + &'a self, + python_version: Option<&'a pep440_rs::Version>, + ) -> &'static str { + if let Some(version) = python_version { + for conditional in self.conditional_suffixes.iter() { + if conditional.python_version_requirement.contains(version) { + return conditional.install_only_suffix; + } + } + } + self.install_only_suffix + } } pub static RELEASE_TRIPLES: Lazy> = Lazy::new(|| { @@ -79,6 +95,7 @@ pub static RELEASE_TRIPLES: Lazy> = Lazy:: // macOS. let macos_suffixes = vec!["debug", "pgo+lto"]; let macos_suffixes_313 = vec!["freethreaded+debug", "freethreaded+pgo+lto"]; + let macos_install_only_suffix_313 = "freethreaded+pgo+lto"; h.insert( "aarch64-apple-darwin", TripleRelease { @@ -88,6 +105,7 @@ pub static RELEASE_TRIPLES: Lazy> = Lazy:: conditional_suffixes: vec![ConditionalSuffixes { python_version_requirement: VersionSpecifier::from_str(">=3.13.0rc0").unwrap(), suffixes: macos_suffixes_313.clone(), + install_only_suffix: macos_install_only_suffix_313, }], }, ); @@ -100,6 +118,7 @@ pub static RELEASE_TRIPLES: Lazy> = Lazy:: conditional_suffixes: vec![ConditionalSuffixes { python_version_requirement: VersionSpecifier::from_str(">=3.13.0rc0").unwrap(), suffixes: macos_suffixes_313.clone(), + install_only_suffix: macos_install_only_suffix_313, }], }, ); @@ -114,6 +133,7 @@ pub static RELEASE_TRIPLES: Lazy> = Lazy:: conditional_suffixes: vec![ConditionalSuffixes { python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(), suffixes: vec!["freethreaded+pgo"], + install_only_suffix: "freethreaded+pgo", }], }, ); @@ -126,6 +146,7 @@ pub static RELEASE_TRIPLES: Lazy> = Lazy:: conditional_suffixes: vec![ConditionalSuffixes { python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(), suffixes: vec!["freethreaded+pgo"], + install_only_suffix: "freethreaded+pgo", }], }, ); @@ -141,6 +162,7 @@ pub static RELEASE_TRIPLES: Lazy> = Lazy:: conditional_suffixes: vec![ConditionalSuffixes { python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(), suffixes: vec!["freethreaded+pgo"], + install_only_suffix: "freethreaded+pgo", }], }, ); @@ -153,6 +175,7 @@ pub static RELEASE_TRIPLES: Lazy> = Lazy:: conditional_suffixes: vec![ConditionalSuffixes { python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(), suffixes: vec!["freethreaded+pgo"], + install_only_suffix: "freethreaded+pgo", }], }, ); @@ -161,11 +184,13 @@ pub static RELEASE_TRIPLES: Lazy> = Lazy:: let linux_suffixes_pgo = vec!["debug", "pgo+lto"]; let linux_suffixes_nopgo = vec!["debug", "lto", "noopt"]; let linux_suffixes_pgo_freethreaded = vec!["freethreaded+debug", "freethreaded+pgo+lto"]; + let linux_install_only_suffixes_pgo_freethreaded = "freethreaded+pgo+lto"; let linux_suffixes_nopgo_freethreaded = vec![ "freethreaded+debug", "freethreaded+lto", "freethreaded+noopt", ]; + let linux_install_only_suffixes_nopgo_freethreaded = "freethreaded+lto"; h.insert( "aarch64-unknown-linux-gnu", @@ -176,6 +201,7 @@ pub static RELEASE_TRIPLES: Lazy> = Lazy:: conditional_suffixes: vec![ConditionalSuffixes { python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(), suffixes: linux_suffixes_nopgo_freethreaded.clone(), + install_only_suffix: linux_install_only_suffixes_nopgo_freethreaded, }], }, ); @@ -189,6 +215,7 @@ pub static RELEASE_TRIPLES: Lazy> = Lazy:: conditional_suffixes: vec![ConditionalSuffixes { python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(), suffixes: linux_suffixes_nopgo_freethreaded.clone(), + install_only_suffix: linux_install_only_suffixes_nopgo_freethreaded, }], }, ); @@ -202,6 +229,7 @@ pub static RELEASE_TRIPLES: Lazy> = Lazy:: conditional_suffixes: vec![ConditionalSuffixes { python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(), suffixes: linux_suffixes_nopgo_freethreaded.clone(), + install_only_suffix: linux_install_only_suffixes_nopgo_freethreaded, }], }, ); @@ -215,6 +243,7 @@ pub static RELEASE_TRIPLES: Lazy> = Lazy:: conditional_suffixes: vec![ConditionalSuffixes { python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(), suffixes: linux_suffixes_nopgo_freethreaded.clone(), + install_only_suffix: linux_install_only_suffixes_nopgo_freethreaded, }], }, ); @@ -228,6 +257,7 @@ pub static RELEASE_TRIPLES: Lazy> = Lazy:: conditional_suffixes: vec![ConditionalSuffixes { python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(), suffixes: linux_suffixes_nopgo_freethreaded.clone(), + install_only_suffix: linux_install_only_suffixes_nopgo_freethreaded, }], }, ); @@ -241,6 +271,7 @@ pub static RELEASE_TRIPLES: Lazy> = Lazy:: conditional_suffixes: vec![ConditionalSuffixes { python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(), suffixes: linux_suffixes_nopgo_freethreaded.clone(), + install_only_suffix: linux_install_only_suffixes_nopgo_freethreaded, }], }, ); @@ -254,6 +285,7 @@ pub static RELEASE_TRIPLES: Lazy> = Lazy:: conditional_suffixes: vec![ConditionalSuffixes { python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(), suffixes: linux_suffixes_pgo_freethreaded.clone(), + install_only_suffix: linux_install_only_suffixes_pgo_freethreaded, }], }, ); @@ -266,6 +298,7 @@ pub static RELEASE_TRIPLES: Lazy> = Lazy:: conditional_suffixes: vec![ConditionalSuffixes { python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(), suffixes: linux_suffixes_pgo_freethreaded.clone(), + install_only_suffix: linux_install_only_suffixes_pgo_freethreaded, }], }, ); @@ -278,6 +311,7 @@ pub static RELEASE_TRIPLES: Lazy> = Lazy:: conditional_suffixes: vec![ConditionalSuffixes { python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(), suffixes: linux_suffixes_pgo_freethreaded.clone(), + install_only_suffix: linux_install_only_suffixes_pgo_freethreaded, }], }, ); @@ -290,6 +324,7 @@ pub static RELEASE_TRIPLES: Lazy> = Lazy:: conditional_suffixes: vec![ConditionalSuffixes { python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(), suffixes: linux_suffixes_pgo_freethreaded.clone(), + install_only_suffix: linux_install_only_suffixes_pgo_freethreaded, }], }, ); From d500ded934a6e1530caa3d4b1a0d990cb69f7670 Mon Sep 17 00:00:00 2001 From: Zsolt Dollenstein Date: Mon, 24 Feb 2025 22:05:54 +0000 Subject: [PATCH 2/2] keep freethreaded tag in install_only archive --- src/release.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/release.rs b/src/release.rs index 8b8a0e33..b0dcf203 100644 --- a/src/release.rs +++ b/src/release.rs @@ -560,8 +560,18 @@ pub fn produce_install_only(tar_zst_path: &Path) -> Result { .map(|x| x.to_string()) .collect::>(); 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");