1{ stdenv, buildPythonPackage, isPy3k, fetchFromGitHub, fetchpatch
2, asgiref, autobahn, twisted, pytestrunner
3, hypothesis, pytest, pytest-asyncio
4}:
5buildPythonPackage rec {
6 pname = "daphne";
7 version = "2.3.0";
8
9 disabled = !isPy3k;
10
11 src = fetchFromGitHub {
12 owner = "django";
13 repo = pname;
14 rev = version;
15 sha256 = "020afrvbnid13gkgjpqznl025zpynisa96kybmf8q7m3wp1iq1nl";
16 };
17
18 patches = [
19 # Fix compatibility with Hypothesis 4. See: https://github.com/django/daphne/pull/261
20 (fetchpatch {
21 url = "https://github.com/django/daphne/commit/2df5096c5b63a791c209e12198ad89c998869efd.patch";
22 sha256 = "0046krzcn02mihqmsjd80kk5h5flv44nqxpapa17g6dvq3jnb97n";
23 })
24 ];
25
26 nativeBuildInputs = [ pytestrunner ];
27
28 propagatedBuildInputs = [ asgiref autobahn twisted ];
29
30 checkInputs = [ hypothesis pytest pytest-asyncio ];
31
32 doCheck = !stdenv.isDarwin; # most tests fail on darwin
33
34 checkPhase = ''
35 py.test
36 '';
37
38 meta = with stdenv.lib; {
39 description = "Django ASGI (HTTP/WebSocket) server";
40 license = licenses.bsd3;
41 homepage = https://github.com/django/daphne;
42 };
43}