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