Skip to content

Commit

Permalink
dev-python/python-debian: bump to 0.1.39
Browse files Browse the repository at this point in the history
Signed-off-by: Mike Gilbert <[email protected]>
  • Loading branch information
floppym committed Feb 9, 2021
1 parent 9f0071c commit 33b7cd3
Show file tree
Hide file tree
Showing 3 changed files with 184 additions and 0 deletions.
1 change: 1 addition & 0 deletions dev-python/python-debian/Manifest
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
DIST python-debian_0.1.37.tar.xz 308568 BLAKE2B 7747ed21d3d6e06d5342ace6de83b79a93c76e44e8fd6d5738575e154f6d55dacd5dbb27d0210fac6f0a9db95b6d95b1fb9106da64ffbe7f77ec9d1a3e829d49 SHA512 0c13d6ee008bdcdfc28ac35d031a8486994a79a90d6b817349f09936c798211333604fd967bfde720fbc6b089bbec8e52b8c0977c430517e6f8c23d370fdff7c
DIST python-debian_0.1.39.tar.xz 319020 BLAKE2B de38ddc6e4878404f9685a264e1198e513cb57f7bfea064e4512ee00049d007b6007ee7fea42e18bd2f12dc8132582fbea2235694b5f908c9ae5cbc830cfe98a SHA512 de29ef224a17b149dde8cf6bb4b9fe77aa1fdfc040463163fb97f7e4ed283f16af43422e26c352183fd74e9e0ff6b41a91ee18c63b5534d5c9de2ef663c8f4df
146 changes: 146 additions & 0 deletions dev-python/python-debian/files/0.1.39-disable-apt-pkg.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
From e87972d4ae499d7049338ddb0d5009b6527a93dc Mon Sep 17 00:00:00 2001
From: Mike Gilbert <[email protected]>
Date: Mon, 8 Feb 2021 22:24:33 -0500
Subject: [PATCH] Disable apt_pkg support

---
lib/debian/deb822.py | 4 +--
lib/debian/tests/test_deb822.py | 58 ---------------------------------
2 files changed, 2 insertions(+), 60 deletions(-)

