py-spy: cleanup, fix (#549340)

This commit is contained in:
kirillrdy
2026-08-05 00:33:29 +00:00
committed by GitHub

View File

@@ -1,11 +1,19 @@
{
lib,
stdenv,
fetchFromGitHub,
libunwind,
python3,
rustPlatform,
fetchFromGitHub,
# buildInputs
libunwind,
xz,
# tests
python3,
versionCheckHook,
# passthru
nix-update-script,
}:
let
@@ -17,17 +25,20 @@ in
rustPlatform.buildRustPackage (finalAttrs: {
pname = "py-spy";
version = "0.4.2";
__structuredAttrs = true;
src = fetchFromGitHub {
owner = "benfred";
repo = "py-spy";
rev = "v${finalAttrs.version}";
tag = "v${finalAttrs.version}";
hash = "sha256-5T6R2Neslw8rNYWJbXncLH78kH1o42fR6kidhip6/Bg=";
};
cargoHash = "sha256-ZhtQjX15pZe3CM898LBj/79kXa6ESgPOSFkNghq0Ywo=";
buildFeatures = lib.optional supportsUnwind "unwind";
buildFeatures = lib.optionals supportsUnwind [
"unwind"
];
# https://github.com/benfred/remoteprocess/blob/v0.5.2/build.rs
buildInputs = lib.optionals (supportsUnwind && stdenv.hostPlatform.isLinux) [
@@ -43,12 +54,25 @@ rustPlatform.buildRustPackage (finalAttrs: {
(python3.withPackages (ps: [ ps.numpy ]))
];
checkFlags = [
# thread 'test_thread_names' (3078) panicked at tests/integration_test.rs:159:53:
# called `Option::unwrap()` on a `None` value
"--skip=test_thread_names"
];
nativeInstallCheckInputs = [
versionCheckHook
];
doInstallCheck = true;
passthru.updateScript = nix-update-script { };
meta = {
description = "Sampling profiler for Python programs";
mainProgram = "py-spy";
homepage = "https://github.com/benfred/py-spy";
changelog = "https://github.com/benfred/py-spy/releases/tag/v${finalAttrs.version}";
changelog = "https://github.com/benfred/py-spy/releases/tag/${finalAttrs.src.tag}";
license = lib.licenses.mit;
maintainers = [ ];
maintainers = with lib.maintainers; [ GaetanLepage ];
};
})