From 27544d0a74267ab6057dc816ea3311bc9149a200 Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Wed, 15 Feb 2017 11:31:27 +0100 Subject: [PATCH] python: Fix build system integration. * lang/python/Makefile.am (copystamp): Also copy the setup script, and link the header files. (all-local): Use local setup script. (sdist): Fix Python source distribution creation. (CLEANFILES): Remove now obsolete files. (install-exec-local): Use local setup script. * lang/python/setup.py.in: Adjust relative paths to in-tree files. Fixes-commit: fe65a26ab584bd70fad45c7c4d44330e30a748a4 Signed-off-by: Justus Winter --- lang/python/Makefile.am | 31 ++++++++++++++++--------------- lang/python/setup.py.in | 8 ++++---- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/lang/python/Makefile.am b/lang/python/Makefile.am index 908f622d..2724d869 100644 --- a/lang/python/Makefile.am +++ b/lang/python/Makefile.am @@ -46,47 +46,48 @@ COPY_FILES_GPG = \ # For VPATH builds we need to copy some files because Python's # distutils are not VPATH-aware. -copystamp: $(COPY_FILES) $(COPY_FILES_GPG) data.h config.h +copystamp: $(COPY_FILES) $(COPY_FILES_GPG) + for F in $(COPY_FILES) $(COPY_FILES_GPG) ; do if [ $$F -nt $@ ]; then echo $F ; fi ; done for VERSION in $(PYTHON_VERSIONS); do \ $(MKDIR_P) python$${VERSION}-gpg/gpg && \ cp -R $(COPY_FILES) python$${VERSION}-gpg && \ + cp setup.py python$${VERSION}-gpg && \ cp gpg/version.py python$${VERSION}-gpg/gpg && \ + ln -sf "$(abs_top_srcdir)/src/data.h" python$${VERSION}-gpg && \ + ln -sf "$(abs_top_builddir)/config.h" python$${VERSION}-gpg && \ cp -R $(COPY_FILES_GPG) python$${VERSION}-gpg/gpg ; \ done touch $@ -data.h: - ln -s "$(top_srcdir)/src/data.h" . - -config.h: - ln -s "$(top_builddir)/config.h" . - all-local: copystamp set $(PYTHONS); for VERSION in $(PYTHON_VERSIONS); do \ PYTHON="$$1" ; shift ; \ cd python$${VERSION}-gpg && \ CFLAGS="$(CFLAGS)" \ - $$PYTHON ../setup.py build --verbose ; \ + $$PYTHON setup.py build --verbose ; \ cd .. ; \ done -dist/gpg-$(VERSION).tar.gz dist/gpg-$(VERSION).tar.gz.asc: copystamp +python$(PYTHON_VERSION)-gpg/dist/gpg-$(VERSION).tar.gz \ +python$(PYTHON_VERSION)-gpg/dist/gpg-$(VERSION).tar.gz.asc: copystamp + cd python$(PYTHON_VERSION)-gpg && \ CFLAGS="$(CFLAGS)" \ $(PYTHON) setup.py sdist --verbose - gpg2 --detach-sign --armor dist/gpg-$(VERSION).tar.gz + gpg2 --detach-sign --armor python$(PYTHON_VERSION)-gpg/dist/gpg-$(VERSION).tar.gz .PHONY: prepare prepare: copystamp .PHONY: sdist -sdist: dist/gpg-$(VERSION).tar.gz dist/gpg-$(VERSION).tar.gz.asc +sdist: python$(PYTHON_VERSION)-gpg/dist/gpg-$(VERSION).tar.gz \ + python$(PYTHON_VERSION)-gpg/dist/gpg-$(VERSION).tar.gz.asc .PHONY: upload -upload: dist/gpg-$(VERSION).tar.gz dist/gpg-$(VERSION).tar.gz.asc +upload: python$(PYTHON_VERSION)-gpg/dist/gpg-$(VERSION).tar.gz \ + python$(PYTHON_VERSION)-gpg/dist/gpg-$(VERSION).tar.gz.asc twine upload $^ -CLEANFILES = gpgme.h errors.i gpgme_wrap.c gpg/gpgme.py \ - data.h config.h copystamp +CLEANFILES = copystamp # Remove the rest. # @@ -104,7 +105,7 @@ install-exec-local: set $(PYTHONS); for VERSION in $(PYTHON_VERSIONS); do \ PYTHON="$$1" ; shift ; \ cd python$${VERSION}-gpg && \ - $$PYTHON ../setup.py install \ + $$PYTHON setup.py install \ --prefix $(DESTDIR)$(prefix) \ --record files.txt \ --verbose ; \ diff --git a/lang/python/setup.py.in b/lang/python/setup.py.in index 5b5d5bec..e32237dd 100755 --- a/lang/python/setup.py.in +++ b/lang/python/setup.py.in @@ -34,12 +34,12 @@ in_tree = False extra_swig_opts = [] extra_macros = dict() -if os.path.exists("../../src/gpgme-config"): +if os.path.exists("../../../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 = ["../../../src/gpgme-config"] + gpgme_config_flags + gpgme_h = "../../../src/gpgme.h" + library_dirs = ["../../../src/.libs"] # XXX uses libtool internals extra_macros.update( HAVE_CONFIG_H=1, HAVE_DATA_H=1,