python-3.5: Eliminate -dev paths from the runtime closure

This reduces Python's closure size from 200 MiB to 129 MiB. Even
better would be to get move tkinter to a separate output or package
(since that would get rid of all X11 stuff), but that's a bit harder.
This commit is contained in:
Eelco Dolstra 2016-09-01 15:20:49 +02:00
parent b31870fe13
commit 168192f116

View File

@ -95,6 +95,17 @@ stdenv.mkDerivation {
paxmark E $out/bin/python${majorVersion}
'';
postFixup = ''
# Get rid of retained dependencies on -dev packages, and remove
# some $TMPDIR references to improve binary reproducibility.
for i in $out/lib//python${majorVersion}/_sysconfigdata.py $out/lib/python${majorVersion}/config-${majorVersion}m/Makefile; do
sed -i $i -e "s|-I/nix/store/[^ ']*||g" -e "s|$TMPDIR|/no-such-path|g"
done
# FIXME: should regenerate this.
rm $out/lib/python${majorVersion}/__pycache__/_sysconfigdata.cpython*
'';
passthru = rec {
zlibSupport = zlib != null;
sqliteSupport = sqlite != null;