1{ lib
2, stdenv
3, buildPythonPackage
4, isPyPy
5, fetchPypi
6, pythonOlder
7, curl
8, openssl
9, bottle
10, pytestCheckHook
11, flaky
12}:
13
14buildPythonPackage rec {
15 pname = "pycurl";
16 version = "7.45.2";
17 disabled = isPyPy || (pythonOlder "3.5"); # https://github.com/pycurl/pycurl/issues/208
18
19 src = fetchPypi {
20 inherit pname version;
21 hash = "sha256-VzBZC+AnE2Slvd2eJFycwPtxDEy6y92VJkoxItIyJMo=";
22 };
23
24 preConfigure = ''
25 substituteInPlace setup.py --replace '--static-libs' '--libs'
26 export PYCURL_SSL_LIBRARY=openssl
27 '';
28
29 buildInputs = [
30 curl
31 openssl
32 ];
33
34 nativeBuildInputs = [
35 curl
36 ];
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 # tests that require network access
57 "test_keyfunction"
58 "test_keyfunction_bogus_return"
59 # OSError: tests/fake-curl/libcurl/with_openssl.so: cannot open shared object file: No such file or directory
60 "test_libcurl_ssl_openssl"
61 # OSError: tests/fake-curl/libcurl/with_nss.so: cannot open shared object file: No such file or directory
62 "test_libcurl_ssl_nss"
63 # OSError: tests/fake-curl/libcurl/with_gnutls.so: cannot open shared object file: No such file or directory
64 "test_libcurl_ssl_gnutls"
65 # AssertionError: assert 'crypto' in ['curl']
66 "test_ssl_in_static_libs"
67 # tests that require curl with http3Support
68 "test_http_version_3"
69 # https://github.com/pycurl/pycurl/issues/819
70 "test_multi_socket_select"
71 # https://github.com/pycurl/pycurl/issues/729
72 "test_multi_socket_action"
73 # https://github.com/pycurl/pycurl/issues/822
74 "test_request_with_verifypeer"
75 ] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
76 # Fatal Python error: Segmentation fault
77 "cadata_test"
78 ];
79
80 meta = with lib; {
81 homepage = "http://pycurl.io/";
82 description = "Python Interface To The cURL library";
83 license = with licenses; [ lgpl2Only mit ];
84 maintainers = with maintainers; [ ];
85 };
86}