[git] GPGME - branch, master, updated. gpgme-1.9.0-14-ge7d9c0c

by Justus Winter cvs at cvs.gnupg.org
Wed Apr 5 16:43:50 CEST 2017


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GnuPG Made Easy".

The branch, master has been updated
       via  e7d9c0c3d773f826dbd2ed417d04e25c410f3374 (commit)
       via  801d7d8c5dd530d26ad6c4bcc94d986e6e022da4 (commit)
       via  adfa09699c7ecad5dec5b79944a59291eaec75b4 (commit)
      from  50565982cdd502c3852fcc6f598932bd32b5cdc3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit e7d9c0c3d773f826dbd2ed417d04e25c410f3374
Author: Justus Winter <justus at g10code.com>
Date:   Mon Apr 3 15:44:14 2017 +0200

    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 <justus at g10code.com>

diff --git a/lang/python/MANIFEST.in b/lang/python/MANIFEST.in
index 8f63640..ff38172 100644
--- a/lang/python/MANIFEST.in
+++ b/lang/python/MANIFEST.in
@@ -1,4 +1,4 @@
 recursive-include examples *.py
-include gpgme-h-clean.py gpgme.i
+include gpgme.i
 include helpers.c helpers.h private.h
 recursive-include gpg *.py
diff --git a/lang/python/Makefile.am b/lang/python/Makefile.am
index b9145f5..42beeee 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
diff --git a/lang/python/gpgme-h-clean.py b/lang/python/gpgme-h-clean.py
deleted file mode 100755
index 52f8676..0000000
--- a/lang/python/gpgme-h-clean.py
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (C) 2016 g10 Code GmbH
-# Copyright (C) 2004,2008 Igor Belyi <belyi at users.sourceforge.net>
-#
-#    This library 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.
-#
-#    This library 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 library; if not, write to the Free Software
-#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
-
-from __future__ import absolute_import, print_function, unicode_literals
-del absolute_import, print_function, unicode_literals
-
-import sys, re
-
-if len(sys.argv) != 2:
-    sys.stderr.write("Usage: %s path/to/[gpgme|gpg-error].h\n" % sys.argv[0])
-    sys.exit(1)
-
-deprec_func = re.compile(r'^(.*typedef.*|.*\(.*\)|[^#]+\s+.+)'
-                         + r'\s*_GPGME_DEPRECATED(_OUTSIDE_GPGME)?\(.*\);\s*',
-                         re.S)
-line_break = re.compile(';|\\$|\\x0c|^\s*#|{');
-
-if 'gpgme.h' in sys.argv[1]:
-    gpgme = open(sys.argv[1])
-    tmp = gpgme.readline()
-    text = ''
-    while tmp:
-        text += re.sub(' class ', ' _py_obsolete_class ', tmp)
-        if line_break.search(tmp):
-            if not deprec_func.search(text):
-                sys.stdout.write(text)
-            text = ''
-        tmp = gpgme.readline()
-    sys.stdout.write(text)
-    gpgme.close()
-else:
-    filter_re = re.compile(r'GPG_ERR_[^ ]* =')
-    rewrite_re = re.compile(r' *(.*) = .*')
-    for line in open(sys.argv[1]):
-        if not filter_re.search(line):
-            continue
-        print(rewrite_re.sub(r'%constant long \1 = \1;', line.strip()))
diff --git a/lang/python/setup.py.in b/lang/python/setup.py.in
index 6692de6..2114aaf 100755
--- a/lang/python/setup.py.in
+++ b/lang/python/setup.py.in
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 
-# Copyright (C) 2016 g10 Code GmbH
-# Copyright (C) 2004 Igor Belyi <belyi at users.sourceforge.net>
+# Copyright (C) 2016-2017 g10 Code GmbH
+# Copyright (C) 2004,2008 Igor Belyi <belyi at users.sourceforge.net>
 # Copyright (C) 2002 John Goerzen <jgoerzen at complete.org>
 #
 #    This library is free software; you can redistribute it and/or
