aboutsummaryrefslogtreecommitdiff
blob: 946440b4fd1c69c2ceff8c47100d7cabd28129ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI="4"
SUPPORT_PYTHON_ABIS="1"
PYTHON_TESTS_RESTRICTED_ABIS="*-jython"
PYTHON_TESTS_FAILURES_TOLERANT_ABIS="*"

inherit distutils eutils subversion

ESVN_REPO_URI="http://feedparser.googlecode.com/svn/trunk/"
DESCRIPTION="Parse RSS and Atom feeds in Python"
HOMEPAGE="http://code.google.com/p/feedparser/ http://pypi.python.org/pypi/feedparser"

# sgmllib is licensed under PSF-2.
LICENSE="BSD-2 PSF-2"
SLOT="0"
KEYWORDS=""
IUSE=""

DEPEND="dev-python/setuptools"
RDEPEND=""

DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES="1"
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"

	sed -e "/import feedparser/isys.path.insert(0, '../build/lib')" -i feedparser/feedparsertest.py

	distutils_src_prepare

	preparation() {
		if [[ "${PYTHON_ABI}" == 3.* ]]; then
			2to3-${PYTHON_ABI} -nw --no-diffs feedparser/feedparsertest.py
		else
			# Avoid SyntaxErrors with Python 2.
			echo "raise ImportError" > feedparser/_feedparser_sgmllib.py
		fi
	}
	python_execute_function -s preparation
}

src_test() {
	testing() {
		cd feedparser || return 1
		"$(PYTHON)" feedparsertest.py
	}
	python_execute_function -s testing
}