Merge pull request #307098 from r-ryantm/auto-update/cilium-cli
[NixPkgs.git] / pkgs / development / python-modules / ipwhois / default.nix
blobc6e50535bad40e4155d5b1295e5980d5855117f3
1 { lib
2 , stdenv
3 , buildPythonPackage
4 , dnspython
5 , fetchFromGitHub
6 , fetchpatch
7 , iana-etc
8 , libredirect
9 , pytestCheckHook
10 , pythonOlder
11 , pythonRelaxDepsHook
12 , setuptools
15 buildPythonPackage rec {
16   pname = "ipwhois";
17   version = "1.2.0";
18   pyproject = true;
20   disabled = pythonOlder "3.7";
22   src = fetchFromGitHub {
23     owner = "secynic";
24     repo = "ipwhois";
25     rev = "refs/tags/v${version}";
26     hash = "sha256-2CfRRHlIIaycUtzKeMBKi6pVPeBCb1nW3/1hoxQU1YM=";
27   };
29   patches = [
30     # Use assertEqual instead of assertEquals, https://github.com/secynic/ipwhois/pull/316
31     (fetchpatch {
32       name = "assert-equal.patch";
33       url = "https://github.com/secynic/ipwhois/commit/fce2761354af99bc169e6cd08057e838fcc40f75.patch";
34       hash = "sha256-7Ic4xWTAmklk6MvnZ/WsH9SW/4D9EG/jFKt5Wi89Xtc=";
35     })
36   ];
38   __darwinAllowLocalNetworking = true;
40   pythonRelaxDeps = [
41     "dnspython"
42   ];
44   nativeBuildInputs = [
45     pythonRelaxDepsHook
46     setuptools
47   ];
49   propagatedBuildInputs = [
50     dnspython
51   ];
53   nativeCheckInputs = [
54     pytestCheckHook
55   ];
57   pythonImportsCheck = [
58     "ipwhois"
59   ];
61   preCheck = lib.optionalString stdenv.isLinux ''
62     echo "nameserver 127.0.0.1" > resolv.conf
63     export NIX_REDIRECTS=/etc/protocols=${iana-etc}/etc/protocols:/etc/resolv.conf=$(realpath resolv.conf) \
64       LD_PRELOAD=${libredirect}/lib/libredirect.so
65   '';
67   disabledTestPaths = [
68     # Tests require network access
69     "ipwhois/tests/online/"
70     # Stress test
71     "ipwhois/tests/stress/test_experimental.py"
72   ];
74   disabledTests = [
75     "test_lookup"
76     "test_unique_addresses"
77     "test_get_http_json"
78   ];
80   meta = with lib; {
81     description = "Library to retrieve and parse whois data";
82     homepage = "https://github.com/secynic/ipwhois";
83     changelog = "https://github.com/secynic/ipwhois/blob/v${version}/CHANGES.rst";
84     license = licenses.bsd2;
85     maintainers = with maintainers; [ fab ];
86   };