summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/ipwhois/default.nix
blob: 453e2ecae6b5b9f0c9eb0db612ce7705e1c16fac (plain)
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
{
  lib,
  stdenv,
  buildPythonPackage,
  defusedxml,
  dnspython,
  fetchFromGitHub,
  iana-etc,
  libredirect,
  pytestCheckHook,
  setuptools,
}:

buildPythonPackage rec {
  pname = "ipwhois";
  version = "1.3.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "secynic";
    repo = "ipwhois";
    tag = "v${version}";
    hash = "sha256-PY3SUPELcCvS/o5kfko4OD1BlTc9DnyqfkSFuzcAOSY=";
  };

  __darwinAllowLocalNetworking = true;

  pythonRelaxDeps = [ "dnspython" ];

  build-system = [ setuptools ];

  dependencies = [
    defusedxml
    dnspython
  ];

  nativeCheckInputs = [
    libredirect.hook
    pytestCheckHook
  ];

  pythonImportsCheck = [ "ipwhois" ];

  preCheck = lib.optionalString stdenv.hostPlatform.isLinux ''
    echo "nameserver 127.0.0.1" > resolv.conf
    export NIX_REDIRECTS=/etc/protocols=${iana-etc}/etc/protocols:/etc/resolv.conf=$(realpath resolv.conf)
  '';

  disabledTestPaths = [
    # Tests require network access
    "ipwhois/tests/online/"
    # Stress test
    "ipwhois/tests/stress/test_experimental.py"
  ];

  disabledTests = [
    "test_lookup"
    "test_unique_addresses"
    "test_get_http_json"
  ];

  meta = {
    description = "Library to retrieve and parse whois data";
    homepage = "https://github.com/secynic/ipwhois";
    changelog = "https://github.com/secynic/ipwhois/blob/v${version}/CHANGES.rst";
    license = lib.licenses.bsd2;
    maintainers = with lib.maintainers; [ fab ];
  };
}