diff options
author | Alon Bar-Lev <alonbl@gentoo.org> | 2016-09-24 02:26:37 +0300 |
---|---|---|
committer | Alon Bar-Lev <alonbl@gentoo.org> | 2016-09-24 02:26:53 +0300 |
commit | 8642c015c4c6d689766cce9f0e626d08b1478a53 (patch) | |
tree | abc0e44964d9e30e3c7efc18d4039443f5d35fae /app-crypt/gpgme | |
parent | app-vim/perlomni: add perlomni to the tree. (diff) | |
download | gentoo-8642c015c4c6d689766cce9f0e626d08b1478a53.tar.gz gentoo-8642c015c4c6d689766cce9f0e626d08b1478a53.tar.bz2 gentoo-8642c015c4c6d689766cce9f0e626d08b1478a53.zip |
app-crypt/gpgme: add python bindings
Diffstat (limited to 'app-crypt/gpgme')
-rw-r--r-- | app-crypt/gpgme/files/gpgme-1.7.0-build-python.patch | 136 | ||||
-rw-r--r-- | app-crypt/gpgme/gpgme-1.7.0.ebuild | 37 |
2 files changed, 170 insertions, 3 deletions
diff --git a/app-crypt/gpgme/files/gpgme-1.7.0-build-python.patch b/app-crypt/gpgme/files/gpgme-1.7.0-build-python.patch new file mode 100644 index 000000000000..950813fe2320 --- /dev/null +++ b/app-crypt/gpgme/files/gpgme-1.7.0-build-python.patch @@ -0,0 +1,136 @@ +From a46cd3926d629da23b365b70b7bf24201c25d430 Mon Sep 17 00:00:00 2001 +From: Alon Bar-Lev <alon.barlev@gmail.com> +Date: Sat, 24 Sep 2016 01:26:19 +0300 +Subject: [PATCH] build: lang: python: cleanups + +1. Make setup.py executable when generated. + +2. Add prepare target to enable prepare the source tree without building + anything. This is handy to enable standard distutils build outside of + gpgme build system. + +3. Treat data.h in similar manner as other VPATH issues, just copy it to + the srcdir to simplify build, remove the CFLAGS requirement of + distutils. + +4. Add environment variable (binary_builddir) for setup to use alternate + build directory so that for multiple targets same binaries may be + used without rebuilding the C part. + +The above does not alter the behavior of current build but supports the +following sequence: + +$ mkdir common +$ cd common +$ ../configure --enable-languages= +$ make +$ cd .. +$ mkdir python +$ cd python +$ ../configure --enable-languages= +$ cd lang/python +$ make prepare +$ binary_builddir="../../../common" ./setup.py build +$ binary_builddir="../../../common" ./setup.py install + +Notice the standard use of distutils which is required for package +manager to control the python selection and build process. + +Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com> +--- + configure.ac | 2 +- + lang/python/Makefile.am | 11 ++++++----- + lang/python/gpgme.i | 2 +- + lang/python/setup.py.in | 9 +++++---- + 4 files changed, 13 insertions(+), 11 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 4a29f2f..efa1f19 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -886,9 +886,9 @@ AC_CONFIG_FILES([lang/Makefile lang/cl/Makefile lang/cl/gpgme.asd]) + AM_COND_IF([HAVE_DOXYGEN], [AC_CONFIG_FILES([lang/qt/doc/Doxyfile])]) + AC_CONFIG_FILES(lang/qt/doc/Makefile) + AC_CONFIG_FILES([lang/python/Makefile +- lang/python/setup.py + lang/python/pyme/version.py + lang/python/tests/Makefile]) ++AC_CONFIG_FILES([lang/python/setup.py], [chmod a+x lang/python/setup.py]) + AC_OUTPUT + + echo " +diff --git a/lang/python/Makefile.am b/lang/python/Makefile.am +index 2271ce0..fb1eebf 100644 +--- a/lang/python/Makefile.am ++++ b/lang/python/Makefile.am +@@ -51,17 +51,18 @@ copystamp: $(COPY_FILES) $(COPY_FILES_PYME) + cp -R $(COPY_FILES) . ; \ + cp -R $(COPY_FILES_PYME) pyme ; \ + fi ++ cp "$(top_srcdir)/src/data.h" . + touch $@ + ++prepare: copystamp ++ + all-local: copystamp + for PYTHON in $(PYTHONS); do \ +- CFLAGS="$(CFLAGS) -I$(top_srcdir)" \ +- $$PYTHON setup.py build --verbose ; \ ++ $$PYTHON setup.py build --verbose ; \ + done + + dist/pyme3-$(VERSION).tar.gz dist/pyme3-$(VERSION).tar.gz.asc: copystamp +- CFLAGS="$(CFLAGS) -I$(top_srcdir)" \ +- $(PYTHON) setup.py sdist --verbose ++ $(PYTHON) setup.py sdist --verbose + gpg2 --detach-sign --armor dist/pyme3-$(VERSION).tar.gz + + .PHONY: sdist +@@ -72,7 +73,7 @@ upload: dist/pyme3-$(VERSION).tar.gz dist/pyme3-$(VERSION).tar.gz.asc + twine upload $^ + + CLEANFILES = gpgme.h errors.i gpgme_wrap.c pyme/gpgme.py \ +- copystamp ++ data.h copystamp + + # Remove the rest. + # +diff --git a/lang/python/gpgme.i b/lang/python/gpgme.i +index 84addae..ac666f4 100644 +--- a/lang/python/gpgme.i ++++ b/lang/python/gpgme.i +@@ -183,7 +183,7 @@ + representation of struct gpgme_data for an very efficient check if + the buffer has been modified. */ + %{ +-#include "src/data.h" /* For struct gpgme_data. */ ++#include "data.h" /* For struct gpgme_data. */ + %} + #endif + +diff --git a/lang/python/setup.py.in b/lang/python/setup.py.in +index 31892c1..ce06758 100755 +--- a/lang/python/setup.py.in ++++ b/lang/python/setup.py.in +@@ -32,13 +32,14 @@ library_dirs = [] + in_tree = False + extra_swig_opts = [] + extra_macros = dict() ++binary_builddir=os.environ.get('binary_builddir', '../..') + +-if os.path.exists("../../src/gpgme-config"): ++if os.path.exists(os.path.join(binary_builddir, "src/gpgme-config")): + # In-tree build. + in_tree = True +- gpgme_config = ["../../src/gpgme-config"] + gpgme_config_flags +- gpgme_h = "../../src/gpgme.h" +- library_dirs = ["../../src/.libs"] # XXX uses libtool internals ++ gpgme_config = [os.path.join(binary_builddir, "src/gpgme-config")] + gpgme_config_flags ++ gpgme_h = os.path.join(binary_builddir, "src/gpgme.h") ++ library_dirs = [os.path.join(binary_builddir, "src/.libs")] # XXX uses libtool internals + extra_macros.update( + HAVE_DATA_H=1, + IN_TREE_BUILD=1, +-- +2.7.3 + diff --git a/app-crypt/gpgme/gpgme-1.7.0.ebuild b/app-crypt/gpgme/gpgme-1.7.0.ebuild index 2d507d5aa42e..7ea80becd83d 100644 --- a/app-crypt/gpgme/gpgme-1.7.0.ebuild +++ b/app-crypt/gpgme/gpgme-1.7.0.ebuild @@ -4,7 +4,10 @@ EAPI="6" -inherit autotools eutils +PYTHON_COMPAT=( python2_7 python3_{3,4} ) +DISTUTILS_OPTIONAL=1 + +inherit autotools distutils-r1 eutils DESCRIPTION="GnuPG Made Easy is a library for making GnuPG easier to use" HOMEPAGE="http://www.gnupg.org/related_software/gpgme" @@ -13,7 +16,7 @@ SRC_URI="mirror://gnupg/gpgme/${P}.tar.bz2" LICENSE="GPL-2 LGPL-2.1" SLOT="1/11" # subslot = soname major version KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd ~x64-freebsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc64-solaris ~x64-solaris ~x86-solaris" -IUSE="common-lisp static-libs cxx qt5 test" +IUSE="common-lisp static-libs cxx python qt5 test" RDEPEND="app-crypt/gnupg >=dev-libs/libassuan-2.0.2 @@ -22,7 +25,8 @@ RDEPEND="app-crypt/gnupg dev-qt/qtcore:5 !kde-apps/gpgmepp:4 !kde-apps/kdepimlibs:4 - )" + ) + python? ( ${PYTHON_DEPS} )" #doc? ( app-doc/doxygen[dot] ) DEPEND="${RDEPEND} qt5? ( @@ -35,11 +39,21 @@ PATCHES=( "${FILESDIR}"/${PN}-1.1.8-et_EE.patch "${FILESDIR}"/${P}-build-tests.patch "${FILESDIR}"/${P}-build-tests-disable.patch + "${FILESDIR}"/${P}-build-python.patch ) +do_python() { + if use python; then + pushd lang/python > /dev/null || die + binary_builddir="${S}" distutils-r1_src_${EBUILD_PHASE} + popd > /dev/null + fi +} + src_prepare() { default eautoreconf + do_python } src_configure() { @@ -56,9 +70,26 @@ src_configure() { --includedir="${EPREFIX}/usr/include/gpgme" \ --enable-languages="${languages[*]}" \ $(use_enable static-libs static) + + python_conf() { + econf --enable-languages= + } + use python && python_foreach_impl python_conf + do_python +} + +src_compile() { + default + + python_build() { + make -C lang/python prepare + } + use python && python_foreach_impl python_build + do_python } src_install() { default + do_python prune_libtool_files } |