diff options
author | Arfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org> | 2011-03-10 01:23:16 +0000 |
---|---|---|
committer | Arfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org> | 2011-03-10 01:23:16 +0000 |
commit | 2e899d7865eda0ee763612b57a38d8ba1edbbd48 (patch) | |
tree | efd9f7a83e20c4f82a420062ae1aedef250d688b /dev-python/feedparser | |
parent | drop support for kernel packages which dont natively support multilib since t... (diff) | |
download | gentoo-2-2e899d7865eda0ee763612b57a38d8ba1edbbd48.tar.gz gentoo-2-2e899d7865eda0ee763612b57a38d8ba1edbbd48.tar.bz2 gentoo-2-2e899d7865eda0ee763612b57a38d8ba1edbbd48.zip |
Support Python 3 (bug #352863).
(Portage version: 2.2.0_alpha26_p10/cvs/Linux x86_64)
Diffstat (limited to 'dev-python/feedparser')
-rw-r--r-- | dev-python/feedparser/ChangeLog | 6 | ||||
-rw-r--r-- | dev-python/feedparser/feedparser-5.0.1.ebuild | 49 | ||||
-rw-r--r-- | dev-python/feedparser/files/feedparser-5.0.1-sgmllib.patch | 26 |
3 files changed, 69 insertions, 12 deletions
diff --git a/dev-python/feedparser/ChangeLog b/dev-python/feedparser/ChangeLog index 96241c769b53..1180fd3ae37b 100644 --- a/dev-python/feedparser/ChangeLog +++ b/dev-python/feedparser/ChangeLog @@ -1,6 +1,10 @@ # ChangeLog for dev-python/feedparser # Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/dev-python/feedparser/ChangeLog,v 1.23 2011/02/22 05:43:01 sping Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-python/feedparser/ChangeLog,v 1.24 2011/03/10 01:23:16 arfrever Exp $ + + 10 Mar 2011; Arfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org> + feedparser-5.0.1.ebuild, +files/feedparser-5.0.1-sgmllib.patch: + Support Python 3 (bug #352863). *feedparser-5.0.1 (22 Feb 2011) diff --git a/dev-python/feedparser/feedparser-5.0.1.ebuild b/dev-python/feedparser/feedparser-5.0.1.ebuild index 32dbe59a6368..dae08c83a6e1 100644 --- a/dev-python/feedparser/feedparser-5.0.1.ebuild +++ b/dev-python/feedparser/feedparser-5.0.1.ebuild @@ -1,33 +1,60 @@ # Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/dev-python/feedparser/feedparser-5.0.1.ebuild,v 1.2 2011/03/09 22:18:24 arfrever Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-python/feedparser/feedparser-5.0.1.ebuild,v 1.3 2011/03/10 01:23:16 arfrever Exp $ EAPI="3" -PYTHON_DEPEND="2" SUPPORT_PYTHON_ABIS="1" -RESTRICT_PYTHON_ABIS="3.*" # See README-PYTHON3 in tarball if you want to work on this -inherit distutils +inherit distutils eutils DESCRIPTION="Parse RSS and Atom feeds in Python" -HOMEPAGE="http://www.feedparser.org/ http://code.google.com/p/feedparser/" +HOMEPAGE="http://www.feedparser.org/ http://code.google.com/p/feedparser/ http://pypi.python.org/pypi/feedparser" SRC_URI="http://${PN}.googlecode.com/files/${P}.tar.bz2" -LICENSE="BSD-2" +LICENSE="BSD-2 PSF-2.2" SLOT="0" KEYWORDS="~alpha ~amd64 ~arm ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd ~x86-freebsd ~amd64-linux ~x86-linux ~x86-solaris" -IUSE="test" +IUSE="" DEPEND="" RDEPEND="" +DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES="1" DOCS="LICENSE NEWS" -PYTHON_MODNAME="feedparser.py" +PYTHON_MODNAME="feedparser.py _feedparser_sgmllib.py" + +src_prepare() { + mv feedparser/sgmllib3.py feedparser/_feedparser_sgmllib.py || die "Renaming sgmllib3.py failed" + epatch "${FILESDIR}/${P}-sgmllib.patch" + + distutils_src_prepare + + preparation() { + if [[ "${PYTHON_ABI}" == 3.* ]]; then + 2to3-${PYTHON_ABI} -nw --no-diffs feedparser/{feedparser.py,feedparsertest.py} || return 1 + else + # Avoid SyntaxErrors with Python 2. + echo "raise ImportError" > feedparser/_feedparser_sgmllib.py || return 1 + fi + } + python_execute_function -s preparation +} + +src_compile() { + PYTHONPATH="feedparser" distutils_src_compile +} src_test() { testing() { - cd feedparser || die - "$(PYTHON)" ${PN}test.py || die + # 877 errors with Python 3. + [[ "${PYTHON_ABI}" == 3.* ]] && return + + cd feedparser || return 1 + PYTHONPATH="." "$(PYTHON)" feedparsertest.py } - python_execute_function testing + python_execute_function -s testing +} + +src_install() { + PYTHONPATH="feedparser" distutils_src_install } diff --git a/dev-python/feedparser/files/feedparser-5.0.1-sgmllib.patch b/dev-python/feedparser/files/feedparser-5.0.1-sgmllib.patch new file mode 100644 index 000000000000..426290370d49 --- /dev/null +++ b/dev-python/feedparser/files/feedparser-5.0.1-sgmllib.patch @@ -0,0 +1,26 @@ +--- feedparser/feedparser.py ++++ feedparser/feedparser.py +@@ -135,7 +135,11 @@ + #ACCEPTABLE_URI_SCHEMES = () + + # ---------- required modules (should come with any Python distribution) ---------- +-import sgmllib, re, sys, copy, urlparse, time, types, cgi, urllib, urllib2, datetime ++import re, sys, copy, urlparse, time, types, cgi, urllib, urllib2, datetime ++try: ++ import sgmllib ++except ImportError: ++ import _feedparser_sgmllib as sgmllib + try: + from io import BytesIO as _StringIO + except ImportError: +--- setup.py ++++ setup.py +@@ -17,7 +17,7 @@ + download_url = 'http://code.google.com/p/feedparser/', + platforms = ['POSIX', 'Windows'], + package_dir = {'': 'feedparser'}, +- py_modules = ['feedparser'], ++ py_modules = ['feedparser', '_feedparser_sgmllib'], + keywords = ['atom', 'cdf', 'feed', 'parser', 'rdf', 'rss'], + classifiers = [ + 'Development Status :: 5 - Production/Stable', |