1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 setuptools,
8
9 # dependencies
10 gevent,
11 twisted,
12 tornado,
13
14 # tests
15 nose2,
16 mock,
17
18}:
19
20buildPythonPackage rec {
21 pname = "pika";
22 version = "1.3.2";
23 format = "pyproject";
24
25 src = fetchFromGitHub {
26 owner = "pika";
27 repo = "pika";
28 tag = version;
29 hash = "sha256-60Z+y3YXazUghfnOy4e7HzM18iju5m5OEt4I3Wg6ty4=";
30 };
31
32 nativeBuildInputs = [ setuptools ];
33
34 propagatedBuildInputs = [
35 gevent
36 tornado
37 twisted
38 ];
39
40 nativeCheckInputs = [
41 nose2
42 mock
43 ];
44
45 postPatch = ''
46 # don't stop at first test failure
47 # don't run acceptance tests because they access the network
48 # don't report test coverage
49 substituteInPlace nose2.cfg \
50 --replace "stop = 1" "stop = 0" \
51 --replace "tests=tests/unit,tests/acceptance" "tests=tests/unit" \
52 --replace "with-coverage = 1" "with-coverage = 0"
53 '';
54
55 doCheck = false; # tests require rabbitmq instance, unsure how to skip
56
57 checkPhase = ''
58 runHook preCheck
59
60 PIKA_TEST_TLS=true nose2 -v
61
62 runHook postCheck
63 '';
64
65 meta = with lib; {
66 changelog = "https://github.com/pika/pika/releases/tag/${version}";
67 description = "Pure-Python implementation of the AMQP 0-9-1 protocol";
68 downloadPage = "https://github.com/pika/pika";
69 homepage = "https://pika.readthedocs.org";
70 license = licenses.bsd3;
71 maintainers = [ ];
72 };
73}