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