summaryrefslogtreecommitdiff
blob: 25f03c5b5540ca450eca320d6fdf82735774a7f4 (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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-misc/electrum/electrum-1.9.8.ebuild,v 1.1 2014/03/17 21:15:47 blueness Exp $

EAPI="5"

PYTHON_COMPAT=( python{2_6,2_7} )

inherit eutils distutils-r1 gnome2-utils

MY_P=Electrum-${PV}
DESCRIPTION="User friendly Bitcoin client"
HOMEPAGE="http://electrum.org/"
SRC_URI="http://download.electrum.org/download/${MY_P}.tar.gz"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64 ~x86"
LINGUAS="ar_SA cs_CZ de_DE eo_UY es_ES fr_FR hu_HU
		 id_ID it_IT ja_JP ky_KG lv_LV nl_NL
		 pl_PL pt_BR pt_PT ro_RO ru_RU sl_SI
		 ta_IN th_TH vi_VN zh_CN"

IUSE="gtk qrcode +qt4 webkit"

for lingua in ${LINGUAS}; do
		IUSE+=" linguas_${lingua}"
done

RDEPEND="
	dev-python/setuptools[${PYTHON_USEDEP}]
	>=dev-python/ecdsa-0.9[${PYTHON_USEDEP}]
	dev-python/slowaes[${PYTHON_USEDEP}]
	gtk? ( dev-python/pygtk:2[${PYTHON_USEDEP}] )
	qrcode? ( media-gfx/zbar[python] )
	qt4? (
		 webkit? ( dev-python/PyQt4[webkit] )
		 dev-python/PyQt4[${PYTHON_USEDEP}]
		 )"

S=${WORKDIR}/${MY_P}

DOCS="RELEASE-NOTES"

src_prepare() {
	# Prevent .desktop, icon, and translations from being installed in the wrong locations
	epatch "${FILESDIR}"/setup.py-1.9.7.patch

	epatch "${FILESDIR}"/electrum.desktop-1.9.7.patch
	validate_desktop_entries

	# Remove unrequested localization files:
	for lang in ${LINGUAS}; do
		if use linguas_${lang}; then
			test -f "locale/${lang}/LC_MESSAGES/${PN}.mo" || die
		else
			rm -r "locale/${lang}" || die
		fi
	done

	# Remove unrequested GUI implementations:
	if use !gtk; then
		sed -i "/'electrum_gui.gtk/d" setup.py || die
	fi
	if use !qt4; then
		sed -i "/'electrum_gui.qt/d" setup.py  || die
	fi

	if use !qt4; then
		if use gtk; then
			sed -i "s/config.get('gui','classic')/ config.get('gui','gtk')/" electrum || die
		else
			sed -i "s/config.get('gui','classic')/ config.get('gui','text')/" electrum || die
		fi
	fi

	if use !webkit; then
		sed -i "/'electrum_plugins.coinbase_buyback/d" setup.py || die
	fi

	if use !qrcode; then
		sed -i "/'electrum_plugins.qrscanner/d" setup.py || die
	fi

	distutils-r1_src_prepare
}

src_install() {
	doicon -s 128 icons/${PN}.png
	distutils-r1_src_install
}

pkg_preinst() {
	gnome2_icon_savelist
}

pkg_postinst() {
	gnome2_icon_cache_update
}

pkg_postrm() {
	gnome2_icon_cache_update
}