1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pytest-asyncio,
6 pytest-mock,
7 pytestCheckHook,
8 python-socks,
9 pythonOlder,
10 setuptools,
11 tldextract,
12 whodap,
13}:
14
15buildPythonPackage rec {
16 pname = "asyncwhois";
17 version = "1.1.2";
18 pyproject = true;
19
20 disabled = pythonOlder "3.9";
21
22 src = fetchFromGitHub {
23 owner = "pogzyb";
24 repo = "asyncwhois";
25 rev = "refs/tags/v${version}";
26 hash = "sha256-ESVgK4Z26OAamdHPEVxysnlJ0rEUlr8KNd24fawHuEg=";
27 };
28
29 postPatch = ''
30 substituteInPlace setup.py \
31 --replace-fail "python-socks[asyncio]" "python-socks"
32 '';
33
34 build-system = [ setuptools ];
35
36 dependencies = [
37 python-socks
38 tldextract
39 whodap
40 ];
41
42 nativeCheckInputs = [
43 pytest-asyncio
44 pytest-mock
45 pytestCheckHook
46 ];
47
48 disabledTests = [
49 # Tests require network access
50 "test_pywhois_aio_get_hostname_from_ip"
51 "test_pywhois_get_hostname_from_ip"
52 "test_pywhois_aio_lookup_ipv4"
53 "test_not_found"
54 "test_aio_from_whois_cmd"
55 "test_aio_get_hostname_from_ip"
56 "test_from_whois_cmd"
57 "test_get_hostname_from_ip"
58 "test_whois_query_run"
59 "test_whois_query_create_connection"
60 "test_whois_query_send_and_recv"
61 "test_input_parameters_for_domain_query"
62 "test__get_top_level_domain"
63 ];
64
65 pythonImportsCheck = [ "asyncwhois" ];
66
67 meta = with lib; {
68 description = "Python module for retrieving WHOIS information";
69 homepage = "https://github.com/pogzyb/asyncwhois";
70 changelog = "https://github.com/pogzyb/asyncwhois/releases/tag/v${version}";
71 license = with licenses; [ asl20 ];
72 maintainers = with maintainers; [ fab ];
73 };
74}