[Pkg-gnupg-commit] [gpgme] 101/132: python: Make error message more helpful.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Wed Apr 26 01:01:34 UTC 2017


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch experimental
in repository gpgme.

commit 9d6825be092f1590f28b5bab462eeb944d9b800c
Author: Justus Winter <justus at g10code.com>
Date:   Tue Mar 14 11:10:21 2017 +0100

    python: Make error message more helpful.
    
    * lang/python/tests/run-tests.py: Make the error message shown when we
    cannot locate the python module in the build tree more helpful.
    
    Signed-off-by: Justus Winter <justus at g10code.com>
---
 lang/python/tests/run-tests.py | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/lang/python/tests/run-tests.py b/lang/python/tests/run-tests.py
index e76acb2..c4af526 100644
--- a/lang/python/tests/run-tests.py
+++ b/lang/python/tests/run-tests.py
@@ -69,12 +69,17 @@ for interpreter in args.interpreters:
     version = subprocess.check_output(
         [interpreter, "-c", "import sys; print('{0}.{1}'.format(sys.version_info[0], sys.version_info[1]))"]).strip().decode()
 
-    builddirs = glob.glob(os.path.join(args.builddir, "..",
-                                       "python{0}-gpg".format(version),
-                                       "build",
-                                       "lib*"+version))
-    assert len(builddirs) == 1, \
-        "Expected one build directory, got {0}".format(builddirs)
+    pattern = os.path.join(args.builddir, "..",
+                           "python{0}-gpg".format(version),
+                           "build",
+                           "lib*"+version)
+    builddirs = glob.glob(pattern)
+    if len(builddirs) == 0:
+        sys.exit("Build directory matching {0!r} not found.".format(pattern))
+    elif len(builddirs) > 1:
+        sys.exit("Multiple build directories matching {0!r} found: {1}".format(
+            pattern, builddirs))
+
     env = dict(os.environ)
     env["PYTHONPATH"] = builddirs[0]
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gpgme.git



More information about the Pkg-gnupg-commit mailing list