2024-06-05 15:53:02 +00:00
|
|
|
|
{
|
|
|
|
|
lib,
|
|
|
|
|
stdenv,
|
|
|
|
|
buildPythonPackage,
|
|
|
|
|
pythonOlder,
|
|
|
|
|
fetchFromGitHub,
|
|
|
|
|
substituteAll,
|
|
|
|
|
llhttp,
|
|
|
|
|
python,
|
|
|
|
|
# build_requires
|
|
|
|
|
cython,
|
|
|
|
|
setuptools,
|
|
|
|
|
# install_requires
|
|
|
|
|
attrs,
|
|
|
|
|
multidict,
|
|
|
|
|
async-timeout,
|
|
|
|
|
yarl,
|
|
|
|
|
frozenlist,
|
|
|
|
|
aiosignal,
|
|
|
|
|
aiodns,
|
|
|
|
|
brotli,
|
|
|
|
|
# tests_require
|
|
|
|
|
freezegun,
|
|
|
|
|
gunicorn,
|
|
|
|
|
pytest-mock,
|
|
|
|
|
pytest7CheckHook,
|
|
|
|
|
python-on-whales,
|
|
|
|
|
re-assert,
|
|
|
|
|
trustme,
|
2020-04-24 23:36:52 +00:00
|
|
|
|
}:
|
|
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
|
pname = "aiohttp";
|
2024-05-15 15:35:15 +00:00
|
|
|
|
version = "3.9.5";
|
2024-01-13 08:15:51 +00:00
|
|
|
|
pyproject = true;
|
2023-01-20 10:41:00 +00:00
|
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
|
disabled = pythonOlder "3.8";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
|
owner = "aio-libs";
|
|
|
|
|
repo = "aiohttp";
|
|
|
|
|
rev = "refs/tags/v${version}";
|
2024-05-15 15:35:15 +00:00
|
|
|
|
hash = "sha256-FRtirmwgU8v+ee3db7rOFsmy0rNW8A7+yRZC5d6uYNA=";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
};
|
|
|
|
|
|
2023-03-04 12:14:45 +00:00
|
|
|
|
patches = [
|
2024-01-13 08:15:51 +00:00
|
|
|
|
(substituteAll {
|
|
|
|
|
src = ./unvendor-llhttp.patch;
|
|
|
|
|
llhttpDev = lib.getDev llhttp;
|
|
|
|
|
llhttpLib = lib.getLib llhttp;
|
2023-08-04 22:07:22 +00:00
|
|
|
|
})
|
2023-03-04 12:14:45 +00:00
|
|
|
|
];
|
|
|
|
|
|
2021-03-19 17:17:44 +00:00
|
|
|
|
postPatch = ''
|
2021-12-06 16:07:01 +00:00
|
|
|
|
sed -i '/--cov/d' setup.cfg
|
2024-01-13 08:15:51 +00:00
|
|
|
|
|
|
|
|
|
rm -r vendor
|
|
|
|
|
patchShebangs tools
|
|
|
|
|
touch .git # tools/gen.py uses .git to find the project root
|
2021-03-19 17:17:44 +00:00
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
|
build-system = [
|
2024-01-13 08:15:51 +00:00
|
|
|
|
cython
|
2023-05-24 13:37:59 +00:00
|
|
|
|
setuptools
|
|
|
|
|
];
|
|
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
|
preBuild = ''
|
|
|
|
|
make cythonize
|
|
|
|
|
'';
|
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
|
dependencies = [
|
2020-12-07 07:45:13 +00:00
|
|
|
|
attrs
|
|
|
|
|
multidict
|
2021-12-06 16:07:01 +00:00
|
|
|
|
async-timeout
|
2020-12-07 07:45:13 +00:00
|
|
|
|
yarl
|
2021-12-06 16:07:01 +00:00
|
|
|
|
frozenlist
|
|
|
|
|
aiosignal
|
|
|
|
|
aiodns
|
|
|
|
|
brotli
|
2020-12-07 07:45:13 +00:00
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
|
postInstall = ''
|
|
|
|
|
# remove source code file with reference to dev dependencies
|
|
|
|
|
rm $out/${python.sitePackages}/aiohttp/_cparser.pxd{,.orig}
|
|
|
|
|
'';
|
|
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
|
# NOTE: pytest-xdist cannot be added because it is flaky. See https://github.com/NixOS/nixpkgs/issues/230597 for more info.
|
2024-06-05 15:53:02 +00:00
|
|
|
|
nativeCheckInputs =
|
|
|
|
|
[
|
|
|
|
|
freezegun
|
|
|
|
|
gunicorn
|
|
|
|
|
pytest-mock
|
|
|
|
|
pytest7CheckHook
|
|
|
|
|
python-on-whales
|
|
|
|
|
re-assert
|
|
|
|
|
]
|
|
|
|
|
++ lib.optionals (!(stdenv.isDarwin && stdenv.isAarch64)) [
|
|
|
|
|
# Optional test dependency. Depends indirectly on pyopenssl, which is
|
|
|
|
|
# broken on aarch64-darwin.
|
|
|
|
|
trustme
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
disabledTests =
|
|
|
|
|
[
|
|
|
|
|
# Disable tests that require network access
|
|
|
|
|
"test_client_session_timeout_zero"
|
|
|
|
|
"test_mark_formdata_as_processed"
|
|
|
|
|
"test_requote_redirect_url_default"
|
|
|
|
|
# don't run benchmarks
|
|
|
|
|
"test_import_time"
|
|
|
|
|
]
|
|
|
|
|
++ lib.optionals stdenv.is32bit [ "test_cookiejar" ]
|
|
|
|
|
++ lib.optionals stdenv.isDarwin [
|
|
|
|
|
"test_addresses" # https://github.com/aio-libs/aiohttp/issues/3572, remove >= v4.0.0
|
|
|
|
|
"test_close"
|
|
|
|
|
];
|
2020-06-18 07:06:33 +00:00
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
|
disabledTestPaths = [
|
2024-01-13 08:15:51 +00:00
|
|
|
|
"tests/test_proxy_functional.py" # FIXME package proxy.py
|
2021-12-06 16:07:01 +00:00
|
|
|
|
];
|
|
|
|
|
|
2021-03-19 17:17:44 +00:00
|
|
|
|
__darwinAllowLocalNetworking = true;
|
|
|
|
|
|
2020-06-18 07:06:33 +00:00
|
|
|
|
# aiohttp in current folder shadows installed version
|
2024-06-05 15:53:02 +00:00
|
|
|
|
preCheck =
|
|
|
|
|
''
|
|
|
|
|
rm -r aiohttp
|
|
|
|
|
touch tests/data.unknown_mime_type # has to be modified after 1 Jan 1990
|
|
|
|
|
''
|
|
|
|
|
+ lib.optionalString stdenv.isDarwin ''
|
|
|
|
|
# Work around "OSError: AF_UNIX path too long"
|
|
|
|
|
export TMPDIR="/tmp"
|
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
|
|
meta = with lib; {
|
2023-03-15 16:39:30 +00:00
|
|
|
|
changelog = "https://github.com/aio-libs/aiohttp/blob/v${version}/CHANGES.rst";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
description = "Asynchronous HTTP Client/Server for Python and asyncio";
|
|
|
|
|
license = licenses.asl20;
|
|
|
|
|
homepage = "https://github.com/aio-libs/aiohttp";
|
|
|
|
|
maintainers = with maintainers; [ dotlambda ];
|
|
|
|
|
};
|
|
|
|
|
}
|