2021-06-28 23:13:55 +00:00
|
|
|
{ lib
|
|
|
|
, aiofiles
|
|
|
|
, beautifulsoup4
|
|
|
|
, buildPythonPackage
|
|
|
|
, doCheck ? true
|
|
|
|
, fetchFromGitHub
|
|
|
|
, fetchpatch
|
|
|
|
, gunicorn
|
|
|
|
, httptools
|
|
|
|
, multidict
|
|
|
|
, pytest-asyncio
|
|
|
|
, pytest-benchmark
|
|
|
|
, pytest-sanic
|
|
|
|
, pytest-sugar
|
|
|
|
, pytestCheckHook
|
|
|
|
, sanic-routing
|
|
|
|
, sanic-testing
|
|
|
|
, ujson
|
|
|
|
, uvicorn
|
|
|
|
, uvloop
|
|
|
|
, websockets
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "sanic";
|
2021-05-03 20:48:10 +00:00
|
|
|
version = "21.3.4";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "sanic-org";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "0vldlic8gqcf56fqb31igycqf11syd9csk66v34w6dim54lcny2b";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
patches = [
|
|
|
|
# Allow later websockets release, https://github.com/sanic-org/sanic/pull/2154
|
|
|
|
(fetchpatch {
|
|
|
|
name = "later-websockets.patch";
|
|
|
|
url = "https://github.com/sanic-org/sanic/commit/5fb820b5c1ce395e86a1ee11996790c65ec7bc65.patch";
|
|
|
|
sha256 = "1glvq23pf1sxqjnrz0w8rr7nsnyz82k1479b3rm8szfkjg9q5d1w";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2021-03-12 07:09:13 +00:00
|
|
|
postPatch = ''
|
2021-05-03 20:48:10 +00:00
|
|
|
# Loosen dependency requirements.
|
2020-12-09 12:39:15 +00:00
|
|
|
substituteInPlace setup.py \
|
2021-05-03 20:48:10 +00:00
|
|
|
--replace '"pytest==5.2.1"' '"pytest"' \
|
|
|
|
--replace '"gunicorn==20.0.4"' '"gunicorn"' \
|
2021-06-28 23:13:55 +00:00
|
|
|
--replace '"pytest-sanic",' "" \
|
2021-05-03 20:48:10 +00:00
|
|
|
# Patch a request headers test to allow brotli encoding
|
|
|
|
# (we build httpx with brotli support, upstream doesn't).
|
|
|
|
substituteInPlace tests/test_headers.py \
|
|
|
|
--replace "deflate\r\n" "deflate, br\r\n"
|
2020-12-09 12:39:15 +00:00
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
propagatedBuildInputs = [
|
2021-06-28 23:13:55 +00:00
|
|
|
aiofiles
|
|
|
|
httptools
|
|
|
|
multidict
|
|
|
|
sanic-routing
|
|
|
|
ujson
|
|
|
|
uvloop
|
|
|
|
websockets
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
checkInputs = [
|
2021-06-28 23:13:55 +00:00
|
|
|
beautifulsoup4
|
|
|
|
gunicorn
|
|
|
|
pytest-asyncio
|
|
|
|
pytest-benchmark
|
|
|
|
pytest-sanic
|
|
|
|
pytest-sugar
|
|
|
|
pytestCheckHook
|
|
|
|
sanic-testing
|
|
|
|
uvicorn
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2021-03-12 07:09:13 +00:00
|
|
|
inherit doCheck;
|
|
|
|
|
2020-12-09 12:39:15 +00:00
|
|
|
disabledTests = [
|
2021-06-28 23:13:55 +00:00
|
|
|
# Tests are flaky
|
2021-05-20 23:08:51 +00:00
|
|
|
"test_keep_alive_client_timeout"
|
2021-06-06 07:54:09 +00:00
|
|
|
"test_check_timeouts_request_timeout"
|
|
|
|
"test_check_timeouts_response_timeout"
|
2021-05-20 23:08:51 +00:00
|
|
|
"test_reloader_live"
|
2021-06-28 23:13:55 +00:00
|
|
|
"test_zero_downtime"
|
2020-12-09 12:39:15 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-09 10:05:03 +00:00
|
|
|
__darwinAllowLocalNetworking = true;
|
|
|
|
|
2021-03-12 07:09:13 +00:00
|
|
|
pythonImportsCheck = [ "sanic" ];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = with lib; {
|
2021-06-28 23:13:55 +00:00
|
|
|
description = "Web server and web framework";
|
2021-05-03 20:48:10 +00:00
|
|
|
homepage = "https://github.com/sanic-org/sanic/";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.mit;
|
2021-05-03 20:48:10 +00:00
|
|
|
maintainers = with maintainers; [ costrouc AluisioASG ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|