diff options
author | Justin Lecher <jlec@gentoo.org> | 2014-02-24 09:05:50 +0000 |
---|---|---|
committer | Justin Lecher <jlec@gentoo.org> | 2014-02-24 09:05:50 +0000 |
commit | d7b547cdab05da78b4dcdea9acdd2d48c0aa90e4 (patch) | |
tree | b01704db756b10b7fe21f6f18e357017c49174db /dev-python/feedparser | |
parent | dev-python/jsonpickle: add py3 support (diff) | |
download | gentoo-2-d7b547cdab05da78b4dcdea9acdd2d48c0aa90e4.tar.gz gentoo-2-d7b547cdab05da78b4dcdea9acdd2d48c0aa90e4.tar.bz2 gentoo-2-d7b547cdab05da78b4dcdea9acdd2d48c0aa90e4.zip |
dev-python/feedparser: Backport fix for py3.3 support
(Portage version: 2.2.8-r1/cvs/Linux x86_64, signed Manifest commit with key B9D4F231BD1558AB!)
Diffstat (limited to 'dev-python/feedparser')
-rw-r--r-- | dev-python/feedparser/ChangeLog | 10 | ||||
-rw-r--r-- | dev-python/feedparser/feedparser-5.1.3-r2.ebuild | 44 | ||||
-rw-r--r-- | dev-python/feedparser/files/feedparser-5.1.3-backport_fix_for_chardet-py3.patch | 32 | ||||
-rw-r--r-- | dev-python/feedparser/metadata.xml | 10 |
4 files changed, 89 insertions, 7 deletions
diff --git a/dev-python/feedparser/ChangeLog b/dev-python/feedparser/ChangeLog index 3ff8504b551c..b50eac29c458 100644 --- a/dev-python/feedparser/ChangeLog +++ b/dev-python/feedparser/ChangeLog @@ -1,6 +1,12 @@ # ChangeLog for dev-python/feedparser -# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/dev-python/feedparser/ChangeLog,v 1.49 2013/09/05 18:46:17 mgorny Exp $ +# Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/dev-python/feedparser/ChangeLog,v 1.50 2014/02/24 09:05:50 jlec Exp $ + +*feedparser-5.1.3-r2 (24 Feb 2014) + + 24 Feb 2014; Justin Lecher <jlec@gentoo.org> +feedparser-5.1.3-r2.ebuild, + +files/feedparser-5.1.3-backport_fix_for_chardet-py3.patch, metadata.xml: + Backport fix for py3.3 support 05 Sep 2013; Michał Górny <mgorny@gentoo.org> feedparser-5.1.3-r1.ebuild: Clean up PYTHON_COMPAT from old implementations. diff --git a/dev-python/feedparser/feedparser-5.1.3-r2.ebuild b/dev-python/feedparser/feedparser-5.1.3-r2.ebuild new file mode 100644 index 000000000000..f419db1884e7 --- /dev/null +++ b/dev-python/feedparser/feedparser-5.1.3-r2.ebuild @@ -0,0 +1,44 @@ +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-python/feedparser/feedparser-5.1.3-r2.ebuild,v 1.1 2014/02/24 09:05:50 jlec Exp $ + +EAPI=5 +PYTHON_COMPAT=( python{2_{6,7},3_{2,3}} pypy2_0 ) + +inherit distutils-r1 eutils + +DESCRIPTION="Parse RSS and Atom feeds in Python" +HOMEPAGE="http://code.google.com/p/feedparser/ http://pypi.python.org/pypi/feedparser" +SRC_URI="http://${PN}.googlecode.com/files/${P}.tar.bz2" + +# sgmllib is licensed under PSF-2. +LICENSE="BSD-2 PSF-2" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd ~x86-freebsd ~amd64-linux ~x86-linux ~x86-solaris" +IUSE="" + +DEPEND="dev-python/setuptools[${PYTHON_USEDEP}]" +RDEPEND="" + +# Tests have issues with chardet installed, and are just kind of buggy. +RESTRICT="test" + +PATCHES=( + "${FILESDIR}"/${P}-backport_fix_for_chardet-py3.patch +) + +python_prepare_all() { + mv feedparser/sgmllib3.py feedparser/_feedparser_sgmllib.py || die + epatch "${FILESDIR}/${PN}-5.1-sgmllib.patch" + distutils-r1_python_prepare_all +} + +python_test() { + cp feedparser/feedparsertest.py "${BUILD_DIR}" || die + ln -s "${S}/feedparser/tests" "${BUILD_DIR}/tests" || die + cd "${BUILD_DIR}" || die + if [[ ${EPYTHON} == python3* ]]; then + 2to3 --no-diffs -w -n feedparsertest.py || die + fi + "${PYTHON}" feedparsertest.py || die "Testing failed with ${EPYTHON}" +} diff --git a/dev-python/feedparser/files/feedparser-5.1.3-backport_fix_for_chardet-py3.patch b/dev-python/feedparser/files/feedparser-5.1.3-backport_fix_for_chardet-py3.patch new file mode 100644 index 000000000000..6b03ddea8cbb --- /dev/null +++ b/dev-python/feedparser/files/feedparser-5.1.3-backport_fix_for_chardet-py3.patch @@ -0,0 +1,32 @@ +From 20a32910f4a521788ba93a8c809cf0db702bed5b Mon Sep 17 00:00:00 2001 +From: Kurt McKee <contactme@kurtmckee.org> +Date: Mon, 17 Dec 2012 10:41:13 -0600 +Subject: [PATCH] Fix chardet support in Python 3 + +Fixes issue 384. +Thanks to Google user Arfrever.TFA for reporting this! +--- + NEWS | 1 + + feedparser/feedparser.py | 6 +++++- + 2 files changed, 6 insertions(+), 1 deletion(-) + +diff --git a/feedparser/feedparser.py b/feedparser/feedparser.py +index c78e6a3..e977ae8 100644 +--- a/feedparser/feedparser.py ++++ b/feedparser/feedparser.py +@@ -3766,7 +3766,11 @@ def convert_to_utf8(http_headers, data): + chardet_encoding = None + tried_encodings = [] + if chardet: +- chardet_encoding = unicode(chardet.detect(data)['encoding'] or '', 'ascii', 'ignore') ++ chardet_encoding = chardet.detect(data)['encoding'] ++ if not chardet_encoding: ++ chardet_encoding = '' ++ if not isinstance(chardet_encoding, unicode): ++ chardet_encoding = unicode(chardet_encoding, 'ascii', 'ignore') + # try: HTTP encoding, declared XML encoding, encoding sniffed from BOM + for proposed_encoding in (rfc3023_encoding, xml_encoding, bom_encoding, + chardet_encoding, u'utf-8', u'windows-1252', u'iso-8859-2'): +-- +1.8.5.5 + diff --git a/dev-python/feedparser/metadata.xml b/dev-python/feedparser/metadata.xml index d9c28faf09de..ec031c36b1f8 100644 --- a/dev-python/feedparser/metadata.xml +++ b/dev-python/feedparser/metadata.xml @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> <pkgmetadata> - <herd>python</herd> - <longdescription>Parse RSS and Atom feeds in Python. 2000 unit tests. Open source.</longdescription> - <upstream> - <remote-id type="google-code">feedparser</remote-id> - </upstream> + <herd>python</herd> + <longdescription>Parse RSS and Atom feeds in Python. 2000 unit tests. Open source.</longdescription> + <upstream> + <remote-id type="google-code">feedparser</remote-id> + </upstream> </pkgmetadata> |