python: Fix version check.
authorJustus Winter <justus@g10code.com>
Mon, 20 Mar 2017 15:53:29 +0000 (16:53 +0100)
committerJustus Winter <justus@g10code.com>
Mon, 20 Mar 2017 15:53:29 +0000 (16:53 +0100)
* lang/python/tests/support.py (assert_gpg_version): Cope with
non-released versions.

Fixes-commit: e1cf8bab319ba1dea41ba5d711dbb66ffd8e6fd6
Signed-off-by: Justus Winter <justus@g10code.com>
lang/python/tests/support.py

index 8f9d645..611986b 100644 (file)
@@ -22,13 +22,15 @@ import contextlib
 import shutil
 import sys
 import os
 import shutil
 import sys
 import os
+import re
 import tempfile
 import time
 import gpg
 
 def assert_gpg_version(version=(2, 1, 0)):
     with gpg.Context() as c:
 import tempfile
 import time
 import gpg
 
 def assert_gpg_version(version=(2, 1, 0)):
     with gpg.Context() as c:
-        if tuple(map(int, c.engine_info.version.split('.'))) < version:
+        clean_version = re.match(r'\d+\.\d+\.\d+', c.engine_info.version).group(0)
+        if tuple(map(int, clean_version.split('.'))) < version:
             print("GnuPG too old: have {0}, need {1}.".format(
                 c.engine_info.version, '.'.join(version)))
             sys.exit(77)
             print("GnuPG too old: have {0}, need {1}.".format(
                 c.engine_info.version, '.'.join(version)))
             sys.exit(77)