From 049444dc6b48fcebddbb90d7ab01c5a6fba85902 Mon Sep 17 00:00:00 2001 From: Robert Scott Date: Tue, 26 Jan 2021 20:39:00 +0000 Subject: [PATCH] cpython: expose libpython.py for debugging from gdb --- pkgs/development/interpreters/python/cpython/default.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkgs/development/interpreters/python/cpython/default.nix b/pkgs/development/interpreters/python/cpython/default.nix index 99d0ae24b7b8..3d4cee22b2c2 100644 --- a/pkgs/development/interpreters/python/cpython/default.nix +++ b/pkgs/development/interpreters/python/cpython/default.nix @@ -445,6 +445,13 @@ in with passthru; stdenv.mkDerivation { find $out -name "*.py" | ${pythonForBuildInterpreter} -m compileall -q -f -x "lib2to3" -i - find $out -name "*.py" | ${pythonForBuildInterpreter} -O -m compileall -q -f -x "lib2to3" -i - find $out -name "*.py" | ${pythonForBuildInterpreter} -OO -m compileall -q -f -x "lib2to3" -i - + '' + '' + # *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 - we don't want bytecode generated. + mkdir -p $out/share/gdb + sed '/^#!/d' Tools/gdb/libpython.py > $out/share/gdb/libpython.py ''; preFixup = lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''