Skip to content

Commit 2359295

Browse files
charliermarshzanieb
authored andcommitted
Add install_only_stripped binaries to release (astral-sh#279)
This PR adds an `install_only_stripped` variant, which is generated by taking the `install_only` variant and removing debug symbols. Closes astral-sh#277. Closes astral-sh#174. Related to astral-sh#275. On macOS: - Downloaded [cpython-3.10.14+20240713-aarch64-apple-darwin-install_only.tar.gz](https://github.com/indygreg/python-build-standalone/releases/download/20240713/cpython-3.10.14+20240713-aarch64-apple-darwin-install_only.tar.gz) locally. - Ran: `cargo run convert-install-only-stripped cpython-3.10.14+20240713-aarch64-apple-darwin-install_only.tar.gz`. - Relocated `cpython-3.10.14+20240713-aarch64-apple-darwin-install_only_stripped.tar.gz` to another directory. - Unzipped `cpython-3.10.14+20240713-aarch64-apple-darwin-install_only.tar.gz`. - Ran `./python` in `python/python/bin`. Performed the same procedure on Windows.
1 parent 24d2cc4 commit 2359295

File tree

7 files changed

+336
-16
lines changed

7 files changed

+336
-16
lines changed

Cargo.lock

Lines changed: 47 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,13 @@ normalize-path = "0.2.1"
2222
object = "0.32.2"
2323
octocrab = { version = "0.34.1", features = ["rustls", "stream"] }
2424
once_cell = "1.19.0"
25+
pdb = "0.8.0"
2526
rayon = "1.8.1"
26-
reqwest = { version = "0.11.24", features = ["rustls"] }
27+
reqwest = { version = "0.11.24", features = ["rustls", "stream"] }
2728
scroll = "0.12.0"
2829
semver = "1.0.22"
29-
serde_json = "1.0.114"
3030
serde = { version = "1.0.197", features = ["derive"] }
31+
serde_json = "1.0.114"
3132
sha2 = "0.10.8"
3233
tar = "0.4.40"
3334
tempfile = "3.10.0"

docs/running.rst

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,17 @@ Common configurations include:
151151
A debug build. No optimizations.
152152

153153
The archive flavor denotes the content in the archive. See
154-
:ref:`distributions` for more. Casual users will likely want to use the
155-
``install_only`` archive, as most users do not need the build artifacts
156-
present in the ``full`` archive. The ``install_only`` archive doesn't
157-
include the build configuration in its file name. It's based on the fastest
158-
available build configuration for a given target.
154+
:ref:`distributions` for more.
155+
156+
Casual users will likely want to use the ``install_only`` archive, as most
157+
users do not need the build artifacts present in the ``full`` archive.
158+
The ``install_only`` archive doesn't include the build configuration in its
159+
file name. It's based on the fastest available build configuration for a given
160+
target.
161+
162+
An ``install_only_stripped`` archive is also available. This archive is
163+
equivalent to ``install_only``, but without debug symbols, which results in a
164+
smaller download and on-disk footprint.
159165

160166
Extracting Distributions
161167
========================

pythonbuild/downloads.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,18 +175,21 @@
175175
"sha256": "04cb77c660f09df017a57738ae9635ef23a506024789f2f18da1304b45af2023",
176176
"version": "14.0.3+20220508",
177177
},
178+
# Remember to update LLVM_URL in src/release.rs whenever upgrading.
178179
"llvm-18-x86_64-linux": {
179180
"url": "https://github.com/indygreg/toolchain-tools/releases/download/toolchain-bootstrap%2F20240713/llvm-18.0.8+20240713-gnu_only-x86_64-unknown-linux-gnu.tar.zst",
180181
"size": 242840506,
181182
"sha256": "080c233fc7d75031b187bbfef62a4f9abc01188effb0c68fbc7dc4bc7370ee5b",
182183
"version": "18.0.8+20240713",
183184
},
185+
# Remember to update LLVM_URL in src/release.rs whenever upgrading.
184186
"llvm-aarch64-macos": {
185187
"url": "https://github.com/indygreg/toolchain-tools/releases/download/toolchain-bootstrap%2F20240713/llvm-18.0.8+20240713-aarch64-apple-darwin.tar.zst",
186188
"size": 136598617,
187189
"sha256": "320da8d639186e020e7d54cdc35b7a5473b36cef08fdf7b22c03b59a273ba593",
188190
"version": "18.0.8+20240713",
189191
},
192+
# Remember to update LLVM_URL in src/release.rs whenever upgrading.
190193
"llvm-x86_64-macos": {
191194
"url": "https://github.com/indygreg/toolchain-tools/releases/download/toolchain-bootstrap%2F20240713/llvm-18.0.8+20240713-x86_64-apple-darwin.tar.zst",
192195
"size": 136599290,

src/github.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// License, v. 2.0. If a copy of the MPL was not distributed with this
33
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
44

5+
use crate::release::{bootstrap_llvm, produce_install_only_stripped};
56
use {
67
crate::release::{produce_install_only, RELEASE_TRIPLES},
78
anyhow::{anyhow, Result},
@@ -256,9 +257,12 @@ pub async fn command_fetch_release_distributions(args: &ArgMatches) -> Result<()
256257
}
257258
}
258259

