summaryrefslogtreecommitdiff
blob: 95d914e6d7b1ec0b4cc0f569c0c3b3078683fb79 (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
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI=3

SUPPORT_PYTHON_ABIS="1"
RESTRICT_PYTHON_ABIS="2.5 2.7-pypy-*"

inherit distutils eutils

DESCRIPTION="Python wrapper for the GPGME library"
HOMEPAGE="https://launchpad.net/pygpgme http://pypi.python.org/pypi/pygpgme"
SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"

LICENSE="LGPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="examples"

DEPEND="app-crypt/gpgme"
RDEPEND="${DEPEND}"

PYTHON_CFLAGS=("2.* + -fno-strict-aliasing")

src_prepare() {
	local gpgme_cflags=$(gpgme-config --cflags)
	sed -e "s:libraries=:include_dirs=['${gpgme_cflags/\-I}'], &:" \
		-i setup.py || die
	epatch "${FILESDIR}"/${P}-interactive_tests.patch
	distutils_src_prepare
}

src_test() {
	testing() {
		PYTHONPATH="$(ls -d build-${PYTHON_ABI}/lib.*)" "$(PYTHON)" test_all.py
	}
	python_execute_function testing
}

src_install() {
	distutils_src_install
	if use examples; then
		insinto /usr/share/doc/${PF}/examples
		doins examples/encrypt.py
	fi
}
#TODO
#  * test fails to import gpgme despite correct PYTHONPATH, that doesn't happen
#    when SUPPORT_PYTHON_ABIS is unset
#  * installs /usr/lib64/python3.2/site-packages/gpgme/_gpgme.cpython-32.so  ???