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