about summary refs log tree commit diff
path: root/pkgs/development/python-modules/python-hosts/default.nix
blob: 7452abb860c3167d141bc862b2460c74635a0f5d (plain) (blame)
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
{ lib
, buildPythonPackage
, fetchPypi
, pytestCheckHook
, pythonOlder
, pyyaml
, setuptools
}:

buildPythonPackage rec {
  pname = "python-hosts";
  version = "1.0.5";
  pyproject = true;

  disabled = pythonOlder "3.7";

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-xabbGnvzXNiE0koQVq9dmEib5Cv7kg1JjpZAyb7IZM0=";
  };

  # win_inet_pton is required for Windows support
  prePatch = ''
    substituteInPlace setup.py \
      --replace "install_requires=['win_inet_pton']," ""
    substituteInPlace python_hosts/utils.py \
      --replace "import win_inet_pton" ""
  '';

  nativeBuildInputs = [
    setuptools
  ];

  nativeCheckInputs = [
    pyyaml
    pytestCheckHook
  ];

  pythonImportsCheck = [
    "python_hosts"
  ];

  disabledTests = [
    # Tests require network access
    "test_import_from_url_counters_for_part_success"
    "test_import_from_url_with_force"
    "test_import_from_url_without_force"
    "test_import_from_url"
  ];

  meta = with lib; {
    description = "Library for managing a hosts file";
    longDescription = ''
      python-hosts is a Python library for managing a hosts file. It enables you to add
      and remove entries, or import them from a file or URL.
    '';
    homepage = "https://github.com/jonhadfield/python-hosts";
    changelog = "https://github.com/jonhadfield/python-hosts/blob/${version}/CHANGELOG.md";
    license = licenses.mit;
    maintainers = with maintainers; [ psyanticy ];
  };
}