1{ lib
2, stdenv
3, buildPythonPackage
4, cheroot
5, fetchPypi
6, jaraco-collections
7, more-itertools
8, objgraph
9, path
10, portend
11, pyopenssl
12, pytest-forked
13, pytest-services
14, pytestCheckHook
15, python-memcached
16, pythonAtLeast
17, pythonOlder
18, requests-toolbelt
19, routes
20, setuptools-scm
21, simplejson
22, zc_lockfile
23}:
24
25buildPythonPackage rec {
26 pname = "cherrypy";
27 version = "18.8.0";
28 format = "setuptools";
29
30 disabled = pythonOlder "3.7";
31
32 src = fetchPypi {
33 pname = "CherryPy";
34 inherit version;
35 hash = "sha256-m0jPuoovFtW2QZzGV+bVHbAFujXF44JORyi7A7vH75s=";
36 };
37
38 postPatch = ''
39 # Disable doctest plugin because times out
40 substituteInPlace pytest.ini \
41 --replace "--doctest-modules" "-vvv" \
42 --replace "-p pytest_cov" "" \
43 --replace "--no-cov-on-fail" ""
44 sed -i "/--cov/d" pytest.ini
45 '';
46
47 nativeBuildInputs = [
48 setuptools-scm
49 ];
50
51 propagatedBuildInputs = [
52 cheroot
53 portend
54 more-itertools
55 zc_lockfile
56 jaraco-collections
57 ];
58
59 nativeCheckInputs = [
60 objgraph
61 path
62 pytest-forked
63 pytest-services
64 pytestCheckHook
65 requests-toolbelt
66 ];
67
68 preCheck = ''
69 export CI=true
70 '';
71
72 pytestFlagsArray = [
73 "-W"
74 "ignore::DeprecationWarning"
75 ];
76
77 disabledTests = [
78 # Keyboard interrupt ends test suite run
79 "KeyboardInterrupt"
80 # daemonize and autoreload tests have issue with sockets within sandbox
81 "daemonize"
82 "Autoreload"
83
84 "test_antistampede"
85 "test_file_stream"
86 "test_basic_request"
87 "test_3_Redirect"
88 "test_4_File_deletion"
89 ] ++ lib.optionals (pythonAtLeast "3.11") [
90 "testErrorHandling"
91 "testHookErrors"
92 "test_HTTP10_KeepAlive"
93 "test_No_Message_Body"
94 "test_HTTP11_Timeout"
95 "testGzip"
96 "test_malformed_header"
97 "test_no_content_length"
98 "test_post_filename_with_special_characters"
99 "test_post_multipart"
100 "test_iterator"
101 "test_1_Ram_Concurrency"
102 "test_2_File_Concurrency"
103 ] ++ lib.optionals stdenv.isDarwin [
104 "test_block"
105 ];
106
107 disabledTestPaths = lib.optionals stdenv.isDarwin [
108 "cherrypy/test/test_config_server.py"
109 ];
110
111 __darwinAllowLocalNetworking = true;
112
113 pythonImportsCheck = [
114 "cherrypy"
115 ];
116
117 passthru.optional-dependencies = {
118 json = [ simplejson ];
119 memcached_session = [ python-memcached ];
120 routes_dispatcher = [ routes ];
121 ssl = [ pyopenssl ];
122 # not packaged yet
123 xcgi = [ /* flup */ ];
124 };
125
126 meta = with lib; {
127 description = "Object-oriented HTTP framework";
128 homepage = "https://cherrypy.dev/";
129 license = licenses.bsd3;
130 maintainers = with maintainers; [ ];
131 };
132}