1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, fetchpatch
5, poetry-core
6, python
7, pythonOlder
8}:
9
10buildPythonPackage rec {
11 pname = "async-dns";
12 version = "1.1.9";
13 disabled = pythonOlder "3.6";
14 format = "pyproject";
15
16 src = fetchFromGitHub {
17 owner = "gera2ld";
18 repo = "async_dns";
19 rev = "v${version}";
20 sha256 = "1z8j0s3dwcyavarhx41q75k1cmfzmwiqdh4svv3v15np26cywyag";
21 };
22
23 nativeBuildInputs = [
24 poetry-core
25 ];
26
27 patches = [
28 # Switch to poetry-core, https://github.com/gera2ld/async_dns/pull/22
29 # Can be remove for async-dns>1.1.9
30 (fetchpatch {
31 name = "switch-to-poetry-core.patch";
32 url = "https://github.com/gera2ld/async_dns/commit/25fee497aae3bde0ddf9f8804d249a27edbe607e.patch";
33 sha256 = "0w4zlppnp1a2q1wasc95ymqx3djswl32y5nw6fvz3nn8jg4gc743";
34 })
35 ];
36
37 checkPhase = ''
38 export HOME=$TMPDIR
39 # Test needs network access
40 rm tests/test_resolver.py
41 ${python.interpreter} -m unittest
42 '';
43
44 pythonImportsCheck = [ "async_dns" ];
45
46 meta = with lib; {
47 description = "Python DNS library";
48 homepage = "https://github.com/gera2ld/async_dns";
49 license = with licenses; [ mit ];
50 maintainers = with maintainers; [ fab ];
51 };
52}