Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at release-19.03 65 lines 2.3 kB view raw
1{ stdenv, fetchFromGitHub, autoreconfHook, coreutils, pkgconfig 2# pyflame needs one python version per ABI 3# are currently supported 4# * 2.6 or 2.7 for 2.x ABI 5# * 3.4 or 3.5 for 3.{4,5} ABI 6# * 3.6 for 3.6+ ABI 7# if you want to disable support for some ABI, make the corresponding argument null 8, python2, python35, python36, python3 9}: 10stdenv.mkDerivation rec { 11 pname = "pyflame"; 12 version = "1.6.7"; 13 src = fetchFromGitHub { 14 owner = "uber"; 15 repo = "pyflame"; 16 rev = "v${version}"; 17 sha256 = "0hz1ryimh0w8zyxx4y8chcn54d6b02spflj5k9rcg26an2chkg2w"; 18 }; 19 20 nativeBuildInputs = [ autoreconfHook pkgconfig ]; 21 buildInputs = [ python36 python2 python35 ]; 22 23 postPatch = '' 24 patchShebangs . 25 # some tests will fail in the sandbox 26 substituteInPlace tests/test_end_to_end.py \ 27 --replace 'skipif(IS_DOCKER' 'skipif(True' 28 29 # don't use patchShebangs here to be explicit about the python version 30 substituteInPlace utils/flame-chart-json \ 31 --replace '#!usr/bin/env python' '#!${python3.interpreter}' 32 ''; 33 34 postInstall = '' 35 install -D utils/flame-chart-json $out/bin/flame-chart-json 36 ''; 37 38 doCheck = true; 39 # reproduces the logic of their test script, but without downloading pytest 40 # from the internet with pip 41 checkPhase = with stdenv.lib; concatMapStringsSep "\n" (python: '' 42 set -x 43 PYMAJORVERSION=${head (strings.stringToCharacters python.version)} \ 44 PATH=${makeBinPath [ coreutils ]}\ 45 PYTHONPATH= \ 46 ${python.pkgs.pytest}/bin/pytest tests/ 47 set +x 48 '') (filter (x: x!=null) buildInputs); 49 50 meta = with stdenv.lib; { 51 description = "A ptracing profiler for Python "; 52 longDescription = '' 53 Pyflame is a high performance profiling tool that generates flame graphs for 54 Python. Pyflame uses the Linux ptrace(2) system call to collect profiling 55 information. It can take snapshots of the Python call stack without 56 explicit instrumentation, meaning you can profile a program without 57 modifying its source code. 58 ''; 59 homepage = https://github.com/uber/pyflame; 60 license = licenses.asl20; 61 maintainers = [ maintainers.symphorien ]; 62 # arm: https://github.com/uber/pyflame/issues/136 63 platforms = [ "i686-linux" "x86_64-linux" ]; 64 }; 65}