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