1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 defusedxml,
6 dnspython,
7 fetchFromGitHub,
8 iana-etc,
9 libredirect,
10 pytestCheckHook,
11 pythonOlder,
12 setuptools,
13}:
14
15buildPythonPackage rec {
16 pname = "ipwhois";
17 version = "1.3.0";
18 pyproject = true;
19
20 disabled = pythonOlder "3.7";
21
22 src = fetchFromGitHub {
23 owner = "secynic";
24 repo = "ipwhois";
25 tag = "v${version}";
26 hash = "sha256-PY3SUPELcCvS/o5kfko4OD1BlTc9DnyqfkSFuzcAOSY=";
27 };
28
29 __darwinAllowLocalNetworking = true;
30
31 pythonRelaxDeps = [ "dnspython" ];
32
33 build-system = [ setuptools ];
34
35 dependencies = [
36 defusedxml
37 dnspython
38 ];
39
40 nativeCheckInputs = [
41 libredirect.hook
42 pytestCheckHook
43 ];
44
45 pythonImportsCheck = [ "ipwhois" ];
46
47 preCheck = lib.optionalString stdenv.hostPlatform.isLinux ''
48 echo "nameserver 127.0.0.1" > resolv.conf
49 export NIX_REDIRECTS=/etc/protocols=${iana-etc}/etc/protocols:/etc/resolv.conf=$(realpath resolv.conf)
50 '';
51
52 disabledTestPaths = [
53 # Tests require network access
54 "ipwhois/tests/online/"
55 # Stress test
56 "ipwhois/tests/stress/test_experimental.py"
57 ];
58
59 disabledTests = [
60 "test_lookup"
61 "test_unique_addresses"
62 "test_get_http_json"
63 ];
64
65 meta = with lib; {
66 description = "Library to retrieve and parse whois data";
67 homepage = "https://github.com/secynic/ipwhois";
68 changelog = "https://github.com/secynic/ipwhois/blob/v${version}/CHANGES.rst";
69 license = licenses.bsd2;
70 maintainers = with maintainers; [ fab ];
71 };
72}