at 25.11-pre 3.1 kB view raw
1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 fetchFromGitHub, 6 replaceVars, 7 isPy310, 8 isPyPy, 9 10 # build-system 11 cython, 12 setuptools, 13 14 # native dependencies 15 llhttp, 16 17 # dependencies 18 aiohappyeyeballs, 19 aiosignal, 20 async-timeout, 21 attrs, 22 frozenlist, 23 multidict, 24 propcache, 25 yarl, 26 27 # optional dependencies 28 aiodns, 29 brotli, 30 brotlicffi, 31 32 # tests 33 freezegun, 34 gunicorn, 35 proxy-py, 36 pytest-codspeed, 37 pytest-cov-stub, 38 pytest-mock, 39 pytest-xdist, 40 pytestCheckHook, 41 python-on-whales, 42 re-assert, 43 trustme, 44}: 45 46buildPythonPackage rec { 47 pname = "aiohttp"; 48 version = "3.11.15"; 49 pyproject = true; 50 51 src = fetchFromGitHub { 52 owner = "aio-libs"; 53 repo = "aiohttp"; 54 tag = "v${version}"; 55 hash = "sha256-cmPvhSnkocq87lJUtdQSs9QuJlgZB8p5m1pZs2bplh4="; 56 }; 57 58 patches = [ 59 (replaceVars ./unvendor-llhttp.patch { 60 llhttpDev = lib.getDev llhttp; 61 llhttpLib = lib.getLib llhttp; 62 }) 63 ]; 64 65 postPatch = '' 66 rm -r vendor 67 patchShebangs tools 68 touch .git # tools/gen.py uses .git to find the project root 69 ''; 70 71 build-system = [ 72 cython 73 setuptools 74 ]; 75 76 preBuild = '' 77 make cythonize 78 ''; 79 80 dependencies = [ 81 aiohappyeyeballs 82 aiosignal 83 async-timeout 84 attrs 85 frozenlist 86 multidict 87 propcache 88 yarl 89 ] ++ optional-dependencies.speedups; 90 91 optional-dependencies.speedups = [ 92 aiodns 93 (if isPyPy then brotlicffi else brotli) 94 ]; 95 96 nativeCheckInputs = [ 97 freezegun 98 gunicorn 99 proxy-py 100 pytest-codspeed 101 pytest-cov-stub 102 pytest-mock 103 pytest-xdist 104 pytestCheckHook 105 python-on-whales 106 re-assert 107 trustme 108 ]; 109 110 disabledTests = 111 [ 112 # Disable tests that require network access 113 "test_client_session_timeout_zero" 114 "test_mark_formdata_as_processed" 115 "test_requote_redirect_url_default" 116 # don't run benchmarks 117 "test_import_time" 118 ] 119 # these tests fail with python310 but succeeds with 11+ 120 ++ lib.optionals isPy310 [ 121 "test_https_proxy_unsupported_tls_in_tls" 122 "test_tcp_connector_raise_connector_ssl_error" 123 ] 124 ++ lib.optionals stdenv.hostPlatform.is32bit [ "test_cookiejar" ] 125 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 126 "test_addresses" # https://github.com/aio-libs/aiohttp/issues/3572, remove >= v4.0.0 127 "test_close" 128 ]; 129 130 __darwinAllowLocalNetworking = true; 131 132 preCheck = 133 '' 134 # aiohttp in current folder shadows installed version 135 rm -r aiohttp 136 touch tests/data.unknown_mime_type # has to be modified after 1 Jan 1990 137 138 export HOME=$(mktemp -d) 139 '' 140 + lib.optionalString stdenv.hostPlatform.isDarwin '' 141 # Work around "OSError: AF_UNIX path too long" 142 export TMPDIR="/tmp" 143 ''; 144 145 meta = with lib; { 146 changelog = "https://github.com/aio-libs/aiohttp/blob/v${version}/CHANGES.rst"; 147 description = "Asynchronous HTTP Client/Server for Python and asyncio"; 148 license = licenses.asl20; 149 homepage = "https://github.com/aio-libs/aiohttp"; 150 maintainers = with maintainers; [ dotlambda ]; 151 }; 152}