2021-06-28 23:13:55 +00:00
|
|
|
{ lib
|
2021-12-06 16:07:01 +00:00
|
|
|
, stdenv
|
2021-06-28 23:13:55 +00:00
|
|
|
, aiofiles
|
|
|
|
, beautifulsoup4
|
|
|
|
, buildPythonPackage
|
|
|
|
, doCheck ? true
|
|
|
|
, fetchFromGitHub
|
|
|
|
, gunicorn
|
|
|
|
, httptools
|
|
|
|
, multidict
|
|
|
|
, pytest-asyncio
|
|
|
|
, pytest-benchmark
|
|
|
|
, pytest-sugar
|
|
|
|
, pytestCheckHook
|
2021-12-26 17:43:05 +00:00
|
|
|
, pythonOlder
|
2022-03-10 19:12:11 +00:00
|
|
|
, pythonAtLeast
|
2021-06-28 23:13:55 +00:00
|
|
|
, sanic-routing
|
|
|
|
, sanic-testing
|
|
|
|
, ujson
|
|
|
|
, uvicorn
|
|
|
|
, uvloop
|
|
|
|
, websockets
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "sanic";
|
2022-06-16 17:23:12 +00:00
|
|
|
version = "22.3.2";
|
2021-12-26 17:43:05 +00:00
|
|
|
format = "setuptools";
|
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
disabled = pythonOlder "3.7";
|
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}";
|
2022-06-16 17:23:12 +00:00
|
|
|
hash = "sha256-4zdPp3X22dfZ5YlW3G5/OqeUxrt+NiFO9dk2XjEKXEg=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-09-09 14:08:57 +00:00
|
|
|
patches = [
|
|
|
|
./22.3.2-CVE-2022-35920.patch
|
|
|
|
];
|
|
|
|
|
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 \
|
2022-04-15 01:41:22 +00:00
|
|
|
--replace "pytest==6.2.5" "pytest" \
|
2022-06-16 17:23:12 +00:00
|
|
|
--replace "gunicorn==20.0.4" "gunicorn"
|
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
|
|
|
|
pytestCheckHook
|
|
|
|
sanic-testing
|
|
|
|
uvicorn
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2021-03-12 07:09:13 +00:00
|
|
|
inherit doCheck;
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
preCheck = ''
|
|
|
|
# Some tests depends on sanic on PATH
|
|
|
|
PATH="$out/bin:$PATH"
|
2022-02-10 20:34:41 +00:00
|
|
|
PYTHONPATH=$PWD:$PYTHONPATH
|
|
|
|
|
|
|
|
# needed for relative paths for some packages
|
|
|
|
cd tests
|
2022-05-18 14:49:53 +00:00
|
|
|
'' + lib.optionalString stdenv.isDarwin ''
|
|
|
|
# OSError: [Errno 24] Too many open files
|
|
|
|
ulimit -n 1024
|
2021-12-06 16:07:01 +00:00
|
|
|
'';
|
|
|
|
|
2022-02-10 20:34:41 +00:00
|
|
|
# uvloop usage is buggy
|
|
|
|
#SANIC_NO_UVLOOP = true;
|
|
|
|
|
|
|
|
pytestFlagsArray = [
|
|
|
|
"--asyncio-mode=auto"
|
|
|
|
];
|
|
|
|
|
2020-12-09 12:39:15 +00:00
|
|
|
disabledTests = [
|
2022-06-16 17:23:12 +00:00
|
|
|
# Fails to parse cmdline arguments
|
|
|
|
"test_dev"
|
2021-12-06 16:07:01 +00:00
|
|
|
"test_auto_reload"
|
2022-06-16 17:23:12 +00:00
|
|
|
"test_host_port_ipv6_loopback"
|
2021-12-06 16:07:01 +00:00
|
|
|
"test_num_workers"
|
2022-06-16 17:23:12 +00:00
|
|
|
"test_debug"
|
|
|
|
"test_access_logs"
|
2022-04-27 09:35:20 +00:00
|
|
|
"test_noisy_exceptions"
|
2022-06-16 17:23:12 +00:00
|
|
|
# OSError: foo
|
|
|
|
"test_bad_headers"
|
|
|
|
"test_create_server_trigger_events"
|
|
|
|
"test_json_body_requests"
|
|
|
|
"test_missing_startup_raises_exception"
|
|
|
|
"test_no_body_requests"
|
|
|
|
"test_oserror_warning"
|
|
|
|
"test_running_multiple_offset_warning"
|
|
|
|
"test_streaming_body_requests"
|
|
|
|
"test_trigger_before_events_create_server"
|
|
|
|
"test_keep_alive_connection_context"
|
|
|
|
# Racy tests
|
|
|
|
"test_keep_alive_client_timeout"
|
|
|
|
"test_keep_alive_server_timeout"
|
|
|
|
"test_zero_downtime"
|
2022-08-12 12:06:08 +00:00
|
|
|
# broke with ujson 5.4 upgrade
|
|
|
|
# https://github.com/sanic-org/sanic/pull/2504
|
|
|
|
"test_json_response_json"
|
2020-12-09 12:39:15 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-02-10 20:34:41 +00:00
|
|
|
disabledTestPaths = [
|
2022-06-16 17:23:12 +00:00
|
|
|
# We are not interested in benchmarks
|
|
|
|
"benchmark/"
|
2022-02-10 20:34:41 +00:00
|
|
|
# unable to create async loop
|
|
|
|
"test_app.py"
|
|
|
|
"test_asgi.py"
|
|
|
|
# occasionally hangs
|
|
|
|
"test_multiprocessing.py"
|
|
|
|
];
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
# avoid usage of nixpkgs-review in darwin since tests will compete usage
|
|
|
|
# for the same local port
|
2021-01-09 10:05:03 +00:00
|
|
|
__darwinAllowLocalNetworking = true;
|
|
|
|
|
2021-12-26 17:43:05 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"sanic"
|
|
|
|
];
|
2021-03-12 07:09:13 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = with lib; {
|
2022-06-16 17:23:12 +00:00
|
|
|
broken = stdenv.isDarwin;
|
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
|
|
|
};
|
|
|
|
}
|