2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchPypi,
|
|
|
|
pytestCheckHook,
|
|
|
|
pythonOlder,
|
|
|
|
pyyaml,
|
|
|
|
setuptools,
|
2024-01-02 11:29:13 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "python-hosts";
|
2024-05-15 15:35:15 +00:00
|
|
|
version = "1.0.6";
|
2024-01-02 11:29:13 +00:00
|
|
|
pyproject = true;
|
|
|
|
|
|
|
|
disabled = pythonOlder "3.7";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2024-05-15 15:35:15 +00:00
|
|
|
hash = "sha256-LfWfBzJ3UyArcHxrIUDsIa8pIr1WkUikf6F6v+IVLG4=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
# win_inet_pton is required for Windows support
|
2020-04-24 23:36:52 +00:00
|
|
|
prePatch = ''
|
2024-01-02 11:29:13 +00:00
|
|
|
substituteInPlace setup.py \
|
|
|
|
--replace "install_requires=['win_inet_pton']," ""
|
|
|
|
substituteInPlace python_hosts/utils.py \
|
|
|
|
--replace "import win_inet_pton" ""
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
nativeBuildInputs = [ setuptools ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
nativeCheckInputs = [
|
|
|
|
pyyaml
|
|
|
|
pytestCheckHook
|
|
|
|
];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
pythonImportsCheck = [ "python_hosts" ];
|
2024-01-02 11:29:13 +00:00
|
|
|
|
|
|
|
disabledTests = [
|
|
|
|
# Tests require network access
|
|
|
|
"test_import_from_url_counters_for_part_success"
|
|
|
|
"test_import_from_url_with_force"
|
|
|
|
"test_import_from_url_without_force"
|
|
|
|
"test_import_from_url"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2024-01-02 11:29:13 +00:00
|
|
|
description = "Library for managing a hosts file";
|
|
|
|
longDescription = ''
|
|
|
|
python-hosts is a Python library for managing a hosts file. It enables you to add
|
|
|
|
and remove entries, or import them from a file or URL.
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/jonhadfield/python-hosts";
|
2024-01-02 11:29:13 +00:00
|
|
|
changelog = "https://github.com/jonhadfield/python-hosts/blob/${version}/CHANGELOG.md";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ psyanticy ];
|
|
|
|
};
|
|
|
|
}
|