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.3-unstable-2024-10-17";
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 # Pinned to newer commit, since the release cadence is not keeping up with curl itself
27 #rev = "refs/tags/REL_${lib.replaceStrings [ "." ] [ "_" ] version}";
28 rev = "885d08b4d3cbc59547b8b80fbd13ab5fc6f27238";
29 hash = "sha256-WnrQhv6xiA+/Uz0hUmQxmEUasxtvlIV2EjlO+ZOUgI8=";
30 };
31
32 preConfigure = ''
33 substituteInPlace setup.py \
34 --replace-fail '--static-libs' '--libs'
35 export PYCURL_SSL_LIBRARY=openssl
36 '';
37
38 build-system = [ setuptools ];
39
40 nativeBuildInputs = [ curl ];
41
42 buildInputs = [
43 curl
44 openssl
45 ];
46
47 pythonImportsCheck = [ "pycurl" ];
48
49 nativeCheckInputs = [
50 bottle
51 flaky
52 flask
53 pytestCheckHook
54 ];
55
56 __darwinAllowLocalNetworking = true;
57
58 pytestFlagsArray = [
59 # don't pick up the tests directory below examples/
60 "tests"
61 ];
62
63 preCheck = ''
64 export HOME=$TMPDIR
65 '';
66
67 disabledTests =
68 [
69 # tests that require network access
70 "test_keyfunction"
71 "test_keyfunction_bogus_return"
72 # OSError: tests/fake-curl/libcurl/with_openssl.so: cannot open shared object file: No such file or directory
73 "test_libcurl_ssl_openssl"
74 # OSError: tests/fake-curl/libcurl/with_nss.so: cannot open shared object file: No such file or directory
75 "test_libcurl_ssl_nss"
76 # OSError: tests/fake-curl/libcurl/with_gnutls.so: cannot open shared object file: No such file or directory
77 "test_libcurl_ssl_gnutls"
78 # AssertionError: assert 'crypto' in ['curl']
79 "test_ssl_in_static_libs"
80 # https://github.com/pycurl/pycurl/issues/819
81 "test_multi_socket_select"
82 ]
83 ++ lib.optionals stdenv.hostPlatform.isDarwin [
84 # https://github.com/pycurl/pycurl/issues/729
85 "test_easy_pause_unpause"
86 "test_multi_socket_action"
87 ]
88 ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [
89 # Fatal Python error: Segmentation fault
90 "cadata_test"
91 ];
92
93 disabledTestPaths = [
94 # https://github.com/pycurl/pycurl/issues/856
95 "tests/multi_test.py"
96 ];
97
98 meta = with lib; {
99 description = "Python Interface To The cURL library";
100 homepage = "http://pycurl.io/";
101 changelog =
102 "https://github.com/pycurl/pycurl/blob/REL_"
103 + replaceStrings [ "." ] [ "_" ] version
104 + "/ChangeLog";
105 license = with licenses; [
106 lgpl2Only
107 mit
108 ];
109 maintainers = [ ];
110 };
111}