[Pkg-gnupg-commit] [gpgme] 21/103: python: Support alternatate libdir for tests

Daniel Kahn Gillmor dkg at fifthhorseman.net
Thu Dec 14 18:53:00 UTC 2017


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

dkg pushed a commit to branch master
in repository gpgme.

commit 3cc90b67fa970e716c8672ec5c5f591fa11ab216
Author: Alon Bar-Lev <alon.barlev at gmail.com>
Date:   Sat Apr 8 16:34:33 2017 +0300

    python: Support alternatate libdir for tests
    
    * lang/python/tests/run-tests.py: Add --python-libdir optional
    parameter.
    
    --
    
    This will make the python tests usable for downstream that build python
    module outside of autotools build system.
    
    Signed-off-by: Alon Bar-Lev <alon.barlev at gmail.com>
---
 lang/python/tests/run-tests.py | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/lang/python/tests/run-tests.py b/lang/python/tests/run-tests.py
index f236712..78a0ec2 100644
--- a/lang/python/tests/run-tests.py
+++ b/lang/python/tests/run-tests.py
@@ -51,6 +51,9 @@ parser.add_argument('--srcdir', type=str,
 parser.add_argument('--builddir', type=str,
                     default=os.environ.get("abs_builddir", ""),
                     help='Location of the tests.')
+parser.add_argument('--python-libdir', type=str,
+                    default=None,
+                    help='Optional location of the in-tree module lib directory.')
 parser.add_argument('--parallel', action="store_true", default=False,
                     help='Ignored.  For compatibility with run-tests.scm.')
 
@@ -69,18 +72,20 @@ 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()
 
-    pattern = os.path.join(args.builddir, "..",
-                           "{0}-gpg".format(os.path.basename(interpreter)),
-                           "lib*")
-    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))
+    if not args.python_libdir:
+        pattern = os.path.join(args.builddir, "..",
+                               "{0}-gpg".format(os.path.basename(interpreter)),
+                               "lib*")
+        libdirs = glob.glob(pattern)
+        if len(libdirs) == 0:
+            sys.exit("Build directory matching {0!r} not found.".format(pattern))
+        elif len(libdirs) > 1:
+            sys.exit("Multiple build directories matching {0!r} found: {1}".format(
+                pattern, libdirs))
+        python_libdir = libdirs[0]
 
     env = dict(os.environ)
-    env["PYTHONPATH"] = builddirs[0]
+    env["PYTHONPATH"] = python_libdir
 
     if not args.quiet:
         print("Running tests using {0} ({1})...".format(interpreter, version))

-- 
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