*/*: Clean PYTHON_COMPAT of obsolete impls
[gentoo.git] / app-emulation / cloud-init / cloud-init-18.4-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 PYTHON_COMPAT=( python2_7 python3_6 )
6
7 inherit distutils-r1
8
9 DESCRIPTION="Cloud instance initialisation magic"
10 HOMEPAGE="https://launchpad.net/cloud-init"
11 SRC_URI="https://launchpad.net/${PN}/trunk/${PV}/+download/${P}.tar.gz"
12
13 LICENSE="GPL-3"
14 SLOT="0"
15 KEYWORDS="~amd64 ~x86"
16 IUSE="test"
17 RESTRICT="!test? ( test )"
18
19 CDEPEND="
20         dev-python/jinja[${PYTHON_USEDEP}]
21         dev-python/oauthlib[${PYTHON_USEDEP}]
22         dev-python/pyserial[${PYTHON_USEDEP}]
23         >=dev-python/configobj-5.0.2[${PYTHON_USEDEP}]
24         dev-python/pyyaml[${PYTHON_USEDEP}]
25         dev-python/requests[${PYTHON_USEDEP}]
26         dev-python/jsonpatch[${PYTHON_USEDEP}]
27         dev-python/jsonschema[${PYTHON_USEDEP}]
28         dev-python/six[${PYTHON_USEDEP}]
29 "
30 DEPEND="
31         dev-python/setuptools[${PYTHON_USEDEP}]
32         test? (
33                 ${CDEPEND}
34                 >=dev-python/httpretty-0.7.1[${PYTHON_USEDEP}]
35                 dev-python/mock[${PYTHON_USEDEP}]
36                 dev-python/nose[${PYTHON_USEDEP}]
37                 dev-python/unittest2[${PYTHON_USEDEP}]
38                 dev-python/coverage[${PYTHON_USEDEP}]
39                 dev-python/contextlib2[${PYTHON_USEDEP}]
40         )
41 "
42 RDEPEND="
43         ${CDEPEND}
44         net-analyzer/macchanger
45         sys-apps/iproute2
46         sys-fs/growpart
47         virtual/logger
48 "
49
50 PATCHES=(
51         # Fix Gentoo support
52         # https://code.launchpad.net/~gilles-dartiguelongue/cloud-init/+git/cloud-init/+merge/358777
53         "${FILESDIR}"/${P}-fix-packages-module.patch
54         "${FILESDIR}"/${P}-gentoo-support-upstream-templates.patch
55         "${FILESDIR}"/${PV}-fix-filename-for-storing-locale.patch
56         "${FILESDIR}"/${PV}-fix-update_package_sources-function.patch
57         "${FILESDIR}"/${PV}-add-support-for-package_upgrade.patch
58 )
59
60 src_prepare() {
61         # Fix location of documentation installation
62         sed -i "s:USR + '/share/doc/cloud-init:USR + '/share/doc/${PF}:" setup.py || die
63         distutils-r1_src_prepare
64 }
65
66 python_test() {
67         # Do not use Makefile target as it does not setup environment correclty
68         esetup.py nosetests -v --where cloudinit --where tests/unittests || die
69 }
70
71 python_install() {
72         distutils-r1_python_install --init-system=sysvinit_openrc,systemd --distro gentoo
73 }
74
75 python_install_all() {
76         keepdir /etc/cloud
77
78         distutils-r1_python_install_all
79
80         # installs as non-executable
81         chmod +x "${D}"/etc/init.d/*
82 }
83
84 pkg_postinst() {
85         elog "cloud-init-local needs to be run in the boot runlevel because it"
86         elog "modifies services in the default runlevel.  When a runlevel is started"
87         elog "it is cached, so modifications that happen to the current runlevel"
88         elog "while you are in it are not acted upon."
89 }