diff --git a/pkgs/development/python-modules/debugpy/default.nix b/pkgs/development/python-modules/debugpy/default.nix index c45d6621398f..4035cc52328e 100644 --- a/pkgs/development/python-modules/debugpy/default.nix +++ b/pkgs/development/python-modules/debugpy/default.nix @@ -13,6 +13,7 @@ , pytest-xdist , pytestCheckHook , requests +, llvmPackages }: buildPythonPackage rec { @@ -30,12 +31,6 @@ buildPythonPackage rec { }; patches = [ - # Hard code GDB path (used to attach to process) - (substituteAll { - src = ./hardcode-gdb.patch; - inherit gdb; - }) - # Use nixpkgs version instead of versioneer (substituteAll { src = ./hardcode-version.patch; @@ -51,6 +46,18 @@ buildPythonPackage rec { # To avoid this issue, debugpy should be installed using python.withPackages: # python.withPackages (ps: with ps; [ debugpy ]) ./fix-test-pythonpath.patch + ] ++ lib.optionals stdenv.isLinux [ + # Hard code GDB path (used to attach to process) + (substituteAll { + src = ./hardcode-gdb.patch; + inherit gdb; + }) + ] ++ lib.optionals stdenv.isDarwin [ + # Hard code LLDB path (used to attach to process) + (substituteAll { + src = ./hardcode-lldb.patch; + inherit (llvmPackages) lldb; + }) ]; # Remove pre-compiled "attach" libraries and recompile for host platform diff --git a/pkgs/development/python-modules/debugpy/hardcode-lldb.patch b/pkgs/development/python-modules/debugpy/hardcode-lldb.patch new file mode 100644 index 000000000000..43ededa083cf --- /dev/null +++ b/pkgs/development/python-modules/debugpy/hardcode-lldb.patch @@ -0,0 +1,13 @@ +diff --git a/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/add_code_to_python_process.py b/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/add_code_to_python_process.py +index ed43e370..b28ab453 100644 +--- a/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/add_code_to_python_process.py ++++ b/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/add_code_to_python_process.py +@@ -494,7 +494,7 @@ def run_python_code_mac(pid, python_code, connect_debugger_tracing=False, show_d + is_debug = 0 + # Note that the space in the beginning of each line in the multi-line is important! + cmd = [ +- 'lldb', ++ '@lldb@/bin/lldb', + '--no-lldbinit', # Do not automatically parse any '.lldbinit' files. + # '--attach-pid', + # str(pid),