@@ -19,11 +19,18 @@
 #    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
 
 from distutils.core import setup, Extension
+import argparse
 import os, os.path, sys
 import glob
+import re
 import shutil
 import subprocess
 
+# We parse a subset of the arguments.
+parser = argparse.ArgumentParser(add_help=False)
+parser.add_argument('--build-base', default='')
+options, _ = parser.parse_known_args()
+
 # Out-of-tree build of the gpg bindings.
 gpg_error_config = ["gpg-error-config"]
 gpgme_config_flags = ["--thread=pthread"]
@@ -31,6 +38,7 @@ 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()
@@ -133,6 +141,14 @@ if uname_s.startswith("MINGW32"):
                library_dirs.append(os.path.join(tgt, item))
                break
 
+def in_srcdir(name):
+    return os.path.join(os.environ.get("srcdir", ""), name)
+def in_build_base(name):
+    return os.path.join(options.build_base, name)
+def up_to_date(source, target):
+    return (os.path.exists(target)
+            and os.path.getmtime(source) <= os.path.getmtime(target))
+
 # We build an Extension using SWIG, which generates a Python module.
 # By default, the 'build_py' step is run before 'build_ext', and
 # therefore the generated Python module is not copied into the build
@@ -143,25 +159,60 @@ if uname_s.startswith("MINGW32"):
 from distutils.command.build import build
 class BuildExtFirstHack(build):
 
+    def _generate_gpgme_h(self, source_name, sink_name):
+        if up_to_date(source_name, sink_name):
+            return
+
+        deprec_func = re.compile(r'^(.*typedef.*|.*\(.*\)|[^#]+\s+.+)'
+                                 + r'\s*_GPGME_DEPRECATED(_OUTSIDE_GPGME)?\(.*\);\s*',
+                                 re.S)
+        line_break = re.compile(';|\\$|\\x0c|^\s*#|{')
+
+        with open(sink_name, "w") as sink, open(source_name) as source:
+            text = ''
+            for line in source:
+                text += re.sub(' class ', ' _py_obsolete_class ', line)
+                if line_break.search(line):
+                    if not deprec_func.search(text):
+                        sink.write(text)
+                    text = ''
+            sink.write(text)
+
+    def _generate_errors_i(self, source_name, sink_name):
+        if up_to_date(source_name, sink_name):
+            return
+
+        filter_re = re.compile(r'GPG_ERR_[^ ]* =')
+        rewrite_re = re.compile(r' *(.*) = .*')
+
+        with open(sink_name, "w") as sink, open(source_name) as source:
+            for line in source:
+                if not filter_re.search(line):
+                    continue
+                sink.write(rewrite_re.sub(r'%constant long \1 = \1;'+'\n', line.strip()))
+
     def _generate(self):
         print("Building python gpg module using {} and {}.".format(gpgme_h, gpg_error_h))
 
         # Cleanup gpgme.h from deprecated functions and typedefs.
-        # Keep timestamp to avoid rebuild
         if not os.path.exists(self.build_base):
             os.makedirs(self.build_base)
 
-        for src, dst in (
-            (gpgme_h, os.path.join(self.build_base, "gpgme.h")),
-            (gpg_error_h, os.path.join(self.build_base, "errors.i"))
-        ):
-            subprocess.check_call([sys.executable, "gpgme-h-clean.py", src],
-                                  stdout=open(dst, "w"))
-            shutil.copystat(src, dst)
+        self._generate_gpgme_h(gpgme_h, in_build_base("gpgme.h"))
+        self._generate_errors_i(gpg_error_h, in_build_base("errors.i"))
+
+        # Keep timestamp to avoid rebuild
+        for source, target in ((gpgme_h, in_build_base("gpgme.h")),
+                               (gpg_error_h, in_build_base("errors.i"))):
+            if not up_to_date(source, target):
+                shutil.copystat(source, target)
 
         # Copy due to http://bugs.python.org/issue2624
         # Avoid creating in srcdir
