nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib
2, buildPythonPackage
3, isPyPy
4, fetchPypi
5, fetchpatch
6, pythonOlder
7, curl
8, openssl
9, bottle
10, pytestCheckHook
11, flaky
12}:
13
14buildPythonPackage rec {
15 pname = "pycurl";
16 version = "7.45.1";
17 disabled = isPyPy || (pythonOlder "3.5"); # https://github.com/pycurl/pycurl/issues/208
18
19 src = fetchPypi {
20 inherit pname version;
21 sha256 = "sha256-qGOtGP9Hj1VFkkBXiHza5CLhsnRuQWdGFfaHSY6luIo=";
22 };
23
24 patches = [
25 # Pull upstream patch for curl-3.83:
26 # https://github.com/pycurl/pycurl/pull/753
27 (fetchpatch {
28 name = "curl-3.83.patch";
29 url = "https://github.com/pycurl/pycurl/commit/d47c68b1364f8a1a45ab8c584c291d44b762f7b1.patch";
30 sha256 = "sha256-/lGq7O7ZyytzBAxWJPigcWdvypM7OHLBcp9ItmX7z1g=";
31 })
32 ];
33
34 preConfigure = ''
35 substituteInPlace setup.py --replace '--static-libs' '--libs'
36 export PYCURL_SSL_LIBRARY=openssl
37 '';
38
39 buildInputs = [
40 curl
41 openssl
42 ];
43
44 nativeBuildInputs = [
45 curl
46 ];
47
48 checkInputs = [
49 bottle
50 pytestCheckHook
51 flaky
52 ];
53
54 pytestFlagsArray = [
55 # don't pick up the tests directory below examples/
56 "tests"
57 ];
58
59 preCheck = ''
60 export HOME=$TMPDIR
61 '';
62
63 disabledTests = [
64 # tests that require network access
65 "test_keyfunction"
66 "test_keyfunction_bogus_return"
67 # OSError: tests/fake-curl/libcurl/with_openssl.so: cannot open shared object file: No such file or directory
68 "test_libcurl_ssl_openssl"
69 # OSError: tests/fake-curl/libcurl/with_nss.so: cannot open shared object file: No such file or directory
70 "test_libcurl_ssl_nss"
71 # OSError: tests/fake-curl/libcurl/with_gnutls.so: cannot open shared object file: No such file or directory
72 "test_libcurl_ssl_gnutls"
73 # AssertionError: assert 'crypto' in ['curl']
74 "test_ssl_in_static_libs"
75 ];
76
77 meta = with lib; {
78 homepage = "http://pycurl.io/";
79 description = "Python Interface To The cURL library";
80 license = with licenses; [ lgpl2Only mit ];
81 maintainers = with maintainers; [ SuperSandro2000 ];
82 };
83}