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