4ad33ed68364998f10d78454c7df8f731a29d254
[gentoo.git] / dev-python / ndg-httpsclient / ndg-httpsclient-0.5.1.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 DISTUTILS_USE_SETUPTOOLS=rdepend
7 PYTHON_COMPAT=( python3_{6,7,8} pypy3 )
8
9 inherit distutils-r1
10
11 DESCRIPTION="Provides enhanced HTTPS support for httplib and urllib2 using PyOpenSSL"
12 HOMEPAGE="
13         https://github.com/cedadev/ndg_httpsclient/
14         https://pypi.org/project/ndg-httpsclient/"
15 SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P/-/_}.tar.gz"
16 S="${WORKDIR}/${P/-/_}"
17
18 LICENSE="BSD"
19 SLOT="0"
20 KEYWORDS="~amd64 ~arm ~x86"
21
22 RDEPEND="
23         dev-python/pyaes[${PYTHON_USEDEP}]
24         dev-python/pyopenssl[${PYTHON_USEDEP}]"
25 # we need to block the previous versions since incorrect namespace
26 # install breaks tests
27 DEPEND="${RDEPEND}
28         test? (
29                 !!<dev-python/ndg-httpsclient-0.4.2-r1
30                 dev-libs/openssl:0
31                 sys-libs/libfaketime
32         )"
33
34 distutils_enable_tests unittest
35
36 src_test() {
37         # bundled certificates expired, so we need a time machine
38         local -x FAKETIME="@2019-12-01 12:00:00"
39         local -x LD_PRELOAD="libfaketime.so:${LD_PRELOAD}"
40
41         # we need to start a fake https server for tests to connect to
42         ( cd ndg/httpsclient/test && sh ./scripts/openssl_https_server.sh ) &
43         local server_pid=${!}
44
45         distutils-r1_src_test
46
47         kill "${server_pid}"
48         wait
49 }