python37: remove references to openssl.dev

This commit is contained in:
Frederik Rietdijk 2018-12-08 13:19:02 +01:00
parent ae0f5d2705
commit 2526f9f157

View File

@ -14,6 +14,7 @@
, self , self
, CF, configd , CF, configd
, python-setup-hook , python-setup-hook
, nukeReferences
# For the Python package set # For the Python package set
, packageOverrides ? (self: super: {}) , packageOverrides ? (self: super: {})
, buildPackages , buildPackages
@ -34,7 +35,7 @@ let
sitePackages = "lib/${libPrefix}/site-packages"; sitePackages = "lib/${libPrefix}/site-packages";
buildInputs = filter (p: p != null) [ buildInputs = filter (p: p != null) [
zlib bzip2 expat lzma libffi gdbm sqlite readline ncurses openssl ] zlib bzip2 expat lzma libffi gdbm sqlite readline ncurses openssl nukeReferences ]
++ optionals x11Support [ tcl tk libX11 xproto ] ++ optionals x11Support [ tcl tk libX11 xproto ]
++ optionals stdenv.isDarwin [ CF configd ]; ++ optionals stdenv.isDarwin [ CF configd ];
@ -173,9 +174,14 @@ in stdenv.mkDerivation {
# some $TMPDIR references to improve binary reproducibility. # some $TMPDIR references to improve binary reproducibility.
# Note that the .pyc file of _sysconfigdata.py should be regenerated! # Note that the .pyc file of _sysconfigdata.py should be regenerated!
for i in $out/lib/python${majorVersion}/_sysconfigdata*.py $out/lib/python${majorVersion}/config-${majorVersion}m*/Makefile; do 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|-L/nix/store/[^ ']*||g" -e "s|$TMPDIR|/no-such-path|g" sed -i $i -e "s|$TMPDIR|/no-such-path|g"
nuke-refs $i
done done
# Further get rid of references. https://github.com/NixOS/nixpkgs/issues/51668
find $out/lib/python*/config-*-* -type f -print -exec nuke-refs '{}' +
find $out/lib -name '_sysconfigdata_m*.py*' -print -exec nuke-refs '{}' +
# Determinism: rebuild all bytecode # Determinism: rebuild all bytecode
# We exclude lib2to3 because that's Python 2 code which fails # We exclude lib2to3 because that's Python 2 code which fails
# We rebuild three times, once for each optimization level # We rebuild three times, once for each optimization level
@ -186,6 +192,10 @@ in stdenv.mkDerivation {
find $out -name "*.py" | ${pythonForBuild} -OO -m compileall -q -f -x "lib2to3" -i - find $out -name "*.py" | ${pythonForBuild} -OO -m compileall -q -f -x "lib2to3" -i -
''; '';
# Enforce that we don't have references to the OpenSSL -dev package, which we
# explicitly specify in our configure flags above.
disallowedReferences = [ openssl.dev ];
passthru = let passthru = let
pythonPackages = callPackage ../../../../../top-level/python-packages.nix { pythonPackages = callPackage ../../../../../top-level/python-packages.nix {
python = self; python = self;