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