diff options
author | Alon Bar-Lev <[email protected]> | 2017-04-05 16:47:08 +0000 |
---|---|---|
committer | Justus Winter <[email protected]> | 2017-04-07 10:12:20 +0000 |
commit | 49195c487e6c923f7137f092b982e7d833d98de6 (patch) | |
tree | 5be39ddc018fcba7771e0c77ca0ae607e7435d66 | |
parent | python: Fix vpath builds, fix distcheck. (diff) | |
download | gpgme-49195c487e6c923f7137f092b982e7d833d98de6.tar.gz gpgme-49195c487e6c923f7137f092b982e7d833d98de6.zip |
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 <[email protected]>
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | lang/python/MANIFEST.in | 1 | ||||
-rw-r--r-- | lang/python/Makefile.am | 38 | ||||
-rwxr-xr-x | lang/python/setup.py.in | 23 | ||||
-rw-r--r-- | lang/python/src/__init__.py (renamed from lang/python/gpg/__init__.py) | 0 | ||||
-rw-r--r-- | lang/python/src/callbacks.py (renamed from lang/python/gpg/callbacks.py) | 0 | ||||
-rw-r--r-- | lang/python/src/constants/__init__.py (renamed from lang/python/gpg/constants/__init__.py) | 0 | ||||
-rw-r--r-- | lang/python/src/constants/create.py (renamed from lang/python/gpg/constants/create.py) | 0 | ||||
-rw-r--r-- | lang/python/src/constants/data/__init__.py (renamed from lang/python/gpg/constants/data/__init__.py) | 0 | ||||
-rw-r--r-- | lang/python/src/constants/data/encoding.py (renamed from lang/python/gpg/constants/data/encoding.py) | 0 | ||||
-rw-r--r-- | lang/python/src/constants/event.py (renamed from lang/python/gpg/constants/event.py) | 0 | ||||
-rw-r--r-- | lang/python/src/constants/import.py (renamed from lang/python/gpg/constants/import.py) | 0 | ||||
-rw-r--r-- | lang/python/src/constants/keylist/__init__.py (renamed from lang/python/gpg/constants/keylist/__init__.py) | 0 | ||||
-rw-r--r-- | lang/python/src/constants/keylist/mode.py (renamed from lang/python/gpg/constants/keylist/mode.py) | 0 | ||||
-rw-r--r-- | lang/python/src/constants/keysign.py (renamed from lang/python/gpg/constants/keysign.py) | 0 | ||||
-rw-r--r-- | lang/python/src/constants/md.py (renamed from lang/python/gpg/constants/md.py) | 0 | ||||
-rw-r--r-- | lang/python/src/constants/pk.py (renamed from lang/python/gpg/constants/pk.py) | 0 | ||||
-rw-r--r-- | lang/python/src/constants/protocol.py (renamed from lang/python/gpg/constants/protocol.py) | 0 | ||||
-rw-r--r-- | lang/python/src/constants/sig/__init__.py (renamed from lang/python/gpg/constants/sig/__init__.py) | 0 | ||||
-rw-r--r-- | lang/python/src/constants/sig/mode.py (renamed from lang/python/gpg/constants/sig/mode.py) | 0 | ||||
-rw-r--r-- | lang/python/src/constants/sig/notation.py (renamed from lang/python/gpg/constants/sig/notation.py) | 0 | ||||
-rw-r--r-- | lang/python/src/constants/sigsum.py (renamed from lang/python/gpg/constants/sigsum.py) | 0 | ||||
-rw-r--r-- | lang/python/src/constants/status.py (renamed from lang/python/gpg/constants/status.py) | 0 | ||||
-rw-r--r-- | lang/python/src/constants/tofu/__init__.py (renamed from lang/python/gpg/constants/tofu/__init__.py) | 0 | ||||
-rw-r--r-- | lang/python/src/constants/tofu/policy.py (renamed from lang/python/gpg/constants/tofu/policy.py) | 0 | ||||
-rw-r--r-- | lang/python/src/constants/validity.py (renamed from lang/python/gpg/constants/validity.py) | 0 | ||||
-rw-r--r-- | lang/python/src/core.py (renamed from lang/python/gpg/core.py) | 0 | ||||
-rw-r--r-- | lang/python/src/errors.py (renamed from lang/python/gpg/errors.py) | 0 | ||||
-rw-r--r-- | lang/python/src/results.py (renamed from lang/python/gpg/results.py) | 0 | ||||
-rw-r--r-- | lang/python/src/util.py (renamed from lang/python/gpg/util.py) | 0 | ||||
-rw-r--r-- | lang/python/version.py.in (renamed from lang/python/gpg/version.py.in) | 0 |
31 files changed, 24 insertions, 40 deletions
diff --git a/configure.ac b/configure.ac index 7ab94e79..9974abb4 100644 --- a/configure.ac +++ b/configure.ac @@ -881,7 +881,7 @@ AC_CONFIG_FILES([lang/Makefile lang/cl/Makefile lang/cl/gpgme.asd]) AM_COND_IF([HAVE_DOXYGEN], [AC_CONFIG_FILES([lang/qt/doc/Doxyfile])]) AC_CONFIG_FILES(lang/qt/doc/Makefile) AC_CONFIG_FILES([lang/python/Makefile - lang/python/gpg/version.py + lang/python/version.py lang/python/tests/Makefile]) AC_CONFIG_FILES([lang/python/setup.py], [chmod a+x lang/python/setup.py]) AC_OUTPUT diff --git a/lang/python/MANIFEST.in b/lang/python/MANIFEST.in index ff38172d..c34e84a2 100644 --- a/lang/python/MANIFEST.in +++ b/lang/python/MANIFEST.in @@ -1,4 +1,5 @@ recursive-include examples *.py include gpgme.i include helpers.c helpers.h private.h +include version.py recursive-include gpg *.py diff --git a/lang/python/Makefile.am b/lang/python/Makefile.am index 42beeee2..4ebd214e 100644 --- a/lang/python/Makefile.am +++ b/lang/python/Makefile.am @@ -22,28 +22,19 @@ EXTRA_DIST = \ gpgme.i \ helpers.c helpers.h private.h \ examples \ - gpg + src 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 + ln -sf "$(top_srcdir)/src/data.h" . + ln -sf "$(top_builddir)/config.h" . + ln -sf "$(srcdir)/src" gpg touch $@ all-local: copystamp @@ -51,7 +42,7 @@ all-local: copystamp PYTHON="$$1" ; shift ; \ CFLAGS="$(CFLAGS)" \ srcdir="$(srcdir)" \ - abs_top_builddir="$(abs_top_builddir)" \ + top_builddir="$(top_builddir)" \ $$PYTHON setup.py build --verbose --build-base=python$${VERSION}-gpg ; \ done @@ -59,7 +50,7 @@ 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)" \ + 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 @@ -75,6 +66,7 @@ upload: python$(PYTHON_VERSION)-gpg-dist/gpg-$(VERSION).tar.gz \ CLEANFILES = copystamp \ config.h \ data.h \ + gpg \ files.txt \ install_files.txt @@ -84,22 +76,16 @@ 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 ; \ + 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)" \ + top_builddir="$(top_builddir)" \ $$PYTHON setup.py \ build \ --build-base=python$${VERSION}-gpg \ @@ -110,6 +96,6 @@ install-exec-local: 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" ; \ + rm -rf -- "$(DESTDIR)$(prefix)"/lib*/python$$PV/site-packages/gpg \ +"$(DESTDIR)$(prefix)"/lib*/python$$PV/site-packages/gpg-$$GV-py$$PV.egg-info ; \ done diff --git a/lang/python/setup.py.in b/lang/python/setup.py.in index 2114aafe..5d94c704 100755 --- a/lang/python/setup.py.in +++ b/lang/python/setup.py.in @@ -38,18 +38,17 @@ gpgme_config = ["gpgme-config"] + gpgme_config_flags gpgme_h = "" include_dirs = [os.getcwd()] library_dirs = [] -vpath_build = os.environ.get('srcdir', '.') != '.' in_tree = False extra_swig_opts = [] extra_macros = dict() -abs_top_builddir = os.environ.get("abs_top_builddir") -if abs_top_builddir: +top_builddir = os.environ.get("top_builddir") +if top_builddir: # In-tree build. in_tree = True - gpgme_config = [os.path.join(abs_top_builddir, "src/gpgme-config")] + gpgme_config_flags - gpgme_h = os.path.join(abs_top_builddir, "src/gpgme.h") - library_dirs = [os.path.join(abs_top_builddir, "src/.libs")] # XXX uses libtool internals + gpgme_config = [os.path.join(top_builddir, "src/gpgme-config")] + gpgme_config_flags + gpgme_h = os.path.join(top_builddir, "src/gpgme.h") + library_dirs = [os.path.join(top_builddir, "src/.libs")] # XXX uses libtool internals extra_macros.update( HAVE_CONFIG_H=1, HAVE_DATA_H=1, @@ -210,23 +209,21 @@ class BuildExtFirstHack(build): # Copy due to http://bugs.python.org/issue2624 # Avoid creating in srcdir for source, target in ((in_srcdir(n), in_build_base(n)) - for n in ('gpgme.i', 'helpers.c')): + for n in ('gpgme.i', 'helpers.c', 'private.h', 'helpers.h')): if not up_to_date(source, target): shutil.copy2(source, target) - def run(self): - self._generate() - # Append generated files via build_base if not os.path.exists(os.path.join(self.build_lib, "gpg")): os.makedirs(os.path.join(self.build_lib, "gpg")) + shutil.copy2("version.py", os.path.join(self.build_lib, "gpg")) + + def run(self): + self._generate() swig_sources.append(os.path.join(self.build_base, 'gpgme.i')) swig_opts.extend(['-I' + self.build_base, - '-I' + in_srcdir('.'), '-outdir', os.path.join(self.build_lib, 'gpg')]) - if vpath_build: - include_dirs.append(in_srcdir('.')) include_dirs.append(self.build_base) self.run_command('build_ext') diff --git a/lang/python/gpg/__init__.py b/lang/python/src/__init__.py index 385b17e3..385b17e3 100644 --- a/lang/python/gpg/__init__.py +++ b/lang/python/src/__init__.py diff --git a/lang/python/gpg/callbacks.py b/lang/python/src/callbacks.py index b25a9a74..b25a9a74 100644 --- a/lang/python/gpg/callbacks.py +++ b/lang/python/src/callbacks.py diff --git a/lang/python/gpg/constants/__init__.py b/lang/python/src/constants/__init__.py index 484ffd29..484ffd29 100644 --- a/lang/python/gpg/constants/__init__.py +++ b/lang/python/src/constants/__init__.py diff --git a/lang/python/gpg/constants/create.py b/lang/python/src/constants/create.py index 132e96d4..132e96d4 100644 --- a/lang/python/gpg/constants/create.py +++ b/lang/python/src/constants/create.py diff --git a/lang/python/gpg/constants/data/__init__.py b/lang/python/src/constants/data/__init__.py index 8274ab91..8274ab91 100644 --- a/lang/python/gpg/constants/data/__init__.py +++ b/lang/python/src/constants/data/__init__.py diff --git a/lang/python/gpg/constants/data/encoding.py b/lang/python/src/constants/data/encoding.py index e76a22ee..e76a22ee 100644 --- a/lang/python/gpg/constants/data/encoding.py +++ b/lang/python/src/constants/data/encoding.py diff --git a/lang/python/gpg/constants/event.py b/lang/python/src/constants/event.py index 1b14d1d1..1b14d1d1 100644 --- a/lang/python/gpg/constants/event.py +++ b/lang/python/src/constants/event.py diff --git a/lang/python/gpg/constants/import.py b/lang/python/src/constants/import.py index 47c296cb..47c296cb 100644 --- a/lang/python/gpg/constants/import.py +++ b/lang/python/src/constants/import.py diff --git a/lang/python/gpg/constants/keylist/__init__.py b/lang/python/src/constants/keylist/__init__.py index 2ce0edfd..2ce0edfd 100644 --- a/lang/python/gpg/constants/keylist/__init__.py +++ b/lang/python/src/constants/keylist/__init__.py diff --git a/lang/python/gpg/constants/keylist/mode.py b/lang/python/src/constants/keylist/mode.py index 39e1819d..39e1819d 100644 --- a/lang/python/gpg/constants/keylist/mode.py +++ b/lang/python/src/constants/keylist/mode.py diff --git a/lang/python/gpg/constants/keysign.py b/lang/python/src/constants/keysign.py index fccdbc42..fccdbc42 100644 --- a/lang/python/gpg/constants/keysign.py +++ b/lang/python/src/constants/keysign.py diff --git a/lang/python/gpg/constants/md.py b/lang/python/src/constants/md.py index f3e8bbdb..f3e8bbdb 100644 --- a/lang/python/gpg/constants/md.py +++ b/lang/python/src/constants/md.py diff --git a/lang/python/gpg/constants/pk.py b/lang/python/src/constants/pk.py index 6bf2a215..6bf2a215 100644 --- a/lang/python/gpg/constants/pk.py +++ b/lang/python/src/constants/pk.py diff --git a/lang/python/gpg/constants/protocol.py b/lang/python/src/constants/protocol.py index d086bbde..d086bbde 100644 --- a/lang/python/gpg/constants/protocol.py +++ b/lang/python/src/constants/protocol.py diff --git a/lang/python/gpg/constants/sig/__init__.py b/lang/python/src/constants/sig/__init__.py index 39d4e6e1..39d4e6e1 100644 --- a/lang/python/gpg/constants/sig/__init__.py +++ b/lang/python/src/constants/sig/__init__.py diff --git a/lang/python/gpg/constants/sig/mode.py b/lang/python/src/constants/sig/mode.py index 0f4f0efc..0f4f0efc 100644 --- a/lang/python/gpg/constants/sig/mode.py +++ b/lang/python/src/constants/sig/mode.py diff --git a/lang/python/gpg/constants/sig/notation.py b/lang/python/src/constants/sig/notation.py index 9a79e014..9a79e014 100644 --- a/lang/python/gpg/constants/sig/notation.py +++ b/lang/python/src/constants/sig/notation.py diff --git a/lang/python/gpg/constants/sigsum.py b/lang/python/src/constants/sigsum.py index 09ef9d78..09ef9d78 100644 --- a/lang/python/gpg/constants/sigsum.py +++ b/lang/python/src/constants/sigsum.py diff --git a/lang/python/gpg/constants/status.py b/lang/python/src/constants/status.py index a0ad073e..a0ad073e 100644 --- a/lang/python/gpg/constants/status.py +++ b/lang/python/src/constants/status.py diff --git a/lang/python/gpg/constants/tofu/__init__.py b/lang/python/src/constants/tofu/__init__.py index 819a58bb..819a58bb 100644 --- a/lang/python/gpg/constants/tofu/__init__.py +++ b/lang/python/src/constants/tofu/__init__.py diff --git a/lang/python/gpg/constants/tofu/policy.py b/lang/python/src/constants/tofu/policy.py index 5a61f067..5a61f067 100644 --- a/lang/python/gpg/constants/tofu/policy.py +++ b/lang/python/src/constants/tofu/policy.py diff --git a/lang/python/gpg/constants/validity.py b/lang/python/src/constants/validity.py index d3c53458..d3c53458 100644 --- a/lang/python/gpg/constants/validity.py +++ b/lang/python/src/constants/validity.py diff --git a/lang/python/gpg/core.py b/lang/python/src/core.py index 632f4ca5..632f4ca5 100644 --- a/lang/python/gpg/core.py +++ b/lang/python/src/core.py diff --git a/lang/python/gpg/errors.py b/lang/python/src/errors.py index 1ce139e8..1ce139e8 100644 --- a/lang/python/gpg/errors.py +++ b/lang/python/src/errors.py diff --git a/lang/python/gpg/results.py b/lang/python/src/results.py index 46ebeec6..46ebeec6 100644 --- a/lang/python/gpg/results.py +++ b/lang/python/src/results.py diff --git a/lang/python/gpg/util.py b/lang/python/src/util.py index e4fca4c1..e4fca4c1 100644 --- a/lang/python/gpg/util.py +++ b/lang/python/src/util.py diff --git a/lang/python/gpg/version.py.in b/lang/python/version.py.in index 1a1baf08..1a1baf08 100644 --- a/lang/python/gpg/version.py.in +++ b/lang/python/version.py.in |