e7d9c0c3d7
* 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: 801d7d8c5d
Signed-off-by: Justus Winter <justus@g10code.com>
116 lines
3.4 KiB
Makefile
116 lines
3.4 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 \
|
|
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
|
|
|
|
# For VPATH builds we need to copy some files because Python's
|
|
# distutils are not VPATH-aware.
|
|
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
|
|
|
|
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
|
|
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 \
|
|
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
|
|
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 ; \
|
|
done
|
|
|
|
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)" \
|
|
--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
|