[gpgme PATCH 3/3] build: lang: python: move data.h, config.h to package

Alon Bar-Lev alon.barlev at gmail.com
Thu Sep 29 09:30:58 CEST 2016


to make it easy to build the subpackage using standard tools as
standalone without altering environment nor CFLAGS, symlink the
required artifacts from source tree into subpackage directory
when preparing sources.

although data.h should be put in public API, for now it is the simplest
solution that may be altered in future.

this is required for minimizing the chase of downstream packager to
apply upstream changes.

Signed-off-by: Alon Bar-Lev <alon.barlev at gmail.com>
---
 lang/python/Makefile.am | 15 ++++++++++-----
 lang/python/gpgme.i     |  2 +-
 lang/python/setup.py.in |  4 ----
 3 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/lang/python/Makefile.am b/lang/python/Makefile.am
index ea37da9..9cb99c4 100644
--- a/lang/python/Makefile.am
+++ b/lang/python/Makefile.am
@@ -46,22 +46,27 @@ COPY_FILES_PYME = \
 
 # For VPATH builds we need to copy some files because Python's
 # distutils are not VPATH-aware.
-copystamp: $(COPY_FILES) $(COPY_FILES_PYME)
+copystamp: $(COPY_FILES) $(COPY_FILES_PYME) data.h config.h
 	if test "$(srcdir)" != "$(builddir)" ; then \
 	  cp -R $(COPY_FILES) . ; \
 	  cp -R $(COPY_FILES_PYME) pyme ; \
 	fi
 	touch $@
 
+data.h:
+	ln -s "$(top_srcdir)/src/data.h"
+
+config.h:
+	ln -s "$(top_builddir)/config.h"
+
 all-local: copystamp
 	for PYTHON in $(PYTHONS); do \
-	  CFLAGS="$(CFLAGS) -I$(top_srcdir)" \
-	  top_builddir="$(top_builddir)" \
+	  CFLAGS="$(CFLAGS)" \
 	    $$PYTHON setup.py build --verbose ; \
 	done
 
 dist/pyme3-$(VERSION).tar.gz dist/pyme3-$(VERSION).tar.gz.asc: copystamp
-	CFLAGS="$(CFLAGS) -I$(top_srcdir)" \
+	CFLAGS="$(CFLAGS)" \
 	  $(PYTHON) setup.py sdist --verbose
 	gpg2 --detach-sign --armor dist/pyme3-$(VERSION).tar.gz
 
@@ -76,7 +81,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 config.h copystamp
 
 # Remove the rest.
 #
diff --git a/lang/python/gpgme.i b/lang/python/gpgme.i
index eaeb4f8..5d074aa 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 7af2d48..4c41673 100755
--- a/lang/python/setup.py.in
+++ b/lang/python/setup.py.in
@@ -39,10 +39,6 @@ if os.path.exists("../../src/gpgme-config"):
     in_tree = True
     gpgme_config = ["../../src/gpgme-config"] + gpgme_config_flags
     gpgme_h = "../../src/gpgme.h"
-    if 'top_builddir' in os.environ:
-        include_dirs.append(os.environ['top_builddir'])
-        # Make sure that SWIG finds config.h when processing gpgme.i.
-        extra_swig_opts.append("-I{0}".format(os.environ['top_builddir']))
     library_dirs = ["../../src/.libs"] # XXX uses libtool internals
     extra_macros.update(
         HAVE_CONFIG_H=1,
-- 
2.7.3




More information about the Gnupg-devel mailing list