Skip to content

Commit b631692

Browse files
committed
rust: remove static libpython from install_only archives
On the 3.10 x86_64-unknown-linux-gnu archive, this reduces the total size of the archive from 41,109,089 to 29,628,194 bytes. This makes it almost as small as the zstd compressed full archives. ~72% of original for a file that most people likely don't use seems like a reasonable trade-off to me. Part of #134.
1 parent 1444836 commit b631692

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/release.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,20 @@ pub fn convert_to_install_only<W: Write>(reader: impl BufRead, writer: W) -> Res
185185
for entry in tar_in.entries()? {
186186
let mut entry = entry?;
187187

188-
if !entry.path_bytes().starts_with(b"python/install/") {
188+
let path_bytes = entry.path_bytes();
189+
190+
if !path_bytes.starts_with(b"python/install/") {
191+
continue;
192+
}
193+
194+
// Also strip the libpython static library, as it significantly
195+
// increases the size of the archive and isn't needed in most cases.
196+
if path_bytes
197+
.windows(b"/libpython".len())
198+
.position(|x| x == b"/libpython")
199+
.is_some()
200+
&& path_bytes.ends_with(b".a")
201+
{
189202
continue;
190203
}
191204

0 commit comments

Comments
 (0)