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