diff options
Diffstat (limited to 'nixpkgs/pkgs/development/interpreters/python/cpython/default.nix')
-rw-r--r-- | nixpkgs/pkgs/development/interpreters/python/cpython/default.nix | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/default.nix b/nixpkgs/pkgs/development/interpreters/python/cpython/default.nix index 59067276f76e..b25d613eb7f3 100644 --- a/nixpkgs/pkgs/development/interpreters/python/cpython/default.nix +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/default.nix @@ -9,6 +9,7 @@ , readline , sqlite , tcl ? null, tk ? null, tix ? null, libX11 ? null, xorgproto ? null, x11Support ? false +, bluez ? null, bluezSupport ? false , zlib , self , configd @@ -45,6 +46,9 @@ assert x11Support -> tcl != null && tk != null && xorgproto != null && libX11 != null; + +assert bluezSupport -> bluez != null; + with stdenv.lib; let @@ -73,6 +77,7 @@ let buildInputs = filter (p: p != null) ([ zlib bzip2 expat lzma libffi gdbm sqlite readline ncurses openssl ] ++ optionals x11Support [ tcl tk libX11 xorgproto ] + ++ optionals (bluezSupport && stdenv.isLinux) [ bluez ] ++ optionals stdenv.isDarwin [ configd ]); hasDistutilsCxxPatch = !(stdenv.cc.isGNU or false); @@ -145,9 +150,14 @@ in with passthru; stdenv.mkDerivation { sha256 = "1h18lnpx539h5lfxyk379dxwr8m2raigcjixkf133l4xy3f4bzi2"; } ) + ] ++ [ + # LDSHARED now uses $CC instead of gcc. Fixes cross-compilation of extension modules. + ./3.8/0001-On-all-posix-systems-not-just-Darwin-set-LDSHARED-if.patch ]; postPatch = '' + substituteInPlace Lib/subprocess.py \ + --replace "'/bin/sh'" "'${bash}/bin/sh'" '' + optionalString (x11Support && (tix != null)) '' substituteInPlace "Lib/tkinter/tix.py" --replace "os.environ.get('TIX_LIBRARY')" "os.environ.get('TIX_LIBRARY') or '${tix}/lib'" ''; @@ -281,6 +291,13 @@ in with passthru; stdenv.mkDerivation { find $out -name "*.py" | ${pythonForBuildInterpreter} -OO -m compileall -q -f -x "lib2to3" -i - '' + optionalString stripBytecode '' find $out -type d -name __pycache__ -print0 | xargs -0 -I {} rm -rf "{}" + '' + '' + # *strip* shebang from libpython gdb script - it should be dual-syntax and + # interpretable by whatever python the gdb in question is using, which may + # not even match the major version of this python. doing this after the + # bytecode compilations for the same reason. + mkdir -p $out/share/gdb + sed '/^#!/d' Tools/gdb/libpython.py > $out/share/gdb/libpython.py ''; preFixup = stdenv.lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) '' @@ -298,6 +315,8 @@ in with passthru; stdenv.mkDerivation { pythonForBuild buildPackages.bash ]; + separateDebugInfo = true; + inherit passthru; enableParallelBuilding = true; |