-        shutil.copy2("gpgme.i", self.build_base)
+        for source, target in ((in_srcdir(n), in_build_base(n))
+                               for n in ('gpgme.i', 'helpers.c')):
+            if not up_to_date(source, target):
+                shutil.copy2(source, target)
 
     def run(self):
         self._generate()
@@ -171,14 +222,18 @@ class BuildExtFirstHack(build):
             os.makedirs(os.path.join(self.build_lib, "gpg"))
 
         swig_sources.append(os.path.join(self.build_base, 'gpgme.i'))
-        swig_opts.extend(['-I' + self.build_base, '-outdir', os.path.join(self.build_lib, 'gpg')])
+        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')
         build.run(self)
 
 py3 = [] if sys.version_info.major < 3 else ['-py3']
-swig_sources = ['helpers.c']
+swig_sources = [in_build_base('helpers.c')]
 swig_opts = ['-threads'] + py3 + extra_swig_opts
 swige = Extension("gpg._gpgme",
                   sources = swig_sources,

commit 801d7d8c5dd530d26ad6c4bcc94d986e6e022da4
Author: Alon Bar-Lev <alon.barlev at gmail.com>
Date:   Sun Apr 2 02:29:52 2017 +0300

    python: Generate files into build directory
    
    * lang/python/setup.py.in: Generate files within BuildExtFirstHack
    adjust build flags at this point instead of global.
    * lang/python/Makefile.am: Remove logic of separate source directory per
    python version in favor of build directory.
    * lang/python/tests/run-tests.py: Adjust build directory location.
    --
    
    Generate files into build directory, leaving the source directory clean.
    Use the same source directory for multiple python version build. Result
    of 'prepare' target is a standard distutil layout that can be used
    easily by downstream to build all python targets in-place.
    
    Signed-off-by: Alon Bar-Lev <alon.barlev at gmail.com>

diff --git a/lang/python/Makefile.am b/lang/python/Makefile.am
index a18a014..b9145f5 100644
--- a/lang/python/Makefile.am
+++ b/lang/python/Makefile.am
@@ -27,70 +27,45 @@ EXTRA_DIST = \
 
 SUBDIRS = . tests
 
-COPY_FILES = \
-	$(srcdir)/gpgme.i \
-	$(srcdir)/README \
-	$(srcdir)/MANIFEST.in \
-	$(srcdir)/gpgme-h-clean.py \
-	$(srcdir)/examples \
-	$(srcdir)/helpers.c $(srcdir)/helpers.h $(srcdir)/private.h
-
-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:
-	test -n "$(PREPAREDIR)"
-	$(MKDIR_P)              "$(PREPAREDIR)/gpg"
-	cp -R $(COPY_FILES)     "$(PREPAREDIR)"
-	cp setup.py             "$(PREPAREDIR)"
-	cp gpg/version.py       "$(PREPAREDIR)/gpg"
-	ln -sf "$(abs_top_srcdir)/src/data.h" "$(PREPAREDIR)"
-	ln -sf "$(abs_top_builddir)/config.h" "$(PREPAREDIR)"
-	cp -R $(COPY_FILES_GPG) "$(PREPAREDIR)/gpg"
+prepare: copystamp
 
 # For VPATH builds we need to copy some files because Python's
 # distutils are not VPATH-aware.
-copystamp: $(COPY_FILES) $(COPY_FILES_GPG)
-	set -e ; for VERSION in $(PYTHON_VERSIONS); do \
-	  $(MAKE) PREPAREDIR=python$${VERSION}-gpg prepare; \
-	done
+copystamp:
+	ln -sf "$(abs_top_srcdir)/src/data.h" .
+	ln -sf "$(abs_top_builddir)/config.h" .
 	touch $@
 
 all-local: copystamp
 	set -e ; set $(PYTHONS); for VERSION in $(PYTHON_VERSIONS); do \
 	  PYTHON="$$1" ; shift ; \
-	  cd python$${VERSION}-gpg && \
 	  CFLAGS="$(CFLAGS)" \
 	  abs_top_builddir="$(abs_top_builddir)" \
-	    $$PYTHON setup.py build --verbose ; \
-	  cd .. ; \
+	    $$PYTHON setup.py build --verbose --build-base=python$${VERSION}-gpg ; \
 	done
 
-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 && \
+	$(MKDIR_P) python$(PYTHON_VERSION)-gpg-dist
 	CFLAGS="$(CFLAGS)" \
 	abs_top_builddir="$(abs_top_builddir)" \
-	  $(PYTHON) setup.py sdist --verbose
-	gpg2 --detach-sign --armor python$(PYTHON_VERSION)-gpg/dist/gpg-$(VERSION).tar.gz
+	  $(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 \
-       python$(PYTHON_VERSION)-gpg/dist/gpg-$(VERSION).tar.gz.asc
+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
+upload: python$(PYTHON_VERSION)-gpg-dist/gpg-$(VERSION).tar.gz \
+        python$(PYTHON_VERSION)-gpg-dist/gpg-$(VERSION).tar.gz.asc
 	twine upload $^
 
-CLEANFILES = copystamp
+CLEANFILES = copystamp \
+	config.h \
+	data.h \
+	files.txt \
+	install_files.txt
 
 # Remove the rest.
 #
@@ -104,22 +79,22 @@ clean-local:
 	done
 
 install-exec-local:
-	rm -f install_files.txt
 	set -e ; set $(PYTHONS); for VERSION in $(PYTHON_VERSIONS); do \
 	  PYTHON="$$1" ; shift ; \
-	  cd python$${VERSION}-gpg ; \
 	  abs_top_builddir="$(abs_top_builddir)" \
-	  $$PYTHON setup.py install \
-	  --prefix $(DESTDIR)$(prefix) \
+	  $$PYTHON setup.py \
+	  build \
+	  --build-base=python$${VERSION}-gpg \
+	  install \
+	  --prefix "$(DESTDIR)$(prefix)" \
 	  --record files.txt \
 	  --verbose ; \
-	  cat files.txt >> ../install_files.txt ; \
+	  cat files.txt >> install_files.txt ; \
 	  rm files.txt ; \
-	  cd .. ; \
 	done
-	$(MKDIR_P) $(DESTDIR)$(pythondir)/gpg
-	mv install_files.txt $(DESTDIR)$(pythondir)/gpg
+	$(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
+	xargs < "$(DESTDIR)$(pythondir)/gpg/install_files.txt" -- rm -rf --
+	rm -rf -- "$(DESTDIR)$(pythondir)/gpg"
diff --git a/lang/python/setup.py.in b/lang/python/setup.py.in
index 8ddbf27..6692de6 100755
--- a/lang/python/setup.py.in
+++ b/lang/python/setup.py.in
@@ -21,6 +21,7 @@
 from distutils.core import setup, Extension
 import os, os.path, sys
 import glob
+import shutil
 import subprocess
 
 # Out-of-tree build of the gpg bindings.
@@ -89,14 +90,6 @@ if not os.path.exists(gpg_error_h):
         glob.glob(os.path.join(gpg_error_prefix, "include",
                                "*", "gpg-error.h"))[0]
 
-print("Building python gpg module using {} and {}.".format(gpgme_h, gpg_error_h))
-
-# Cleanup gpgme.h from deprecated functions and typedefs.
-subprocess.check_call([sys.executable, "gpgme-h-clean.py", gpgme_h],
-                      stdout=open("gpgme.h", "w"))
-subprocess.check_call([sys.executable, "gpgme-h-clean.py", gpg_error_h],
-                      stdout=open("errors.i", "w"))
-
 define_macros = []
 libs = getconfig('libs')
 
@@ -149,14 +142,47 @@ if uname_s.startswith("MINGW32"):
 # http://stackoverflow.com/questions/12491328/python-distutils-not-include-the-swig-generated-module
 from distutils.command.build import build
 class BuildExtFirstHack(build):
+
+    def _generate(self):
+        print("Building python gpg module using {} and {}.".format(gpgme_h, gpg_error_h))
+
+        # Cleanup gpgme.h from deprecated functions and typedefs.
+        # Keep timestamp to avoid rebuild
+        if not os.path.exists(self.build_base):
+            os.makedirs(self.build_base)
+
+        for src, dst in (
+            (gpgme_h, os.path.join(self.build_base, "gpgme.h")),
+            (gpg_error_h, os.path.join(self.build_base, "errors.i"))
+        ):
+            subprocess.check_call([sys.executable, "gpgme-h-clean.py", src],
+                                  stdout=open(dst, "w"))
+            shutil.copystat(src, dst)
+
+        # Copy due to http://bugs.python.org/issue2624
+        # Avoid creating in srcdir
+        shutil.copy2("gpgme.i", self.build_base)
+
     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"))
+
+        swig_sources.append(os.path.join(self.build_base, 'gpgme.i'))
+        swig_opts.extend(['-I' + self.build_base, '-outdir', os.path.join(self.build_lib, 'gpg')])
+        include_dirs.append(self.build_base)
+
         self.run_command('build_ext')
         build.run(self)
 
 py3 = [] if sys.version_info.major < 3 else ['-py3']
-swige = Extension("gpg._gpgme", ["gpgme.i", "helpers.c"],
-                  swig_opts = ['-threads',
-                               '-outdir', 'gpg'] + py3 + extra_swig_opts,
+swig_sources = ['helpers.c']
+swig_opts = ['-threads'] + py3 + extra_swig_opts
+swige = Extension("gpg._gpgme",
+                  sources = swig_sources,
+                  swig_opts = swig_opts,
                   include_dirs = include_dirs,
                   define_macros = define_macros,
                   library_dirs = library_dirs,
diff --git a/lang/python/tests/run-tests.py b/lang/python/tests/run-tests.py
index 9e061d8..9e2fb78 100644
--- a/lang/python/tests/run-tests.py
+++ b/lang/python/tests/run-tests.py
@@ -71,7 +71,6 @@ for interpreter in args.interpreters:
 
     pattern = os.path.join(args.builddir, "..",
                            "python{0}-gpg".format(version),
-                           "build",
                            "lib*"+version)
     builddirs = glob.glob(pattern)
     if len(builddirs) == 0:

commit adfa09699c7ecad5dec5b79944a59291eaec75b4
Author: Justus Winter <justus at g10code.com>
Date:   Wed Apr 5 14:48:04 2017 +0200

    Fix typo.
    
    --
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/NEWS b/NEWS
index a5cc1da..0520768 100644
--- a/NEWS
+++ b/NEWS
@@ -49,7 +49,7 @@ Noteworthy changes in version 1.9.0 (2017-03-28)
  GPGME_ENCRYPT_WRAP               NEW.
  GPGME_DECRYPT_VERIFY             NEW.
  GPGME_DECRYPT_UNWRAP             NEW.
-o gpgme_data_rewind                UN-DEPRECATE.
+ gpgme_data_rewind                UN-DEPRECATE.
  cpp: Context::revUid(const Key&, const char*)      NEW.
  cpp: Context::startRevUid(const Key&, const char*) NEW.
  cpp: Context::addUid(const Key&, const char*)      NEW.

-----------------------------------------------------------------------

Summary of changes:
 NEWS                           |   2 +-
 lang/python/MANIFEST.in        |   2 +-
 lang/python/Makefile.am        |  82 ++++++++++++++-----------------
 lang/python/gpgme-h-clean.py   |  53 --------------------
 lang/python/setup.py.in        | 107 ++++++++++++++++++++++++++++++++++++-----
 lang/python/tests/run-tests.py |   1 -
 6 files changed, 132 insertions(+), 115 deletions(-)
 delete mode 100755 lang/python/gpgme-h-clean.py


hooks/post-receive
-- 
GnuPG Made Easy
http://git.gnupg.org




More information about the Gnupg-commits mailing list