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