push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,165 @@
{
lib,
stdenv,
buildPythonPackage,
pythonAtLeast,
fetchFromGitHub,
replaceVars,
gdb,
lldb,
setuptools,
pytestCheckHook,
pytest-xdist,
pytest-timeout,
pytest-retry,
importlib-metadata,
psutil,
untangle,
django,
flask,
gevent,
numpy,
requests,
typing-extensions,
}:
buildPythonPackage rec {
pname = "debugpy";
version = "1.8.17";
pyproject = true;
src = fetchFromGitHub {
owner = "microsoft";
repo = "debugpy";
tag = "v${version}";
hash = "sha256-U9WeWAX0qDusWcMsFaI1ct4YKlGQEHUYlKZfRiYhma0=";
};
patches = [
# Use nixpkgs version instead of versioneer
(replaceVars ./hardcode-version.patch {
inherit version;
})
# Fix importing debugpy in:
# - test_nodebug[module-launch(externalTerminal)]
# - test_nodebug[module-launch(integratedTerminal)]
#
# NOTE: The import failures seen in these tests without the patch
# will be seen if a user "installs" debugpy by adding it to PYTHONPATH.
# To avoid this issue, debugpy should be installed using python.withPackages:
# python.withPackages (ps: with ps; [ debugpy ])
./fix-test-pythonpath.patch
# Attach pid tests are disabled by default on windows & macos,
# but are also flaky on linux:
# - https://github.com/NixOS/nixpkgs/issues/262000
# - https://github.com/NixOS/nixpkgs/issues/251045
./skip-attach-pid-tests.patch
]
++ lib.optionals stdenv.hostPlatform.isLinux [
# Hard code GDB path (used to attach to process)
(replaceVars ./hardcode-gdb.patch {
inherit gdb;
})
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
# Hard code LLDB path (used to attach to process)
(replaceVars ./hardcode-lldb.patch {
inherit lldb;
})
];
# Compile attach library for host platform
# Derived from linux_and_mac/compile_linux.sh & linux_and_mac/compile_mac.sh
preBuild = ''
(
set -x
cd src/debugpy/_vendored/pydevd/pydevd_attach_to_process
$CXX linux_and_mac/attach.cpp -Ilinux_and_mac -std=c++11 -fPIC -nostartfiles ${
{
"x86_64-linux" = "-shared -o attach_linux_amd64.so";
"i686-linux" = "-shared -o attach_linux_x86.so";
"aarch64-linux" = "-shared -o attach_linux_arm64.so";
"riscv64-linux" = "-shared -o attach_linux_riscv64.so";
"x86_64-darwin" = "-D_REENTRANT -dynamiclib -lc -o attach.dylib";
"aarch64-darwin" = "-D_REENTRANT -dynamiclib -lc -o attach.dylib";
}
.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}")
}
)'';
build-system = [ setuptools ];
# Disable tests for unmaintained versions of python
doCheck = pythonAtLeast "3.11";
nativeCheckInputs = [
## Used to run the tests:
pytestCheckHook
pytest-xdist
pytest-timeout
pytest-retry
## Used by test helpers:
importlib-metadata
psutil
untangle
## Used in Python code that is run/debugged by the tests:
django
flask
gevent
numpy
requests
typing-extensions
];
preCheck = ''
export DEBUGPY_PROCESS_SPAWN_TIMEOUT=0
export DEBUGPY_PROCESS_EXIT_TIMEOUT=0
''
+ lib.optionalString (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) ''
# https://github.com/python/cpython/issues/74570#issuecomment-1093748531
export no_proxy='*';
'';
postCheck = lib.optionalString (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) ''
unset no_proxy
'';
# Override default arguments in pytest.ini
pytestFlags = [ "--timeout=0" ];
disabledTests = [
# hanging test (flaky)
"test_systemexit"
];
disabledTestPaths = lib.optionals stdenv.hostPlatform.isDarwin [
# ConnectionResetError: [Errno 54] Connection reset by peer
"tests/debugpy/test_breakpoints.py::test_error_in_condition[program-attach_connect(cli)-]"
"tests/debugpy/test_breakpoints.py::test_error_in_condition[program-attach_connect(cli)-NameError]"
];
# Fixes hanging tests on Darwin
__darwinAllowLocalNetworking = true;
pythonImportsCheck = [ "debugpy" ];
meta = {
description = "Implementation of the Debug Adapter Protocol for Python";
homepage = "https://github.com/microsoft/debugpy";
changelog = "https://github.com/microsoft/debugpy/releases/tag/${src.tag}";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ kira-bruneau ];
platforms = [
"x86_64-linux"
"i686-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
"riscv64-linux"
];
};
}

