1{ lib, stdenv, buildPythonPackage, fetchPypi, isPy27, isPy26, isPyPy, mock, futures }:
2buildPythonPackage rec {
3 pname = "trollius";
4 version = "1.0.4";
5 name = "${pname}-${version}";
6
7 disabled = isPy26;
8
9 src = fetchPypi {
10 inherit pname version;
11 sha256 = "0xny8y12x3wrflmyn6xi8a7n3m3ac80fgmgzphx5jbbaxkjcm148";
12 };
13
14 buildInputs = [ mock ];
15
16 propagatedBuildInputs = lib.optionals (isPy27 || isPyPy) [ futures ];
17
18 patches = [
19 ./tests.patch
20 ];
21
22 # Some of the tests fail on darwin with `error: AF_UNIX path too long'
23 # because of the *long* path names for sockets
24 patchPhase = lib.optionalString stdenv.isDarwin ''
25 sed -i -e "s|test_create_ssl_unix_connection|skip_test_create_ssl_unix_connection|g" tests/test_events.py
26 sed -i -e "s|test_create_unix_connection|skip_test_create_unix_connection|g" tests/test_events.py
27 sed -i -e "s|test_create_unix_server_existing_path_nonsock|skip_test_create_unix_server_existing_path_nonsock|g" tests/test_unix_events.py
28 sed -i -e "s|test_create_unix_server_existing_path_sock|skip_test_create_unix_server_existing_path_sock|g" tests/test_unix_events.py
29 sed -i -e "s|test_create_unix_server_ssl_verified|skip_test_create_unix_server_ssl_verified|g" tests/test_events.py
30 sed -i -e "s|test_create_unix_server_ssl_verify_failed|skip_test_create_unix_server_ssl_verify_failed|g" tests/test_events.py
31 sed -i -e "s|test_create_unix_server_ssl|skip_test_create_unix_server_ssl|g" tests/test_events.py
32 sed -i -e "s|test_create_unix_server|skip_test_create_unix_server|g" tests/test_events.py
33 sed -i -e "s|test_open_unix_connection_error|skip_test_open_unix_connection_error|g" tests/test_streams.py
34 sed -i -e "s|test_open_unix_connection_no_loop_ssl|skip_test_open_unix_connection_no_loop_ssl|g" tests/test_streams.py
35 sed -i -e "s|test_open_unix_connection|skip_test_open_unix_connection|g" tests/test_streams.py
36 sed -i -e "s|test_pause_reading|skip_test_pause_reading|g" tests/test_subprocess.py
37 sed -i -e "s|test_read_pty_output|skip_test_read_pty_output|g" tests/test_events.py
38 sed -i -e "s|test_start_unix_server|skip_test_start_unix_server|g" tests/test_streams.py
39 sed -i -e "s|test_unix_sock_client_ops|skip_test_unix_sock_client_ops|g" tests/test_events.py
40 sed -i -e "s|test_write_pty|skip_test_write_pty|g" tests/test_events.py
41 '';
42
43 meta = with stdenv.lib; {
44 description = "Port of the Tulip project (asyncio module, PEP 3156) on Python 2";
45 homepage = "https://bitbucket.org/enovance/trollius";
46 license = licenses.asl20;
47 maintainers = with maintainers; [ garbas ];
48 };
49}