diff --git a/lib/debian/deb822.py b/lib/debian/deb822.py
index 46cf81a..158033f 100644
--- a/lib/debian/deb822.py
+++ b/lib/debian/deb822.py
@@ -2286,7 +2286,7 @@ class Sources(Dsc, _PkgRelationMixin):
def iter_paragraphs(cls,
sequence, # type: InputDataType
fields=None, # type: Optional[List[str]]
- use_apt_pkg=True, # type: bool
+ use_apt_pkg=False, # type: bool
shared_storage=False, # type: bool
encoding="utf-8", # type: str
strict=None, # type: Optional[Dict[str, bool]]
@@ -2328,7 +2328,7 @@ class Packages(Deb822, _PkgRelationMixin, _VersionAccessorMixin):
def iter_paragraphs(cls,
sequence, # type: InputDataType
fields=None, # type: Optional[List[str]]
- use_apt_pkg=True, # type: bool
+ use_apt_pkg=False, # type: bool
shared_storage=False, # type: bool
encoding="utf-8", # type: str
strict=None, # type: Optional[Dict[str, bool]]
diff --git a/lib/debian/tests/test_deb822.py b/lib/debian/tests/test_deb822.py
index f386391..7fb11fa 100755
--- a/lib/debian/tests/test_deb822.py
+++ b/lib/debian/tests/test_deb822.py
@@ -42,8 +42,6 @@ else:
from StringIO import StringIO
BytesIO = StringIO

-import apt_pkg
-
from debian import deb822
from debian.debian_support import Version

@@ -541,11 +539,6 @@ with open("test_deb822.pickle", "wb") as fh:
for d in deb822.Deb822.iter_paragraphs(text, use_apt_pkg=False):
self.assertWellParsed(d, PARSED_PACKAGE)

- with self.assertWarns(UserWarning):
- # The StringIO is not a real file so this will raise a warning
- for d in deb822.Deb822.iter_paragraphs(text, use_apt_pkg=True):
- self.assertWellParsed(d, PARSED_PACKAGE)
-
def test_iter_paragraphs_file(self):
# type: () -> None
text = StringIO()
@@ -564,10 +557,6 @@ with open("test_deb822.pickle", "wb") as fh:
for d in deb822.Deb822.iter_paragraphs(fh, use_apt_pkg=False):
self.assertWellParsed(d, PARSED_PACKAGE)

- fh.seek(0)
- for d in deb822.Deb822.iter_paragraphs(fh, use_apt_pkg=True):
- self.assertWellParsed(d, PARSED_PACKAGE)
-

def test_iter_paragraphs_with_gpg(self):
# type: () -> None
@@ -640,12 +629,7 @@ with open("test_deb822.pickle", "wb") as fh:
test_count(deb822.Deb822.iter_paragraphs, 2)
test_count(deb822.Deb822.iter_paragraphs, 2, use_apt_pkg=False)

- # apt_pkg used, should not split
- test_count(deb822.Deb822.iter_paragraphs, 1, use_apt_pkg=True)
-
# Specialised iter_paragraphs force use of apt_pkg and don't split
- test_count(deb822.Packages.iter_paragraphs, 1, use_apt_pkg=True)
- test_count(deb822.Sources.iter_paragraphs, 1, use_apt_pkg=True)
test_count(deb822.Packages.iter_paragraphs, 1, use_apt_pkg=False)
test_count(deb822.Sources.iter_paragraphs, 1, use_apt_pkg=False)

@@ -692,32 +676,12 @@ with open("test_deb822.pickle", "wb") as fh:
s.write(b"\n")
self.assertEqual(s.getvalue(), packages_content)

- def test_iter_paragraphs_apt_shared_storage_packages(self):
- # type: () -> None
- self._test_iter_paragraphs(find_test_file("test_Packages"),
- deb822.Packages,
- use_apt_pkg=True, shared_storage=True)
- def test_iter_paragraphs_apt_no_shared_storage_packages(self):
- # type: () -> None
- self._test_iter_paragraphs(find_test_file("test_Packages"),
- deb822.Packages,
- use_apt_pkg=True, shared_storage=False)
def test_iter_paragraphs_no_apt_no_shared_storage_packages(self):
# type: () -> None
self._test_iter_paragraphs(find_test_file("test_Packages"),
deb822.Packages,
use_apt_pkg=False, shared_storage=False)

- def test_iter_paragraphs_apt_shared_storage_sources(self):
- # type: () -> None
- self._test_iter_paragraphs(find_test_file("test_Sources"),
- deb822.Sources,
- use_apt_pkg=True, shared_storage=True)
- def test_iter_paragraphs_apt_no_shared_storage_sources(self):
- # type: () -> None
- self._test_iter_paragraphs(find_test_file("test_Sources"),
- deb822.Sources,
- use_apt_pkg=True, shared_storage=False)
def test_iter_paragraphs_no_apt_no_shared_storage_sources(self):
# type: () -> None
self._test_iter_paragraphs(find_test_file("test_Sources"),
@@ -1091,28 +1055,6 @@ Description: python modules to work with Debian-related data formats
self.assertWellParsed(paragraphs[i],
PARSED_PARAGRAPHS_WITH_COMMENTS[i])

- def test_iter_paragraphs_comments_use_apt_pkg(self):
- # type: () -> None
- """ apt_pkg does not support comments within multiline fields
-
- This test checks that a file with comments inside multiline fields
- generates an error from the apt_pkg parser.
-
- See also https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=750247#35
- https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=807351
- """
- try:
- fd, filename = tempfile.mkstemp()
- fp = os.fdopen(fd, 'wb')
- fp.write(UNPARSED_PARAGRAPHS_WITH_COMMENTS.encode('utf-8'))
- fp.close()
-
- with open_utf8(filename) as fh:
- with self.assertRaises(apt_pkg.Error):
- list(deb822.Deb822.iter_paragraphs(fh, use_apt_pkg=True))
- finally:
- os.remove(filename)
-
def test_iter_paragraphs_comments_native(self):
# type: () -> None
paragraphs = list(deb822.Deb822.iter_paragraphs(
--
2.30.0

37 changes: 37 additions & 0 deletions dev-python/python-debian/python-debian-0.1.39.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copyright 2011-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7
PYTHON_COMPAT=( python3_{7,8,9} )

inherit distutils-r1

DESCRIPTION="Python modules to work with Debian-related data formats"
HOMEPAGE="https://salsa.debian.org/python-debian-team/python-debian"
SRC_URI="mirror://debian/pool/main/${P:0:1}/${PN}/${PN}_${PV}.tar.xz"

LICENSE="GPL-2 GPL-3"
SLOT="0"
KEYWORDS="~amd64 ~arm ~x86"
IUSE="test"
RESTRICT="!test? ( test )"

RDEPEND="
dev-python/chardet[${PYTHON_USEDEP}]
dev-python/six[${PYTHON_USEDEP}]
"

BDEPEND="${RDEPEND}
dev-python/setuptools[${PYTHON_USEDEP}]
test? ( app-arch/dpkg )
"

PATCHES=( "${FILESDIR}/0.1.39-disable-apt-pkg.patch" )

python_compile_all() {
${EPYTHON} lib/debian/doc-debtags > README.debtags || die
}

python_test() {
${EPYTHON} -m unittest discover --verbose lib || die "Testing failed with ${EPYTHON}"
}

0 comments on commit 33b7cd3

Please sign in to comment.