Skip to content

Commit 516001f

Browse files
committed
create install only archives for conditional versions
1 parent aa430e2 commit 516001f

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

src/github.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ pub async fn command_fetch_release_distributions(args: &ArgMatches) -> Result<()
293293

294294
println!("prepared {} for release", name);
295295

296-
if build_suffix == release.install_only_suffix {
296+
if build_suffix == release.install_only_suffix(Some(&python_version)) {
297297
install_paths.push(dest_path);
298298
}
299299
}

src/release.rs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ pub struct ConditionalSuffixes {
4343
pub python_version_requirement: VersionSpecifier,
4444
/// Build suffixes to release.
4545
pub suffixes: Vec<&'static str>,
46+
/// Build suffix to use for the `install_only` artifact.
47+
pub install_only_suffix: &'static str,
4648
}
4749

4850
impl TripleRelease {
@@ -71,6 +73,20 @@ impl TripleRelease {
7173
}),
7274
)
7375
}
76+
77+
pub fn install_only_suffix<'a>(
78+
&'a self,
79+
python_version: Option<&'a pep440_rs::Version>,
80+
) -> &'static str {
81+
if let Some(version) = python_version {
82+
for conditional in self.conditional_suffixes.iter() {
83+
if conditional.python_version_requirement.contains(version) {
84+
return conditional.install_only_suffix;
85+
}
86+
}
87+
}
88+
self.install_only_suffix
89+
}
7490
}
7591

7692
pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::new(|| {
@@ -79,6 +95,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
7995
// macOS.
8096
let macos_suffixes = vec!["debug", "pgo+lto"];
8197
let macos_suffixes_313 = vec!["freethreaded+debug", "freethreaded+pgo+lto"];
98+
let macos_install_only_suffix_313 = "freethreaded+pgo+lto";
8299
h.insert(
83100
"aarch64-apple-darwin",
84101
TripleRelease {
@@ -88,6 +105,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
88105
conditional_suffixes: vec![ConditionalSuffixes {
89106
python_version_requirement: VersionSpecifier::from_str(">=3.13.0rc0").unwrap(),
90107
suffixes: macos_suffixes_313.clone(),
108+
install_only_suffix: macos_install_only_suffix_313,
91109
}],
92110
},
93111
);
@@ -100,6 +118,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
100118
conditional_suffixes: vec![ConditionalSuffixes {
101119
python_version_requirement: VersionSpecifier::from_str(">=3.13.0rc0").unwrap(),
102120
suffixes: macos_suffixes_313.clone(),
121+
install_only_suffix: macos_install_only_suffix_313,
103122
}],
104123
},
105124
);
@@ -114,6 +133,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
114133
conditional_suffixes: vec![ConditionalSuffixes {
115134
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
116135
suffixes: vec!["freethreaded+pgo"],
136+
install_only_suffix: "freethreaded+pgo",
117137
}],
118138
},
119139
);
@@ -126,6 +146,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
126146
conditional_suffixes: vec![ConditionalSuffixes {
127147
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
128148
suffixes: vec!["freethreaded+pgo"],
149+
install_only_suffix: "freethreaded+pgo",
129150
}],
130151
},
131152
);
@@ -141,6 +162,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
141162
conditional_suffixes: vec![ConditionalSuffixes {
142163
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
143164
suffixes: vec!["freethreaded+pgo"],
165+
install_only_suffix: "freethreaded+pgo",
144166
}],
145167
},
146168
);
@@ -153,6 +175,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
153175
conditional_suffixes: vec![ConditionalSuffixes {
154176
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
155177
suffixes: vec!["freethreaded+pgo"],
178+
install_only_suffix: "freethreaded+pgo",
156179
}],
157180
},
158181
);
@@ -161,11 +184,13 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
161184
let linux_suffixes_pgo = vec!["debug", "pgo+lto"];
162185
let linux_suffixes_nopgo = vec!["debug", "lto", "noopt"];
163186
let linux_suffixes_pgo_freethreaded = vec!["freethreaded+debug", "freethreaded+pgo+lto"];
187+
let linux_install_only_suffixes_pgo_freethreaded = "freethreaded+pgo+lto";
164188
let linux_suffixes_nopgo_freethreaded = vec![
165189
"freethreaded+debug",
166190
"freethreaded+lto",
167191
"freethreaded+noopt",
168192
];
193+
let linux_install_only_suffixes_nopgo_freethreaded = "freethreaded+lto";
169194

