1{
2 lib,
3 bash,
4 buildPythonPackage,
5 fetchFromGitHub,
6 gnumake,
7 h2,
8 hpack,
9 httpx,
10 hyperframe,
11 openssl,
12 paramiko,
13 pytest-asyncio,
14 pytest-mock,
15 pytest-xdist,
16 pytestCheckHook,
17 pythonOlder,
18 requests,
19 setuptools-scm,
20 typing-extensions,
21}:
22
23buildPythonPackage rec {
24 pname = "proxy-py";
25 version = "2.4.4";
26 pyproject = true;
27
28 disabled = pythonOlder "3.7";
29
30 src = fetchFromGitHub {
31 owner = "abhinavsingh";
32 repo = "proxy.py";
33 rev = "refs/tags/v${version}";
34 hash = "sha256-QWwIbNt2MtRfQaX7uZJzYmS++2MH+gTjWO0aEKYSETI=";
35 };
36
37 postPatch = ''
38 substituteInPlace Makefile \
39 --replace "SHELL := /bin/bash" "SHELL := ${bash}/bin/bash"
40 substituteInPlace pytest.ini \
41 --replace-fail "-p pytest_cov" "" \
42 --replace-fail "--no-cov-on-fail" ""
43 sed -i "/--cov/d" pytest.ini
44 '';
45
46 build-system = [ setuptools-scm ];
47
48 dependencies = [
49 paramiko
50 typing-extensions
51 ];
52
53 nativeCheckInputs = [
54 gnumake
55 h2
56 hpack
57 httpx
58 hyperframe
59 openssl
60 pytest-asyncio
61 pytest-mock
62 pytest-xdist
63 pytestCheckHook
64 requests
65 ];
66
67 preCheck = ''
68 export HOME=$(mktemp -d);
69 '';
70
71 disabledTests = [
72 # Test requires network access
73 "http"
74 "http2"
75 "proxy"
76 "web_server"
77 # Location is not writable
78 "test_gen_csr"
79 # Tests run into a timeout
80 "integration"
81 ];
82
83 pythonImportsCheck = [ "proxy" ];
84
85 meta = with lib; {
86 description = "Python proxy framework";
87 homepage = "https://github.com/abhinavsingh/proxy.py";
88 changelog = "https://github.com/abhinavsingh/proxy.py/releases/tag/v${version}";
89 license = with licenses; [ bsd3 ];
90 maintainers = with maintainers; [ fab ];
91 };
92}