*/*: Clean PYTHON_COMPAT of obsolete impls
[gentoo.git] / www-plugins / passff-host / passff-host-1.2.0-r1.ebuild
1 # Copyright 2018-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 PYTHON_COMPAT=( python3_6 python3_7 )
7
8 inherit python-single-r1
9
10 DESCRIPTION="Host app for the PassFF WebExtension"
11 HOMEPAGE="https://github.com/passff/passff-host"
12
13 SRC_URI="
14         https://github.com/passff/passff-host/releases/download/${PV}/passff.py -> ${P}.py
15         https://github.com/passff/passff-host/releases/download/${PV}/passff.json -> ${P}.json
16 "
17
18 LICENSE="GPL-2"
19 SLOT="0"
20 KEYWORDS="~amd64 ~x86"
21 IUSE="chrome chromium firefox vivaldi"
22 REQUIRED_USE="
23         ${PYTHON_REQUIRED_USE}
24         || ( chrome chromium firefox vivaldi )
25 "
26
27 RDEPEND="${PYTHON_DEPS}"
28
29 S="${WORKDIR}"
30
31 src_unpack() {
32         cp "${DISTDIR}/${P}.json" . || die
33         cp "${DISTDIR}/${P}.py" . || die
34 }
35
36 src_prepare() {
37         default
38         python_fix_shebang "${P}.py"
39 }
40
41 src_install() {
42         local target_dirs=()
43
44         use chrome   && target_dirs+=( "/etc/opt/chrome/native-messaging-hosts" )
45         use chromium && target_dirs+=( "/etc/chromium/native-messaging-hosts" )
46         use firefox  && target_dirs+=( "/usr/$(get_libdir)/mozilla/native-messaging-hosts" )
47         use vivaldi  && target_dirs+=( "/etc/vivaldi/native-messaging-hosts" )
48
49         for target_dir in "${target_dirs[@]}"; do
50                 sed "s;PLACEHOLDER;${target_dir}/passff.py;g" "${P}.json" > "passff.json" || die
51
52                 insinto "${target_dir}"
53                 doins passff.json
54                 exeinto "${target_dir}"
55                 newexe "${P}.py" passff.py
56         done
57 }