1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 isPyPy,
6 fetchPypi,
7 pythonOlder,
8 curl,
9 openssl,
10 bottle,
11 pytestCheckHook,
12 flaky,
13}:
14
15buildPythonPackage rec {
16 pname = "pycurl";
17 version = "7.45.3";
18 format = "setuptools";
19 disabled = isPyPy || (pythonOlder "3.5"); # https://github.com/pycurl/pycurl/issues/208
20
21 src = fetchPypi {
22 inherit pname version;
23 hash = "sha256-jCRxr5B5rXmOFkXsCw09QiPbaHN50X3TanBjdEn4HWs=";
24 };
25
26 preConfigure = ''
27 substituteInPlace setup.py --replace '--static-libs' '--libs'
28 export PYCURL_SSL_LIBRARY=openssl
29 '';
30
31 buildInputs = [
32 curl
33 openssl
34 ];
35
36 nativeBuildInputs = [ curl ];
37
38 __darwinAllowLocalNetworking = true;
39
40 nativeCheckInputs = [
41 bottle
42 pytestCheckHook
43 flaky
44 ];
45
46 pytestFlagsArray = [
47 # don't pick up the tests directory below examples/
48 "tests"
49 ];
50
51 preCheck = ''
52 export HOME=$TMPDIR
53 '';
54
55 disabledTests =
56 [
57 # tests that require network access
58 "test_keyfunction"
59 "test_keyfunction_bogus_return"
60 # OSError: tests/fake-curl/libcurl/with_openssl.so: cannot open shared object file: No such file or directory
61 "test_libcurl_ssl_openssl"
62 # OSError: tests/fake-curl/libcurl/with_nss.so: cannot open shared object file: No such file or directory
63 "test_libcurl_ssl_nss"
64 # OSError: tests/fake-curl/libcurl/with_gnutls.so: cannot open shared object file: No such file or directory
65 "test_libcurl_ssl_gnutls"
66 # AssertionError: assert 'crypto' in ['curl']
67 "test_ssl_in_static_libs"
68 # tests that require curl with http3Support
69 "test_http_version_3"
70 # https://github.com/pycurl/pycurl/issues/819
71 "test_multi_socket_select"
72 # https://github.com/pycurl/pycurl/issues/729
73 "test_easy_pause_unpause"
74 "test_multi_socket_action"
75 # https://github.com/pycurl/pycurl/issues/822
76 "test_request_with_verifypeer"
77 # https://github.com/pycurl/pycurl/issues/836
78 "test_proxy_tlsauth"
79 ]
80 ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
81 # Fatal Python error: Segmentation fault
82 "cadata_test"
83 ];
84
85 meta = with lib; {
86 homepage = "http://pycurl.io/";
87 description = "Python Interface To The cURL library";
88 license = with licenses; [
89 lgpl2Only
90 mit
91 ];
92 maintainers = [ ];
93 };
94}