170195
h.insert(
171196
"aarch64-unknown-linux-gnu",
@@ -176,6 +201,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
176201
conditional_suffixes: vec![ConditionalSuffixes {
177202
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
178203
suffixes: linux_suffixes_nopgo_freethreaded.clone(),
204+
install_only_suffix: linux_install_only_suffixes_nopgo_freethreaded,
179205
}],
180206
},
181207
);
@@ -189,6 +215,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
189215
conditional_suffixes: vec![ConditionalSuffixes {
190216
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
191217
suffixes: linux_suffixes_nopgo_freethreaded.clone(),
218+
install_only_suffix: linux_install_only_suffixes_nopgo_freethreaded,
192219
}],
193220
},
194221
);
@@ -202,6 +229,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
202229
conditional_suffixes: vec![ConditionalSuffixes {
203230
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
204231
suffixes: linux_suffixes_nopgo_freethreaded.clone(),
232+
install_only_suffix: linux_install_only_suffixes_nopgo_freethreaded,
205233
}],
206234
},
207235
);
@@ -215,6 +243,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
215243
conditional_suffixes: vec![ConditionalSuffixes {
216244
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
217245
suffixes: linux_suffixes_nopgo_freethreaded.clone(),
246+
install_only_suffix: linux_install_only_suffixes_nopgo_freethreaded,
218247
}],
219248
},
220249
);
@@ -228,6 +257,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
228257
conditional_suffixes: vec![ConditionalSuffixes {
229258
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
230259
suffixes: linux_suffixes_nopgo_freethreaded.clone(),
260+
install_only_suffix: linux_install_only_suffixes_nopgo_freethreaded,
231261
}],
232262
},
233263
);
@@ -241,6 +271,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
241271
conditional_suffixes: vec![ConditionalSuffixes {
242272
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
243273
suffixes: linux_suffixes_nopgo_freethreaded.clone(),
274+
install_only_suffix: linux_install_only_suffixes_nopgo_freethreaded,
244275
}],
245276
},
246277
);
@@ -254,6 +285,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
254285
conditional_suffixes: vec![ConditionalSuffixes {
255286
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
256287
suffixes: linux_suffixes_pgo_freethreaded.clone(),
288+
install_only_suffix: linux_install_only_suffixes_pgo_freethreaded,
257289
}],
258290
},
259291
);
@@ -266,6 +298,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
266298
conditional_suffixes: vec![ConditionalSuffixes {
267299
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
268300
suffixes: linux_suffixes_pgo_freethreaded.clone(),
301+
install_only_suffix: linux_install_only_suffixes_pgo_freethreaded,
269302
}],
270303
},
271304
);
@@ -278,6 +311,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
278311
conditional_suffixes: vec![ConditionalSuffixes {
279312
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
280313
suffixes: linux_suffixes_pgo_freethreaded.clone(),
314+
install_only_suffix: linux_install_only_suffixes_pgo_freethreaded,
281315
}],
282316
},
283317
);
@@ -290,6 +324,7 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
290324
conditional_suffixes: vec![ConditionalSuffixes {
291325
python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(),
292326
suffixes: linux_suffixes_pgo_freethreaded.clone(),
327+
install_only_suffix: linux_install_only_suffixes_pgo_freethreaded,
293328
}],
294329
},
295330
);

0 commit comments

Comments
 (0)