1{ stdenv, buildPythonPackage, fetchFromGitHub, pythonOlder
2, pytest, mock, pytestcov, coverage
3, future, futures, ujson, isPy38
4, fetchpatch
5}:
6
7buildPythonPackage rec {
8 pname = "python-jsonrpc-server";
9 version = "0.3.4";
10
11 src = fetchFromGitHub {
12 owner = "palantir";
13 repo = "python-jsonrpc-server";
14 rev = version;
15 sha256 = "027sx5pv4i9a192kr00bjjcxxprh2xyr8q5372q8ghff3xryk9dd";
16 };
17
18 postPatch = ''
19 sed -i 's/version=versioneer.get_version(),/version="${version}",/g' setup.py
20 # https://github.com/palantir/python-jsonrpc-server/issues/36
21 sed -iEe "s!'ujson.*\$!'ujson',!" setup.py
22 '';
23
24 checkInputs = [
25 pytest mock pytestcov coverage
26 ];
27
28 checkPhase = ''
29 pytest
30 '';
31
32 patches = [
33 (fetchpatch {
34 url = "https://github.com/palantir/python-jsonrpc-server/commit/0a04cc4e9d44233b1038b12d63cd3bd437c2374e.patch";
35 sha256 = "177zdnp1808r2pg189bvzab44l8i2alsgv04kmrlhhnv40h66qyg";
36 })
37 (fetchpatch {
38 url = "https://github.com/palantir/python-jsonrpc-server/commit/5af6e43d0c1fb9a6a29b96d38cfd6dbeec85d0ea.patch";
39 sha256 = "1gx7lc1jxar1ngqqfkdn21s46y1mfnjf7ky2886ydk53nkaba91m";
40 })
41 ];
42
43 propagatedBuildInputs = [ future ujson ]
44 ++ stdenv.lib.optional (pythonOlder "3.2") futures;
45
46 meta = with stdenv.lib; {
47 homepage = "https://github.com/palantir/python-jsonrpc-server";
48 description = "A Python 2 and 3 asynchronous JSON RPC server";
49 license = licenses.mit;
50 maintainers = [ maintainers.mic92 ];
51 };
52}