From e7d9c0c3d773f826dbd2ed417d04e25c410f3374 Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Mon, 3 Apr 2017 15:44:14 +0200 Subject: python: Fix vpath builds, fix distcheck. * lang/python/gpgme-h-clean.py: Delete file. * lang/python/MANIFEST.in: Adapt accordingly. * lang/python/Makefile.am (EXTRA_DIST): Likewise. (COPY_FILES_GPG): Bring variable back. (copystamp): Copy files. (clean-local): Delete copied files. (install-exec-local): Do not create and install list of installed files. (uninstall-local): Instead, create some explicit rules to uninstall the extension. * lang/python/setup.py.in: Parse arguments. Locate files either in the source directory, or in the build base directory. Inline the code from 'gpgme-h-clean.py'. Copy 'helpers.c', add source directory as include directory. Fixes-commit: 801d7d8c5dd530d26ad6c4bcc94d986e6e022da4 Signed-off-by: Justus Winter --- lang/python/Makefile.am | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) (limited to 'lang/python/Makefile.am') diff --git a/lang/python/Makefile.am b/lang/python/Makefile.am index b9145f5b..42beeee2 100644 --- a/lang/python/Makefile.am +++ b/lang/python/Makefile.am @@ -21,12 +21,20 @@ EXTRA_DIST = \ MANIFEST.in \ gpgme.i \ helpers.c helpers.h private.h \ - gpgme-h-clean.py \ examples \ gpg SUBDIRS = . tests +COPY_FILES_GPG = \ + $(srcdir)/gpg/callbacks.py \ + $(srcdir)/gpg/constants \ + $(srcdir)/gpg/core.py \ + $(srcdir)/gpg/errors.py \ + $(srcdir)/gpg/__init__.py \ + $(srcdir)/gpg/results.py \ + $(srcdir)/gpg/util.py + .PHONY: prepare prepare: copystamp @@ -35,12 +43,14 @@ prepare: copystamp copystamp: ln -sf "$(abs_top_srcdir)/src/data.h" . ln -sf "$(abs_top_builddir)/config.h" . + if test $(srcdir) != . ; then cp -R $(COPY_FILES_GPG) gpg ; fi touch $@ all-local: copystamp set -e ; set $(PYTHONS); for VERSION in $(PYTHON_VERSIONS); do \ PYTHON="$$1" ; shift ; \ CFLAGS="$(CFLAGS)" \ + srcdir="$(srcdir)" \ abs_top_builddir="$(abs_top_builddir)" \ $$PYTHON setup.py build --verbose --build-base=python$${VERSION}-gpg ; \ done @@ -48,6 +58,7 @@ all-local: copystamp python$(PYTHON_VERSION)-gpg/dist/gpg-$(VERSION).tar.gz.asc: copystamp $(MKDIR_P) python$(PYTHON_VERSION)-gpg-dist CFLAGS="$(CFLAGS)" \ + srcdir="$(srcdir)" \ abs_top_builddir="$(abs_top_builddir)" \ $(PYTHON) setup.py sdist --verbose --dist-dir=python$(PYTHON_VERSION)-gpg-dist \ --manifest=python$(PYTHON_VERSION)-gpg-dist/MANIFEST @@ -73,6 +84,12 @@ CLEANFILES = copystamp \ # permissions. clean-local: rm -rf -- build + if test $(srcdir) != . ; then \ + find gpg -type d ! -perm -200 -exec chmod u+w {} ';' ; \ + for FILE in $(COPY_FILES_GPG); do \ + rm -rf -- gpg/$$(basename $$FILE) ; \ + done \ + fi for VERSION in $(PYTHON_VERSIONS); do \ find python$${VERSION}-gpg -type d ! -perm -200 -exec chmod u+w {} ';' ; \ rm -rf -- python$${VERSION}-gpg ; \ @@ -81,20 +98,18 @@ clean-local: install-exec-local: set -e ; set $(PYTHONS); for VERSION in $(PYTHON_VERSIONS); do \ PYTHON="$$1" ; shift ; \ + srcdir="$(srcdir)" \ abs_top_builddir="$(abs_top_builddir)" \ $$PYTHON setup.py \ build \ --build-base=python$${VERSION}-gpg \ install \ --prefix "$(DESTDIR)$(prefix)" \ - --record files.txt \ --verbose ; \ - cat files.txt >> install_files.txt ; \ - rm files.txt ; \ done - $(MKDIR_P) "$(DESTDIR)$(pythondir)/gpg" - mv install_files.txt "$(DESTDIR)$(pythondir)/gpg" uninstall-local: - xargs < "$(DESTDIR)$(pythondir)/gpg/install_files.txt" -- rm -rf -- - rm -rf -- "$(DESTDIR)$(pythondir)/gpg" + GV=$$(echo $(VERSION) | tr - _); for PV in $(PYTHON_VERSIONS); do \ + rm -rf -- "$(DESTDIR)$(prefix)/lib/python$$PV/site-packages/gpg" \ +"$(DESTDIR)$(prefix)/lib/python$$PV/site-packages/gpg-$$GV-py$$PV.egg-info" ; \ + done -- cgit