1{ stdenv, buildPythonPackage, fetchPypi, pyyaml, pytest, pytestcov }:
2
3buildPythonPackage rec {
4 pname = "python-hosts";
5 version = "0.4.1";
6
7 src = fetchPypi {
8 inherit pname version;
9 sha256 = "4a169a4669bddb720c032ef0132203ff8a7b6646266f7e6ab349177bab02b3ba";
10 };
11
12 # win_inet_pton is required for windows support
13 prePatch = ''
14 substituteInPlace setup.py --replace "install_requires=['win_inet_pton']," ""
15 substituteInPlace python_hosts/utils.py --replace "import win_inet_pton" ""
16 '';
17
18 checkInputs = [ pyyaml pytest pytestcov ];
19
20 # Removing 1 test file (it requires internet connection) and keeping the other two
21 checkPhase = ''
22 pytest tests/test_hosts_entry.py
23 pytest tests/test_utils.py
24 '';
25
26 meta = with stdenv.lib; {
27 description = "A library for managing a hosts file. It enables adding and removing entries, or importing them from a file or URL";
28 homepage = https://github.com/jonhadfield/python-hosts;
29 license = licenses.mit;
30 maintainers = with maintainers; [ psyanticy ];
31 };
32}
33