1{ lib, buildPythonPackage, fetchPypi, pyyaml, pytest, pytest-cov }:
2
3buildPythonPackage rec {
4 pname = "python-hosts";
5 version = "1.0.4";
6
7 src = fetchPypi {
8 inherit pname version;
9 hash = "sha256-y7d7CuGuKYEUCjFHvWb+iDI6oDeVsTzBNPSySzxu1Zk=";
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 nativeCheckInputs = [ pyyaml pytest pytest-cov ];
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