1{ lib
2, buildPythonPackage
3, fetchPypi
4, fetchpatch
5, isPy3k
6, pytestCheckHook
7, sphinx
8, stdenv
9}:
10
11buildPythonPackage rec {
12 pname = "curio";
13 version = "1.4";
14
15 src = fetchPypi {
16 inherit pname version;
17 sha256 = "57edce81c837f3c2cf42fbb346dee26e537d1659e6605269fb13bd179e068744";
18 };
19
20 patches = [
21 # Fix the flaky test due to slow moving time on Apple Silicon chips.
22 # Remove when https://github.com/dabeaz/curio/pull/339 is in the next release.
23 (fetchpatch {
24 url = "https://github.com/dabeaz/curio/commit/132376724bbfaa0a52d3d63d0791aa4ac1eb6f5f.patch";
25 sha256 = "sha256-AxO0xRcR9l9/NKEJFwyZIoYcyZxpqOhpdNaeaYokVb4=";
26 })
27 # Same as above
28 (fetchpatch {
29 url = "https://github.com/dabeaz/curio/commit/8ac2f12a2cdacbc750b01fc7459cee8879bc1ee3.patch";
30 sha256 = "sha256-2Si3fuDLrI09QuzJd1TrE0QY02G9e9m+1eHFTB/MrWU=";
31 })
32 ];
33
34 disabled = !isPy3k;
35
36 checkInputs = [ pytestCheckHook sphinx ];
37
38 __darwinAllowLocalNetworking = true;
39
40 disabledTests = [
41 "test_aside_basic" # times out
42 "test_aside_cancel" # fails because modifies PYTHONPATH and cant find pytest
43 "test_ssl_outgoing" # touches network
44 ] ++ lib.optionals (stdenv.isDarwin) [
45 "test_unix_echo" # socket bind error on hydra when built with other packages
46 "test_unix_ssl_server" # socket bind error on hydra when built with other packages
47 ];
48
49 meta = with lib; {
50 homepage = "https://github.com/dabeaz/curio";
51 description = "Library for performing concurrent I/O with coroutines in Python 3";
52 license = licenses.bsd3;
53 maintainers = [ maintainers.marsam ];
54 };
55}