4d850008222212a735b98ea8c89c10a45c9563c6
[gentoo.git] / dev-python / oslo-serialization / oslo-serialization-2.24.0-r1.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 PYTHON_COMPAT=( python2_7 python3_{6,7} )
7
8 inherit distutils-r1 vcs-snapshot
9
10 MY_PN=${PN/-/.}
11
12 DESCRIPTION="Oslo Serialization library"
13 HOMEPAGE="https://launchpad.net/oslo"
14 SRC_URI="mirror://pypi/${MY_PN:0:1}/${MY_PN}/${MY_PN}-${PV}.tar.gz -> ${P}.tar.gz"
15
16 LICENSE="Apache-2.0"
17 SLOT="0"
18 KEYWORDS="amd64 ~arm64 x86"
19 IUSE="doc test"
20
21 CDEPEND=">=dev-python/pbr-2.0.0[${PYTHON_USEDEP}]
22         !~dev-python/pbr-2.1.0[${PYTHON_USEDEP}]"
23 DEPEND="
24         dev-python/setuptools[${PYTHON_USEDEP}]
25         ${CDEPEND}
26         test? (
27                 virtual/python-ipaddress[${PYTHON_USEDEP}]
28                 >=dev-python/mock-2.0.0[${PYTHON_USEDEP}]
29                 >=dev-python/netaddr-0.7.18[${PYTHON_USEDEP}]
30                 >=dev-python/oslo-i18n-3.15.3[${PYTHON_USEDEP}]
31                 >=dev-python/oslotest-1.10.0[${PYTHON_USEDEP}]
32                 >=dev-python/bandit-1.1.0[${PYTHON_USEDEP}]
33         )
34         doc? (
35                 >=dev-python/sphinx-1.6.2[${PYTHON_USEDEP}]
36                 >=dev-python/openstackdocstheme-1.17.0[${PYTHON_USEDEP}]
37                 >=dev-python/reno-2.5.0[${PYTHON_USEDEP}]
38         )
39 "
40 RDEPEND="
41         ${CDEPEND}
42         >=dev-python/six-1.10.0[${PYTHON_USEDEP}]
43         >=dev-python/msgpack-0.4.0[${PYTHON_USEDEP}]
44         >=dev-python/oslo-utils-3.20.0[${PYTHON_USEDEP}]
45         >=dev-python/pytz-2013.6[${PYTHON_USEDEP}]
46 "
47
48 python_prepare_all() {
49         # allow useage of renamed msgpack
50         sed -i '/^msgpack/d' requirements.txt || die
51         use doc && esetup.py build_sphinx
52         distutils-r1_python_prepare_all
53 }
54
55 # Note: Tests fail due to requiring installation.
56 #
57 # Installation appears to fail due ot the use of namespace packages but root
58 # cause was never truly established.
59 RESTRICT="test"
60
61 python_test() {
62         distutils_install_for_testing
63
64         PYTHONPATH="${TEST_DIR}/lib:${PYTHONPATH}"
65
66         rm -rf .testrepository || die "couldn't remove '.testrepository' under ${EPTYHON}"
67
68         testr init || die "testr init failed under ${EPYTHON}"
69         testr run || die "testr run failed under ${EPYTHON}"
70 }
71
72 python_install_all() {
73         use doc && local HTML_DOCS=( doc/build/html/. )
74
75         distutils-r1_python_install_all
76 }