summaryrefslogtreecommitdiff
blob: 8926a63fc2d87e03d81805ae99d1b51edcf5b966 (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
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=6

PYTHON_COMPAT=( python3_{6,7} )
inherit gnome2-utils meson python-single-r1 virtualx xdg-utils

DESCRIPTION="Two-factor authentication code generator for GNOME"
HOMEPAGE="https://gitlab.gnome.org/World/Authenticator"

if [[ ${PV} == *9999 ]]; then
	inherit git-r3
	SRC_URI=""
	EGIT_REPO_URI="https://gitlab.gnome.org/World/Authenticator"
else
	SRC_URI="https://gitlab.gnome.org/World/Authenticator/-/archive/${PV}/Authenticator-${PV}.tar.gz -> ${P}.tar.gz"
	S="${WORKDIR}/Authenticator-${PV}"
	KEYWORDS="~amd64 ~x86"
fi

LICENSE="GPL-2+"
SLOT="0"
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
IUSE="test"
RESTRICT="!test? ( test )"
RDEPEND="
	${PYTHON_DEPS}
	app-crypt/libsecret
	$(python_gen_cond_dep '
		dev-python/pillow[${PYTHON_MULTI_USEDEP}]
		dev-python/pygobject:3[${PYTHON_MULTI_USEDEP}]
		dev-python/pyotp[${PYTHON_MULTI_USEDEP}]
		dev-python/python-gnupg[${PYTHON_MULTI_USEDEP}]
		dev-python/pyzbar[${PYTHON_MULTI_USEDEP}]
	')
	media-libs/gd
	x11-libs/gtk+:3
"
DEPEND="${RDEPEND}
	test? ( x11-apps/xhost )"
PATCHES=(
	"${FILESDIR}/${P}-disable-failing-tests.patch"
	"${FILESDIR}/${P}-support-use-of-gdlib-from-system.patch"
)

src_prepare() {
	default

	sed -i -e "1s:#!/usr/bin/env python3:#!${PYTHON}:" "authenticator.py.in" || die "Could not fix shebang."

	rm -r "subprojects/libgd" || die "Could not remove the subproject libgd folder."
}

pkg_preinst() {
	gnome2_icon_savelist
	gnome2_schemas_savelist
}

src_test() {
	xdg_environment_reset
	virtx meson_src_test
}

pkg_postinst() {
	gnome2_icon_cache_update
	gnome2_schemas_update
}

pkg_postrm() {
	gnome2_icon_cache_update
	gnome2_schemas_update
}