summary refs log tree commit diff
path: root/pkgs/development/python-modules/python-hosts/default.nix
blob: 861addf81eef843f0586414be5334ba0e781a4d5 (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
{ lib, buildPythonPackage, fetchPypi, pyyaml, pytest, pytest-cov }:

buildPythonPackage rec {
  pname = "python-hosts";
  version = "1.0.1";

  src = fetchPypi {
    inherit pname version;
    sha256 = "5b9749ce807170fb340d044d3f971e1da4dac0ae6af8ce8db00b6758a920a2bc";
  };

  # 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" ""
  '';

  checkInputs = [ pyyaml pytest pytest-cov ];

  # Removing 1 test file (it requires internet connection) and keeping the other two
  checkPhase = ''
    pytest tests/test_hosts_entry.py
    pytest tests/test_utils.py
  '';

  meta = with lib; {
    description = "A library for managing a hosts file. It enables adding and removing entries, or importing them from a file or URL";
    homepage = "https://github.com/jonhadfield/python-hosts";
    license = licenses.mit;
    maintainers = with maintainers; [ psyanticy ];
  };
}