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: fe65a26ab5
Signed-off-by: Justus Winter <justus@g10code.com>
This commit is contained in:
Justus Winter 2017-02-15 11:31:27 +01:00
parent 25f0435a00
commit 27544d0a74
No known key found for this signature in database
GPG Key ID: DD1A52F9DA8C9020
2 changed files with 20 additions and 19 deletions

View File

@ -46,47 +46,48 @@ COPY_FILES_GPG = \
# For VPATH builds we need to copy some files because Python's # For VPATH builds we need to copy some files because Python's
# distutils are not VPATH-aware. # 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 \ for VERSION in $(PYTHON_VERSIONS); do \
$(MKDIR_P) python$${VERSION}-gpg/gpg && \ $(MKDIR_P) python$${VERSION}-gpg/gpg && \
cp -R $(COPY_FILES) python$${VERSION}-gpg && \ cp -R $(COPY_FILES) python$${VERSION}-gpg && \
cp setup.py python$${VERSION}-gpg && \
cp gpg/version.py python$${VERSION}-gpg/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 ; \ cp -R $(COPY_FILES_GPG) python$${VERSION}-gpg/gpg ; \
done done
touch $@ touch $@
data.h:
ln -s "$(top_srcdir)/src/data.h" .
config.h:
ln -s "$(top_builddir)/config.h" .
all-local: copystamp all-local: copystamp
set $(PYTHONS); for VERSION in $(PYTHON_VERSIONS); do \ set $(PYTHONS); for VERSION in $(PYTHON_VERSIONS); do \
PYTHON="$$1" ; shift ; \ PYTHON="$$1" ; shift ; \
cd python$${VERSION}-gpg && \ cd python$${VERSION}-gpg && \
CFLAGS="$(CFLAGS)" \ CFLAGS="$(CFLAGS)" \
$$PYTHON ../setup.py build --verbose ; \ $$PYTHON setup.py build --verbose ; \
cd .. ; \ cd .. ; \
done 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)" \ CFLAGS="$(CFLAGS)" \
$(PYTHON) setup.py sdist --verbose $(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 .PHONY: prepare
prepare: copystamp prepare: copystamp
.PHONY: sdist .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 .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 $^ twine upload $^
CLEANFILES = gpgme.h errors.i gpgme_wrap.c gpg/gpgme.py \ CLEANFILES = copystamp
data.h config.h copystamp
# Remove the rest. # Remove the rest.
# #
@ -104,7 +105,7 @@ install-exec-local:
set $(PYTHONS); for VERSION in $(PYTHON_VERSIONS); do \ set $(PYTHONS); for VERSION in $(PYTHON_VERSIONS); do \
PYTHON="$$1" ; shift ; \ PYTHON="$$1" ; shift ; \
cd python$${VERSION}-gpg && \ cd python$${VERSION}-gpg && \
$$PYTHON ../setup.py install \ $$PYTHON setup.py install \
--prefix $(DESTDIR)$(prefix) \ --prefix $(DESTDIR)$(prefix) \
--record files.txt \ --record files.txt \
--verbose ; \ --verbose ; \

View File

@ -34,12 +34,12 @@ in_tree = False
extra_swig_opts = [] extra_swig_opts = []
extra_macros = dict() extra_macros = dict()
if os.path.exists("../../src/gpgme-config"): if os.path.exists("../../../src/gpgme-config"):
# In-tree build. # In-tree build.
in_tree = True in_tree = True
gpgme_config = ["../../src/gpgme-config"] + gpgme_config_flags gpgme_config = ["../../../src/gpgme-config"] + gpgme_config_flags
gpgme_h = "../../src/gpgme.h" gpgme_h = "../../../src/gpgme.h"
library_dirs = ["../../src/.libs"] # XXX uses libtool internals library_dirs = ["../../../src/.libs"] # XXX uses libtool internals
extra_macros.update( extra_macros.update(
HAVE_CONFIG_H=1, HAVE_CONFIG_H=1,
HAVE_DATA_H=1, HAVE_DATA_H=1,