1{ lib, buildPythonPackage, fetchPypi, pyyaml, pytest, pytestcov }:
2
3buildPythonPackage rec {
4 pname = "python-hosts";
5 version = "1.0.1";
6
7 src = fetchPypi {
8 inherit pname version;
9 sha256 = "5b9749ce807170fb340d044d3f971e1da4dac0ae6af8ce8db00b6758a920a2bc";
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 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