1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 isPyPy,
6 fetchFromGitHub,
7 fetchpatch,
8 curl,
9 openssl,
10 bottle,
11 pytestCheckHook,
12 flaky,
13 flask,
14 setuptools,
15}:
16
17buildPythonPackage rec {
18 pname = "pycurl";
19 version = "7.45.6";
20 pyproject = true;
21
22 disabled = isPyPy; # https://github.com/pycurl/pycurl/issues/208
23
24 src = fetchFromGitHub {
25 owner = "pycurl";
26 repo = "pycurl";
27 tag = "REL_${lib.replaceStrings [ "." ] [ "_" ] version}";
28 hash = "sha256-M4rO0CaI2SmjdJVS7hWnJZrL72WvayB4aKn707KoNiQ=";
29 };
30
31 patches = [
32 # curl 8.16 compatibility
33 (fetchpatch {
34 url = "https://github.com/pycurl/pycurl/commit/eb7f52eeef85feb6c117678d52803050bbdd7bc8.patch";
35 hash = "sha256-hdwazS7R9duuMd/7S3SNAxVcToo3GhtyWu/1Q6qTMYc=";
36 })
37 ];
38
39 preConfigure = ''
40 substituteInPlace setup.py \
41 --replace-fail '--static-libs' '--libs'
42 export PYCURL_SSL_LIBRARY=openssl
43 '';
44
45 build-system = [ setuptools ];
46
47 nativeBuildInputs = [ curl ];
48
49 buildInputs = [
50 curl
51 openssl
52 ];
53
54 pythonImportsCheck = [ "pycurl" ];
55
56 nativeCheckInputs = [
57 bottle
58 flaky
59 flask
60 pytestCheckHook
61 ];
62
63 __darwinAllowLocalNetworking = true;
64
65 enabledTestPaths = [
66 # don't pick up the tests directory below examples/
67 "tests"
68 ];
69
70 preCheck = ''
71 export HOME=$TMPDIR
72 '';
73
74 disabledTests = [
75 # tests that require network access
76 "test_keyfunction"
77 "test_keyfunction_bogus_return"
78 # OSError: tests/fake-curl/libcurl/with_openssl.so: cannot open shared object file: No such file or directory
79 "test_libcurl_ssl_openssl"
80 # OSError: tests/fake-curl/libcurl/with_nss.so: cannot open shared object file: No such file or directory
81 "test_libcurl_ssl_nss"
82 # OSError: tests/fake-curl/libcurl/with_gnutls.so: cannot open shared object file: No such file or directory
83 "test_libcurl_ssl_gnutls"
84 # AssertionError: assert 'crypto' in ['curl']
85 "test_ssl_in_static_libs"
86 # https://github.com/pycurl/pycurl/issues/819
87 "test_multi_socket_select"
88 ]
89 ++ lib.optionals stdenv.hostPlatform.isDarwin [
90 # https://github.com/pycurl/pycurl/issues/729
91 "test_easy_pause_unpause"
92 "test_multi_socket_action"
93 ]
94 ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [
95 # Fatal Python error: Segmentation fault
96 "cadata_test"
97 ];
98
99 disabledTestPaths = [
100 # https://github.com/pycurl/pycurl/issues/856
101 "tests/multi_test.py"
102 ];
103
104 meta = with lib; {
105 description = "Python Interface To The cURL library";
106 homepage = "http://pycurl.io/";
107 changelog =
108 "https://github.com/pycurl/pycurl/blob/REL_"
109 + replaceStrings [ "." ] [ "_" ] version
110 + "/ChangeLog";
111 license = with licenses; [
112 lgpl2Only
113 mit
114 ];
115 maintainers = [ ];
116 };
117}