1{ lib
2, buildPythonPackage
3, deprecat
4, dnspython
5, fetchFromGitHub
6, loguru
7, passlib
8, poetry-core
9, pytestCheckHook
10, pythonOlder
11, pythonRelaxDepsHook
12, toml
13}:
14
15buildPythonPackage rec {
16 pname = "ciscoconfparse";
17 version = "1.7.24";
18 format = "pyproject";
19
20 disabled = pythonOlder "3.7";
21
22 src = fetchFromGitHub {
23 owner = "mpenning";
24 repo = pname;
25 rev = "refs/tags/${version}";
26 hash = "sha256-vL/CQdYcOP356EyRToviWylP1EBtxmeov6qkhfQNZ2Y=";
27 };
28
29 pythonRelaxDeps = [
30 "loguru"
31 ];
32
33 postPatch = ''
34 # The line below is in the [build-system] section, which is invalid and
35 # rejected by PyPA's build tool. It belongs in [project] but upstream has
36 # had problems with putting that there (see comment in pyproject.toml).
37 sed -i '/requires-python/d' pyproject.toml
38
39 substituteInPlace pyproject.toml \
40 --replace '"poetry>=1.3.2",' ""
41
42 patchShebangs tests
43 '';
44
45 nativeBuildInputs = [
46 poetry-core
47 pythonRelaxDepsHook
48 ];
49
50 propagatedBuildInputs = [
51 passlib
52 deprecat
53 dnspython
54 loguru
55 toml
56 ];
57
58 nativeCheckInputs = [
59 pytestCheckHook
60 ];
61
62 disabledTestPaths = [
63 "tests/parse_test.py"
64 ];
65
66 disabledTests = [
67 # Tests require network access
68 "test_dns_lookup"
69 "test_reverse_dns_lookup"
70 # Path issues with configuration files
71 "testParse_valid_filepath"
72 ];
73
74 pythonImportsCheck = [
75 "ciscoconfparse"
76 ];
77
78 meta = with lib; {
79 description = "Module to parse, audit, query, build, and modify Cisco IOS-style configurations";
80 homepage = "https://github.com/mpenning/ciscoconfparse";
81 changelog = "https://github.com/mpenning/ciscoconfparse/blob/${version}/CHANGES.md";
82 license = licenses.gpl3Only;
83 maintainers = with maintainers; [ astro ];
84 };
85}