gpgme/lang/python/Makefile.am
Alon Bar-Lev 49195c487e
python: simplify build, some fixups
* lang/python/gpg/version.py.in: Rename to lang/python/version.py.in.
configure.ac: Generate version.py.in in lang/python.
* lang/python/MANIFEST.in: Include version.py explicitly.
* lang/python/gpg: Rename to 'src'.
* lang/python/Makefile.am: Do not copy source files, do not use absolute
directories, support lib64 in uninstall, clean also dist directory, use
symlink for gpg src.
* lang/python/setup.py.in: Use builddir, copy sources into builddir,
copy version.py into module.
--

Simplify build to symlink the gpg sources into builddir instead of
copying. This requires handling of version.py as generated file.

In addition apply some cleanups: Drop the absolution pathes, clean the
dist directory as well, support lib64 for sitelib at uninstall.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
2017-04-07 12:12:20 +02:00

102 lines
3.0 KiB
Makefile

# Makefile.am for the Python bindings.
# Copyright (C) 2016 g10 Code GmbH
#
# This file is part of GPGME.
#
# GPGME is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 2.1 of the
# License, or (at your option) any later version.
#
# GPGME is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
# Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, see <http://www.gnu.org/licenses/>.
EXTRA_DIST = \
README \
MANIFEST.in \
gpgme.i \
helpers.c helpers.h private.h \
examples \
src
SUBDIRS = . tests
.PHONY: prepare
prepare: copystamp
# For VPATH builds we need to copy some files because Python's
# distutils are not VPATH-aware.
copystamp:
ln -sf "$(top_srcdir)/src/data.h" .
ln -sf "$(top_builddir)/config.h" .
ln -sf "$(srcdir)/src" gpg
touch $@
all-local: copystamp
set -e ; set $(PYTHONS); for VERSION in $(PYTHON_VERSIONS); do \
PYTHON="$$1" ; shift ; \
CFLAGS="$(CFLAGS)" \
srcdir="$(srcdir)" \
top_builddir="$(top_builddir)" \
$$PYTHON setup.py build --verbose --build-base=python$${VERSION}-gpg ; \
done
python$(PYTHON_VERSION)-gpg/dist/gpg-$(VERSION).tar.gz.asc: copystamp
$(MKDIR_P) python$(PYTHON_VERSION)-gpg-dist
CFLAGS="$(CFLAGS)" \
srcdir="$(srcdir)" \
top_builddir="$(top_builddir)" \
$(PYTHON) setup.py sdist --verbose --dist-dir=python$(PYTHON_VERSION)-gpg-dist \
--manifest=python$(PYTHON_VERSION)-gpg-dist/MANIFEST
gpg2 --detach-sign --armor python$(PYTHON_VERSION)-gpg-dist/gpg-$(VERSION).tar.gz
.PHONY: sdist
sdist: python$(PYTHON_VERSION)-gpg/dist/gpg-$(VERSION).tar.gz.asc
.PHONY: upload
upload: python$(PYTHON_VERSION)-gpg-dist/gpg-$(VERSION).tar.gz \
python$(PYTHON_VERSION)-gpg-dist/gpg-$(VERSION).tar.gz.asc
twine upload $^
CLEANFILES = copystamp \
config.h \
data.h \
gpg \
files.txt \
install_files.txt
# Remove the rest.
#
# 'make distclean' clears the write bit, breaking rm -rf. Fix the
# permissions.
clean-local:
rm -rf -- build
for VERSION in $(PYTHON_VERSIONS); do \
find python$${VERSION}-gpg* -type d ! -perm -200 -exec chmod u+w {} ';' ; \
rm -rf -- python$${VERSION}-gpg* ; \
done
install-exec-local:
set -e ; set $(PYTHONS); for VERSION in $(PYTHON_VERSIONS); do \
PYTHON="$$1" ; shift ; \
srcdir="$(srcdir)" \
top_builddir="$(top_builddir)" \
$$PYTHON setup.py \
build \
--build-base=python$${VERSION}-gpg \
install \
--prefix "$(DESTDIR)$(prefix)" \
--verbose ; \
done
uninstall-local:
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