1{ stdenv
2, lib
3, buildPythonPackage
4, fetchpatch
5, fetchPypi
6, colorama
7, libunwind
8, pytz
9, requests
10, six
11}:
12
13buildPythonPackage rec {
14 version = "0.4.15";
15 pname = "vmprof";
16
17 src = fetchPypi {
18 inherit pname version;
19 sha256 = "a2d872a40196404386d1e0d960e97b37c86c3f72a4f9d5a2b5f9ca1adaff5b62";
20 };
21
22 buildInputs = [ libunwind ];
23 propagatedBuildInputs = [ colorama requests six pytz ];
24
25 patches = [
26 (fetchpatch {
27 name = "${pname}-python-3.10-compat.patch";
28 # https://github.com/vmprof/vmprof-python/pull/198
29 url = "https://github.com/vmprof/vmprof-python/commit/e4e99e5aa677f96d1970d88c8a439f995f429f85.patch";
30 hash = "sha256-W/c6WtVuKi7xO2sCOr71mrZTWqI86bWg5a0FeDNolh0=";
31 })
32 (fetchpatch {
33 name = "${pname}-python-3.11-compat.patch";
34 # https://github.com/vmprof/vmprof-python/pull/251 (not yet merged)
35 url = "https://github.com/matthiasdiener/vmprof-python/compare/a1a1b5264ec0b197444c0053e44f8ae4ffed9353...13c39166363b960017393b614270befe01230be8.patch";
36 excludes = [ "test_requirements.txt" ];
37 hash = "sha256-3+0PVdAf83McNd93Q9dD4HLXt39UinVU5BA8jWfT6F4=";
38 })
39 ];
40
41 # No tests included
42 doCheck = false;
43 pythonImportsCheck = [ "vmprof" ];
44
45 # Workaround build failure on -fno-common toolchains:
46 # ld: src/vmprof_unix.o:src/vmprof_common.h:92: multiple definition of
47 # `_PyThreadState_Current'; src/_vmprof.o:src/vmprof_common.h:92: first defined here
48 # TODO: can be removed once next release contains:
49 # https://github.com/vmprof/vmprof-python/pull/203
50 env.NIX_CFLAGS_COMPILE = "-fcommon";
51
52 meta = with lib; {
53 broken = (stdenv.isLinux && stdenv.isAarch64) || stdenv.isDarwin;
54 description = "A vmprof client";
55 license = licenses.mit;
56 homepage = "https://vmprof.readthedocs.org/";
57 };
58}