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-cov-stub,
15 pytest-mock,
16 pytest-xdist,
17 pytestCheckHook,
18 pythonOlder,
19 requests,
20 setuptools-scm,
21 typing-extensions,
22}:
23
24buildPythonPackage rec {
25 pname = "proxy-py";
26 version = "2.4.10";
27 pyproject = true;
28
29 disabled = pythonOlder "3.7";
30
31 src = fetchFromGitHub {
32 owner = "abhinavsingh";
33 repo = "proxy.py";
34 tag = "v${version}";
35 hash = "sha256-47Qt8J60QFfHUSquD17xMfl+wBTsSimaPSRvS/sSPMI=";
36 };
37
38 postPatch = ''
39 substituteInPlace Makefile \
40 --replace "SHELL := /bin/bash" "SHELL := ${bash}/bin/bash"
41 '';
42
43 build-system = [ setuptools-scm ];
44
45 dependencies = [
46 paramiko
47 typing-extensions
48 ];
49
50 nativeCheckInputs = [
51 gnumake
52 h2
53 hpack
54 httpx
55 hyperframe
56 openssl
57 pytest-asyncio
58 pytest-cov-stub
59 pytest-mock
60 pytest-xdist
61 pytestCheckHook
62 requests
63 ];
64
65 __darwinAllowLocalNetworking = true;
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 "test_gen_public_key"
80 # Tests run into a timeout
81 "integration"
82 # Crashes
83 "test_grout"
84 ];
85
86 pythonImportsCheck = [ "proxy" ];
87
88 meta = with lib; {
89 description = "Python proxy framework";
90 homepage = "https://github.com/abhinavsingh/proxy.py";
91 changelog = "https://github.com/abhinavsingh/proxy.py/releases/tag/${src.tag}";
92 license = with licenses; [ bsd3 ];
93 maintainers = with maintainers; [ fab ];
94 };
95}