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