summary refs log tree commit diff
path: root/pkgs/development/python-modules/pycurl/default.nix
blob: cacb67496c8ca9de172d0713b69594166b57b199 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
{ lib
, stdenv
, buildPythonPackage
, isPyPy
, fetchPypi
, fetchpatch
, pythonOlder
, curl
, openssl
, bottle
, pytestCheckHook
, flaky
}:

buildPythonPackage rec {
  pname = "pycurl";
  version = "7.45.1";
  disabled = isPyPy || (pythonOlder "3.5"); # https://github.com/pycurl/pycurl/issues/208

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-qGOtGP9Hj1VFkkBXiHza5CLhsnRuQWdGFfaHSY6luIo=";
  };

  patches = [
    # Pull upstream patch for curl-3.83:
    #  https://github.com/pycurl/pycurl/pull/753
    (fetchpatch {
      name = "curl-3.83.patch";
      url = "https://github.com/pycurl/pycurl/commit/d47c68b1364f8a1a45ab8c584c291d44b762f7b1.patch";
      hash = "sha256-/lGq7O7ZyytzBAxWJPigcWdvypM7OHLBcp9ItmX7z1g=";
    })
  ];

  preConfigure = ''
    substituteInPlace setup.py --replace '--static-libs' '--libs'
    export PYCURL_SSL_LIBRARY=openssl
  '';

  buildInputs = [
    curl
    openssl
  ];

  nativeBuildInputs = [
    curl
  ];

  __darwinAllowLocalNetworking = true;

  nativeCheckInputs = [
    bottle
    pytestCheckHook
    flaky
  ];

  pytestFlagsArray = [
    # don't pick up the tests directory below examples/
    "tests"
  ];

  preCheck = ''
    export HOME=$TMPDIR
  '';

  disabledTests = [
    # tests that require network access
    "test_keyfunction"
    "test_keyfunction_bogus_return"
    # OSError: tests/fake-curl/libcurl/with_openssl.so: cannot open shared object file: No such file or directory
    "test_libcurl_ssl_openssl"
    # OSError: tests/fake-curl/libcurl/with_nss.so: cannot open shared object file: No such file or directory
    "test_libcurl_ssl_nss"
    # OSError: tests/fake-curl/libcurl/with_gnutls.so: cannot open shared object file: No such file or directory
    "test_libcurl_ssl_gnutls"
    # AssertionError: assert 'crypto' in ['curl']
    "test_ssl_in_static_libs"
  ] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
    # Fatal Python error: Segmentation fault
    "cadata_test"
  ];

  meta = with lib; {
    homepage = "http://pycurl.io/";
    description = "Python Interface To The cURL library";
    license = with licenses; [ lgpl2Only mit ];
    maintainers = with maintainers; [ ];
  };
}