1{ lib
2, stdenv
3, aioquic
4, buildPythonPackage
5, cacert
6, cryptography
7, curio
8, fetchPypi
9, h2
10, httpx
11, idna
12, poetry-core
13, pytestCheckHook
14, pythonOlder
15, requests
16, requests-toolbelt
17, sniffio
18, trio
19}:
20
21buildPythonPackage rec {
22 pname = "dnspython";
23 version = "2.4.2";
24 format = "pyproject";
25
26 disabled = pythonOlder "3.7";
27
28 src = fetchPypi {
29 inherit pname version;
30 hash = "sha256-jc+ujHRgovhLQHLibxyfQQHKIMBxZJy3w06LapPViYQ=";
31 };
32
33 nativeBuildInputs = [
34 poetry-core
35 ];
36
37 passthru.optional-dependencies = {
38 DOH = [
39 httpx
40 h2
41 requests
42 requests-toolbelt
43 ];
44 IDNA = [
45 idna
46 ];
47 DNSSEC = [
48 cryptography
49 ];
50 trio = [
51 trio
52 ];
53 curio = [
54 curio
55 sniffio
56 ];
57 DOQ = [
58 aioquic
59 ];
60 };
61
62 nativeCheckInputs = [
63 pytestCheckHook
64 ];
65
66 checkInputs = [
67 cacert
68 ] ++ passthru.optional-dependencies.DNSSEC;
69
70 disabledTests = [
71 # dns.exception.SyntaxError: protocol not found
72 "test_misc_good_WKS_text"
73 # fails if IPv6 isn't available
74 "test_resolver_override"
75 ] ++ lib.optionals stdenv.isDarwin [
76 # Tests that run inconsistently on darwin systems
77 # 9 tests fail with: BlockingIOError: [Errno 35] Resource temporarily unavailable
78 "testQueryUDP"
79 # 6 tests fail with: dns.resolver.LifetimeTimeout: The resolution lifetime expired after ...
80 "testResolveCacheHit"
81 "testResolveTCP"
82 ];
83
84 pythonImportsCheck = [
85 "dns"
86 ];
87
88 meta = with lib; {
89 description = "A DNS toolkit for Python";
90 homepage = "https://www.dnspython.org";
91 changelog = "https://github.com/rthalley/dnspython/blob/v${version}/doc/whatsnew.rst";
92 license = with licenses; [ isc ];
93 maintainers = with maintainers; [ gador ];
94 };
95}