View File

@@ -0,0 +1,12 @@
diff --git a/tests/debug/session.py b/tests/debug/session.py
index d0921956..459c89c0 100644
--- a/tests/debug/session.py
+++ b/tests/debug/session.py
@@ -704,6 +704,7 @@ class Session(object):
if "PYTHONPATH" in self.config.env:
# If specified, launcher will use it in lieu of PYTHONPATH it inherited
# from the adapter when spawning debuggee, so we need to adjust again.
+ self.config.env.prepend_to("PYTHONPATH", os.environ["PYTHONPATH"])
self.config.env.prepend_to("PYTHONPATH", DEBUGGEE_PYTHONPATH.strpath)
# Adapter is going to start listening for server and spawn the launcher at

View File

@@ -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 2e328f61..ba7221fe 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
@@ -412,7 +412,7 @@ def run_python_code_linux(pid, python_code, connect_debugger_tracing=False, show
is_debug = 0
# Note that the space in the beginning of each line in the multi-line is important!
cmd = [
- "gdb",
+ '@gdb@/bin/gdb',
"--nw", # no gui interface
"--nh", # no ~/.gdbinit
"--nx", # no .gdbinit

View File

@@ -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 ba7221fe..24efc1ed 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
@@ -503,7 +503,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),

View File

@@ -0,0 +1,47 @@
diff --git a/setup.py b/setup.py
index d16a27c5..a7e407e1 100644
--- a/setup.py
+++ b/setup.py
@@ -12,7 +12,6 @@ import sys
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
-import versioneer # noqa
del sys.path[0]
@@ -145,13 +144,13 @@ if __name__ == "__main__":
if platforms is not None:
extras["platforms"] = platforms
- cmds = versioneer.get_cmdclass()
+ cmds = {}
override_build(cmds)
override_build_py(cmds)
setuptools.setup(
name="debugpy",
- version=versioneer.get_version(),
+ version="@version@",
description="An implementation of the Debug Adapter Protocol for Python", # noqa
long_description=long_description,
long_description_content_type="text/markdown",
diff --git a/src/debugpy/public_api.py b/src/debugpy/public_api.py
index c61a2607..f26f8272 100644
--- a/src/debugpy/public_api.py
+++ b/src/debugpy/public_api.py
@@ -7,8 +7,6 @@ from __future__ import annotations
import functools
import typing
-from debugpy import _version
-
# Expose debugpy.server API from subpackage, but do not actually import it unless
# and until a member is invoked - we don't want the server package loaded in the
@@ -192,4 +190,4 @@ def trace_this_thread(__should_trace: bool):
"""
-__version__: str = _version.get_versions()["version"]
+__version__: str = "@version@"

View File

@@ -0,0 +1,27 @@
diff --git a/tests/debug/runners.py b/tests/debug/runners.py
index cac4fbf5..079bb743 100644
--- a/tests/debug/runners.py
+++ b/tests/debug/runners.py
@@ -163,7 +163,7 @@ def _attach_common_config(session, target, cwd):
@_runner
@contextlib.contextmanager
def attach_pid(session, target, cwd=None, wait=True):
- if wait and not sys.platform.startswith("linux"):
+ if wait:
pytest.skip("https://github.com/microsoft/ptvsd/issues/1926")
log.info("Attaching {0} to {1} by PID.", session, target)
diff --git a/tests/debugpy/test_attach.py b/tests/debugpy/test_attach.py
index 78453bfe..458716af 100644
--- a/tests/debugpy/test_attach.py
+++ b/tests/debugpy/test_attach.py
@@ -153,8 +153,7 @@ def test_reattach(pyfile, target, run):
@pytest.mark.parametrize("pid_type", ["int", "str"])
-@pytest.mark.skipif(
- not sys.platform.startswith("linux"),
+@pytest.mark.skip(
reason="https://github.com/microsoft/debugpy/issues/311",
)
@pytest.mark.flaky(retries=2, delay=1)