From a8de803f794c332bccd804b74df3c9845ed0e03c Mon Sep 17 00:00:00 2001 From: Brad Cowie Date: Fri, 10 Jan 2025 11:46:25 +1300 Subject: [PATCH] Replace deb_pkg_tools with debian-inspector --- test-requirements.txt | 2 +- tests/unit/packaging/test_packaging.py | 22 ++++++++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/test-requirements.txt b/test-requirements.txt index 00572c676c..863e7880aa 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -2,7 +2,7 @@ bitstring codecov concurrencytest -deb_pkg_tools +debian-inspector exabgp==4.2.22 importlab>=0.3.1 netifaces diff --git a/tests/unit/packaging/test_packaging.py b/tests/unit/packaging/test_packaging.py index dc52ab77f1..7b008676a8 100755 --- a/tests/unit/packaging/test_packaging.py +++ b/tests/unit/packaging/test_packaging.py @@ -21,9 +21,8 @@ import os import unittest -from deb_pkg_tools.control import parse_control_fields -from deb_pkg_tools.deb822 import parse_deb822 -from deb_pkg_tools.deps import VersionedRelationship +from debian_inspector import debcon +from debian_inspector.deps import VersionedRelationship import requirements @@ -43,15 +42,18 @@ def _parse_deb_control(self, control_file): break faucet_dpkg += "\n{}".format(line) - faucet_dpkg = parse_control_fields(parse_deb822(faucet_dpkg)) + faucet_dpkg = debcon.parse_control_fields( + debcon.Debian822.from_string(faucet_dpkg) + ) self.faucet_dpkg_deps = {} for dep in faucet_dpkg["Depends"]: - if isinstance(dep, VersionedRelationship): - if dep.name not in self.faucet_dpkg_deps: - self.faucet_dpkg_deps[dep.name] = [] - self.faucet_dpkg_deps[dep.name].append( - "{}{}".format(dep.operator, dep.version) - ) + if not isinstance(dep, VersionedRelationship): + continue + if dep.name not in self.faucet_dpkg_deps: + self.faucet_dpkg_deps[dep.name] = [] + self.faucet_dpkg_deps[dep.name].append( + "{}{}".format(dep.operator, dep.version) + ) def _parse_pip_requirements(self, requirements_file): self.faucet_pip_reqs = {}