dev-python/PyPDF2: 1.26.0 version bump, add py3{5,6}, fix tests, EAPI 6

Gentoo-bug: 606466

Package-Manager: Portage-2.3.3, Repoman-2.3.1
This commit is contained in:
Andreas Sturmlechner
2017-03-18 21:36:26 +01:00
parent aaa0c2dab2
commit 7897e8625e
3 changed files with 68 additions and 0 deletions

View File

@@ -1,2 +1,3 @@
DIST PyPDF2-1.24.tar.gz 59891 SHA256 aca40d5155524120fceaf2eb4ae054480b8a2b6ffcfa0a2e77e3e45666428c64 SHA512 91a9338b0338eee1cfddc25dd0f21494f73696e630b08a71ff9195fe7b0fc77cf6c07b38a0c6aa4856536be6fe0a474c3b292c13fdd0187b62cb8848e69b29f9 WHIRLPOOL b5d33c209d5e0ce7d2d567d9266faacbbc6c1e49ac714e0063eeeb3879f400482a3fa887bd165b364a7216b4240b5236dec1954683ade632ea802a36a5272303
DIST PyPDF2-1.25.1.tar.gz 194181 SHA256 43d324f70f8994c25a08e6edc02ec2d5c1e84c9231d3537f785b3f97641182eb SHA512 0cb43d4557d17ec82298ceabce5c4731438a0e16ad6c6b2abc54204a3d93373a46b86c995e9b39cec475de1dce325d552da17ce36de3733c7b0471779e3b0899 WHIRLPOOL 71467c2b43d462fde0486a1ca9c300bc3c6b048c21450affa6f09e3b2a5b893b5125fec10cb6ac9d1c1157fdfacdcf5c5b6ed37a1e3742f95595b3f76bd9868a
DIST PyPDF2-1.26.0.tar.gz 77556 SHA256 e28f902f2f0a1603ea95ebe21dff311ef09be3d0f0ef29a3e44a932729564385 SHA512 7b427f1d099dcd687a718fb8d86e6f677ad45257414c6367e4dfacd8dfef7e3dbe3816027359868764981f36a30721f1731b4c23cbe2f35cfab1c64fb290b034 WHIRLPOOL 0f96818874f77bfef9d60e3bb84a648ec5366911fbb365d2e9ce965ef7321df845a85fede714e14dcb73e87d85bdc72af38ce40c2ed3ae096bd9daf07a7204b2

View File

@@ -0,0 +1,32 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
PYTHON_COMPAT=( python2_7 python3_{4,5,6} )
inherit distutils-r1
DESCRIPTION="Python library to work with pdf files"
HOMEPAGE="https://pypi.python.org/pypi/${PN}/ https://github.com/mstamy2/PyPDF2"
SRC_URI="mirror://pypi/${P:0:1}/${PN}/${P}.tar.gz"
LICENSE="BSD-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="examples"
PATCHES=( "${FILESDIR}/${P}-py3-tests.patch" )
python_test() {
"${EPYTHON}" -m unittest Tests.tests || die "Tests failed under ${EPYTHON}"
}
python_install_all() {
if use examples; then
docinto examples
dodoc -r Sample_Code/.
docompress -x /usr/share/doc/${PF}/examples
fi
distutils-r1_python_install_all
}

View File

@@ -0,0 +1,35 @@
From 6b46d03ee3a5bd5c2c18fae8aec8a0020ee68add Mon Sep 17 00:00:00 2001
From: Venelin Stoykov <vkstoykov@gmail.com>
Date: Sat, 26 Dec 2015 17:26:00 +0200
Subject: [PATCH 2/3] Fix tests for Python 3
---
Tests/tests.py | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/Tests/tests.py b/Tests/tests.py
index fa93c10..83b5951 100644
--- a/Tests/tests.py
+++ b/Tests/tests.py
@@ -27,14 +27,15 @@ def test_PdfReaderFileLoad(self):
ipdf_p1 = ipdf.getPage(0)
# Retrieve the text of the PDF
- pdftext_file = open(os.path.join(RESOURCE_ROOT, 'crazyones.txt'), 'r')
- pdftext = pdftext_file.read()
- ipdf_p1_text = ipdf_p1.extractText().replace('\n', '')
+ with open(os.path.join(RESOURCE_ROOT, 'crazyones.txt'), 'rb') as pdftext_file:
+ pdftext = pdftext_file.read()
+
+ ipdf_p1_text = ipdf_p1.extractText().replace('\n', '').encode('utf-8')
# Compare the text of the PDF to a known source
- self.assertEqual(ipdf_p1_text.encode('utf-8', errors='ignore'), pdftext,
+ self.assertEqual(ipdf_p1_text, pdftext,
msg='PDF extracted text differs from expected value.\n\nExpected:\n\n%r\n\nExtracted:\n\n%r\n\n'
- % (pdftext, ipdf_p1_text.encode('utf-8', errors='ignore')))
+ % (pdftext, ipdf_p1_text))
class AddJsTestCase(unittest.TestCase):