Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / python-modules / ipwhois / default.nix
blob676ec23081a6df40734156388ad19c4524b25b19
1 { lib
2 , stdenv
3 , buildPythonPackage
4 , dnspython
5 , fetchFromGitHub
6 , iana-etc
7 , libredirect
8 , pytestCheckHook
9 , pythonOlder
10 , pythonRelaxDepsHook
13 buildPythonPackage rec {
14   pname = "ipwhois";
15   version = "1.2.0";
16   format = "setuptools";
18   disabled = pythonOlder "3.7";
20   src = fetchFromGitHub {
21     owner = "secynic";
22     repo = pname;
23     rev = "refs/tags/v${version}";
24     hash = "sha256-2CfRRHlIIaycUtzKeMBKi6pVPeBCb1nW3/1hoxQU1YM=";
25   };
27   pythonRelaxDeps = [
28     "dnspython"
29   ];
31   nativeBuildInputs = [
32     pythonRelaxDepsHook
33   ];
35   propagatedBuildInputs = [
36     dnspython
37   ];
39   nativeCheckInputs = [
40     pytestCheckHook
41   ];
43   pythonImportsCheck = [
44     "ipwhois"
45   ];
47   preCheck = lib.optionalString stdenv.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       LD_PRELOAD=${libredirect}/lib/libredirect.so
51   '';
53   disabledTestPaths = [
54     # Tests require network access
55     "ipwhois/tests/online/"
56   ];
58   disabledTests = [
59     "test_lookup"
60     "test_unique_addresses"
61     "test_get_http_json"
62   ];
64   meta = with lib; {
65     description = "Library to retrieve and parse whois data";
66     homepage = "https://github.com/secynic/ipwhois";
67     changelog = "https://github.com/secynic/ipwhois/blob/v${version}/CHANGES.rst";
68     license = licenses.bsd2;
69     maintainers = with maintainers; [ fab ];
70   };