Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / python-modules / uvloop / default.nix
blob9ee7fec9194450038e2bc0779fe5d911db49945a
1 { lib
2 , stdenv
3 , buildPythonPackage
4 , pythonOlder
5 , fetchPypi
7 # build-system
8 , cython
9 , setuptools
11 # native dependencies
12 , libuv
13 , CoreServices
14 , ApplicationServices
16 # tests
17 , aiohttp
18 , psutil
19 , pyopenssl
20 , pytestCheckHook
23 buildPythonPackage rec {
24   pname = "uvloop";
25   version = "0.19.0";
26   pyproject = true;
28   disabled = pythonOlder "3.8";
30   src = fetchPypi {
31     inherit pname version;
32     hash = "sha256-Akb0/Rvyv3AuBrDUXukWd+5cMSQvOaq06m/gxRrt0P0=";
33   };
35   nativeBuildInputs = [
36     cython
37     setuptools
38   ];
40   env.LIBUV_CONFIGURE_HOST = stdenv.hostPlatform.config;
42   buildInputs = [
43     libuv
44   ] ++ lib.optionals stdenv.isDarwin [
45     CoreServices
46     ApplicationServices
47   ];
49   nativeCheckInputs = [
50     aiohttp
51     pyopenssl
52     pytestCheckHook
53     psutil
54   ];
56   pytestFlagsArray = [
57     # Tries to run "env", but fails to find it, even with coreutils provided
58     "--deselect=tests/test_process.py::Test_UV_Process::test_process_env_2"
59     "--deselect=tests/test_process.py::Test_AIO_Process::test_process_env_2"
60     # AssertionError: b'' != b'out\n'
61     "--deselect=tests/test_process.py::Test_UV_Process::test_process_streams_redirect"
62     "--deselect=tests/test_process.py::Test_AIO_Process::test_process_streams_redirect"
63   ] ++ lib.optionals (stdenv.isDarwin) [
64     # Segmentation fault
65     "--deselect=tests/test_fs_event.py::Test_UV_FS_EVENT_RENAME::test_fs_event_rename"
66     # Broken: https://github.com/NixOS/nixpkgs/issues/160904
67     "--deselect=tests/test_context.py::Test_UV_Context::test_create_ssl_server_manual_connection_lost"
68   ];
70   disabledTestPaths = [
71     # ignore code linting tests
72     "tests/test_sourcecode.py"
73   ];
75   preCheck = ''
76     # force using installed/compiled uvloop
77     rm -rf uvloop
78   '' + lib.optionalString stdenv.isDarwin ''
79     # Work around "OSError: AF_UNIX path too long"
80     # https://github.com/MagicStack/uvloop/issues/463
81     export TMPDIR="/tmp"
82   '';
84   pythonImportsCheck = [
85     "uvloop"
86     "uvloop.loop"
87   ];
89   # Some of the tests use localhost networking.
90   __darwinAllowLocalNetworking = true;
92   meta = with lib; {
93     changelog = "https://github.com/MagicStack/uvloop/releases/tag/v${version}";
94     description = "Fast implementation of asyncio event loop on top of libuv";
95     homepage = "https://github.com/MagicStack/uvloop";
96     license = licenses.mit;
97     maintainers = with maintainers; [ ];
98   };