1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchPypi,
6 jaraco-functools,
7 jaraco-text,
8 more-itertools,
9 portend,
10 pypytools,
11 pytest-mock,
12 pytestCheckHook,
13 pythonOlder,
14 requests,
15 requests-toolbelt,
16 requests-unixsocket,
17 setuptools-scm,
18 six,
19}:
20
21buildPythonPackage rec {
22 pname = "cheroot";
23 version = "10.0.1";
24 format = "setuptools";
25
26 disabled = pythonOlder "3.7";
27
28 src = fetchPypi {
29 inherit pname version;
30 hash = "sha256-4LgveXZY0muGE+yOtWPDsI5r1qeSHp1Qib0Rda0bF0A=";
31 };
32
33 # remove setuptools-scm-git-archive dependency
34 # https://github.com/cherrypy/cheroot/commit/f0c51af263e20f332c6f675aa90ec6705ae4f5d1
35 # there is a difference between the github source and the pypi tarball source,
36 # and it is not easy to apply patches.
37 postPatch = ''
38 substituteInPlace pyproject.toml \
39 --replace '"setuptools_scm_git_archive>=1.1",' ""
40 substituteInPlace setup.cfg \
41 --replace "setuptools_scm_git_archive>=1.0" ""
42 '';
43
44 nativeBuildInputs = [ setuptools-scm ];
45
46 propagatedBuildInputs = [
47 jaraco-functools
48 more-itertools
49 six
50 ];
51
52 nativeCheckInputs = [
53 jaraco-text
54 portend
55 pypytools
56 pytest-mock
57 pytestCheckHook
58 requests
59 requests-toolbelt
60 requests-unixsocket
61 ];
62
63 # Disable doctest plugin because times out
64 # Disable xdist (-n arg) because it's incompatible with testmon
65 # Deselect test_bind_addr_unix on darwin because times out
66 # Deselect test_http_over_https_error on darwin because builtin cert fails
67 # Disable warnings-as-errors because of deprecation warnings from socks on python 3.7
68 # Disable pytest-testmon because it doesn't work
69 # adds many other pytest utilities which aren't necessary like linting
70 preCheck = ''
71 rm pytest.ini
72 '';
73
74 disabledTests = [
75 "tls" # touches network
76 "peercreds_unix_sock" # test urls no longer allowed
77 ]
78 ++ lib.optionals stdenv.hostPlatform.isDarwin [
79 "http_over_https_error"
80 "bind_addr_unix"
81 "test_ssl_env"
82 ];
83
84 disabledTestPaths = [
85 # avoid attempting to use 3 packages not available on nixpkgs
86 # (jaraco.apt, jaraco.context, yg.lockfile)
87 "cheroot/test/test_wsgi.py"
88 # requires pyopenssl
89 "cheroot/test/test_ssl.py"
90 ];
91
92 pythonImportsCheck = [ "cheroot" ];
93
94 # Some of the tests use localhost networking.
95 __darwinAllowLocalNetworking = true;
96
97 meta = with lib; {
98 description = "High-performance, pure-Python HTTP";
99 mainProgram = "cheroot";
100 homepage = "https://github.com/cherrypy/cheroot";
101 license = licenses.mit;
102 maintainers = [ ];
103 };
104}