summaryrefslogtreecommitdiff
blob: e26e409f3d1a0db21827a7ad7dfa327a0be04a98 (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=6

PYTHON_COMPAT=( python2_7 python3_{4,5,6} )
PYTHON_REQ_USE="sqlite(+)"

inherit distutils-r1

DESCRIPTION="A high-level Python Screen Scraping framework"
HOMEPAGE="https://github.com/scrapy/scrapy/ https://pypi.python.org/pypi/Scrapy/"
SRC_URI="https://github.com/${PN}/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="BSD-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="boto doc ibl test ssl"

RDEPEND="
	>=dev-python/six-1.5.2[${PYTHON_USEDEP}]
	dev-libs/libxml2[python,${PYTHON_USEDEP}]
	dev-python/pillow[${PYTHON_USEDEP}]
	>=dev-python/parsel-1.1.0[${PYTHON_USEDEP}]
	>=dev-python/lxml-3.4[${PYTHON_USEDEP}]
	ibl? ( dev-python/numpy[${PYTHON_USEDEP}] )
	ssl? (
		>=dev-python/pyopenssl-0.14[${PYTHON_USEDEP}]
		dev-python/cryptography[${PYTHON_USEDEP}] )
	boto? ( dev-python/boto3[${PYTHON_USEDEP}] )
	>=dev-python/twisted-14.0[${PYTHON_USEDEP}]
	>=dev-python/w3lib-1.8.0[${PYTHON_USEDEP}]
	dev-python/queuelib[${PYTHON_USEDEP}]
	>=dev-python/cssselect-0.9[${PYTHON_USEDEP}]
	>=dev-python/six-1.5.2[${PYTHON_USEDEP}]
	dev-python/service_identity[${PYTHON_USEDEP}]
	"
DEPEND="
	dev-python/setuptools[${PYTHON_USEDEP}]
	doc? ( dev-python/sphinx[${PYTHON_USEDEP}] )
	test? ( ${RDEPEND}
		dev-python/mock[${PYTHON_USEDEP}]
		=net-proxy/mitmproxy-0.10.1[${PYTHON_USEDEP}]
		=dev-python/netlib-0.10.1[${PYTHON_USEDEP}]
		dev-python/jmespath[${PYTHON_USEDEP}]
		dev-python/testfixtures[${PYTHON_USEDEP}]
		net-ftp/vsftpd
	)"
# pytest-twisted listed as a test dep but not in portage.
# Testsuite currently survives without it, so appears optional

REQUIRED_USE="test? ( ssl boto )"

python_prepare_all() {
	# https://github.com/scrapy/scrapy/issues/1464
	# Disable failing tests known to pass according to upstream
	# Awaiting a fix planned by package owner.
	sed -e 's:test_https_connect_tunnel:_&:' \
		-e 's:test_https_connect_tunnel_error:_&:' \
		-e 's:test_https_tunnel_auth_error:_&:' \
		-e 's:test_https_tunnel_without_leak_proxy_authorization_header:_&:' \
		-i tests/test_proxy_connect.py || die

	distutils-r1_python_prepare_all
}

python_compile_all() {
	if use doc; then
		PYTHONPATH="${S}" emake -C docs html || die "emake html failed"
	fi
}

python_test() {
	py.test ${PN} tests || die "tests failed"
}

python_install_all() {
	use doc && local HTML_DOCS=( docs/build/html/. )
	distutils-r1_python_install_all
}