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