260+
let llvm_dir = bootstrap_llvm().await?;
261+
259262
install_paths
260263
.par_iter()
261264
.try_for_each(|path| -> Result<()> {
265+
// Create the `install_only` archive.
262266
println!(
263267
"producing install_only archive from {}",
264268
path.file_name()
@@ -276,6 +280,25 @@ pub async fn command_fetch_release_distributions(args: &ArgMatches) -> Result<()
276280
.to_string_lossy()
277281
);
278282

283+
// Create the `install_only_stripped` archive.
284+
println!(
285+
"producing install_only_stripped archive from {}",
286+
dest_path
287+
.file_name()
288+
.expect("should have file name")
289+
.to_string_lossy()
290+
);
291+
292+
let dest_path = produce_install_only_stripped(&dest_path, &llvm_dir)?;
293+
294+
println!(
295+
"releasing {}",
296+
dest_path
297+
.file_name()
298+
.expect("should have file name")
299+
.to_string_lossy()
300+
);
301+
279302
Ok(())
280303
})?;
281304

@@ -358,6 +381,17 @@ pub async fn command_upload_release_distributions(args: &ArgMatches) -> Result<(
358381
),
359382
format!("cpython-{}+{}-{}-install_only.tar.gz", version, tag, triple),
360383
);
384+
385+
wanted_filenames.insert(
386+
format!(
387+
"cpython-{}-{}-install_only-{}.tar.gz",
388+
version, triple, datetime
389+
),
390+
format!(
391+
"cpython-{}+{}-{}-install_only_stripped.tar.gz",
392+
version, tag, triple
393+
),
394+
);
361395
}
362396
}
363397

src/main.rs

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,18 @@ fn main_impl() -> Result<()> {
8585
),
8686
);
8787

88+
let app = app.subcommand(
89+
Command::new("convert-install-only-stripped")
90+
.about("Convert an install_only .tar.gz archive to an install_only_stripped tar.gz archive")
91+
.arg(
92+
Arg::new("path")
93+
.required(true)
94+
.action(ArgAction::Append)
95+
.value_parser(value_parser!(PathBuf))
96+
.help("Path of archive to convert"),
97+
),
98+
);
99+
88100
let app = app.subcommand(
89101
Command::new("upload-release-distributions")
90102
.about("Upload release distributions to a GitHub release")
@@ -174,7 +186,20 @@ fn main_impl() -> Result<()> {
174186
match matches.subcommand() {
175187
Some(("convert-install-only", args)) => {
176188
for path in args.get_many::<PathBuf>("path").unwrap() {
177-
let dest_path = crate::release::produce_install_only(path)?;
189+
let dest_path = release::produce_install_only(path)?;
190+
println!("wrote {}", dest_path.display());
191+
}
192+
193+
Ok(())
194+
}
195+
Some(("convert-install-only-stripped", args)) => {
196+
let llvm_dir = tokio::runtime::Builder::new_current_thread()
197+
.enable_all()
198+
.build()
199+
.unwrap()
200+
.block_on(release::bootstrap_llvm())?;
201+
for path in args.get_many::<PathBuf>("path").unwrap() {
202+
let dest_path = release::produce_install_only_stripped(path, &llvm_dir)?;
178203
println!("wrote {}", dest_path.display());
179204
}
180205

@@ -185,18 +210,16 @@ fn main_impl() -> Result<()> {
185210
.enable_all()
186211
.build()
187212
.unwrap()
188-
.block_on(crate::github::command_fetch_release_distributions(args))
213+
.block_on(github::command_fetch_release_distributions(args))
189214
}
190215
Some(("upload-release-distributions", args)) => {
191216
tokio::runtime::Builder::new_current_thread()
192217
.enable_all()
193218
.build()
194219
.unwrap()
195-
.block_on(crate::github::command_upload_release_distributions(args))
196-
}
197-
Some(("validate-distribution", args)) => {
198-
crate::validation::command_validate_distribution(args)
220+
.block_on(github::command_upload_release_distributions(args))
199221
}
222+
Some(("validate-distribution", args)) => validation::command_validate_distribution(args),
200223
_ => Err(anyhow!("invalid sub-command")),
201224
}
202225
}

0 commit comments

Comments
 (0)