1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5 pytestCheckHook,
6 pythonOlder,
7 pyyaml,
8 setuptools,
9}:
10
11buildPythonPackage rec {
12 pname = "python-hosts";
13 version = "1.0.6";
14 pyproject = true;
15
16 disabled = pythonOlder "3.7";
17
18 src = fetchPypi {
19 inherit pname version;
20 hash = "sha256-LfWfBzJ3UyArcHxrIUDsIa8pIr1WkUikf6F6v+IVLG4=";
21 };
22
23 # win_inet_pton is required for Windows support
24 prePatch = ''
25 substituteInPlace setup.py \
26 --replace "install_requires=['win_inet_pton']," ""
27 substituteInPlace python_hosts/utils.py \
28 --replace "import win_inet_pton" ""
29 '';
30
31 nativeBuildInputs = [ setuptools ];
32
33 nativeCheckInputs = [
34 pyyaml
35 pytestCheckHook
36 ];
37
38 pythonImportsCheck = [ "python_hosts" ];
39
40 disabledTests = [
41 # Tests require network access
42 "test_import_from_url_counters_for_part_success"
43 "test_import_from_url_with_force"
44 "test_import_from_url_without_force"
45 "test_import_from_url"
46 ];
47
48 meta = with lib; {
49 description = "Library for managing a hosts file";
50 longDescription = ''
51 python-hosts is a Python library for managing a hosts file. It enables you to add
52 and remove entries, or import them from a file or URL.
53 '';
54 homepage = "https://github.com/jonhadfield/python-hosts";
55 changelog = "https://github.com/jonhadfield/python-hosts/blob/${version}/CHANGELOG.md";
56 license = licenses.mit;
57 maintainers = with maintainers; [ psyanticy ];
58 };
59}