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 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 = [ "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 '"poetry>=1.3.2",' ""
39
40 patchShebangs tests
41 '';
42
43 nativeBuildInputs = [
44 poetry-core
45 ];
46
47 propagatedBuildInputs = [
48 passlib
49 deprecat
50 dnspython
51 loguru
52 toml
53 ];
54
55 nativeCheckInputs = [ pytestCheckHook ];
56
57 disabledTestPaths = [ "tests/parse_test.py" ];
58
59 disabledTests = [
60 # Tests require network access
61 "test_dns_lookup"
62 "test_reverse_dns_lookup"
63 # Path issues with configuration files
64 "testParse_valid_filepath"
65 ];
66
67 pythonImportsCheck = [ "ciscoconfparse" ];
68
69 meta = with lib; {
70 description = "Module to parse, audit, query, build, and modify Cisco IOS-style configurations";
71 homepage = "https://github.com/mpenning/ciscoconfparse";
72 changelog = "https://github.com/mpenning/ciscoconfparse/blob/${version}/CHANGES.md";
73 license = licenses.gpl3Only;
74 maintainers = with maintainers; [ astro ];
75 };
76}