python: Fix version check.
* lang/python/tests/support.py (assert_gpg_version): Cope with
non-released versions.
Fixes-commit: e1cf8bab31
Signed-off-by: Justus Winter <justus@g10code.com>
This commit is contained in:
parent
16b202d999
commit
57e64d019d
@ -22,13 +22,15 @@ import contextlib
|
|||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
import tempfile
|
import tempfile
|
||||||
import time
|
import time
|
||||||
import gpg
|
import gpg
|
||||||
|
|
||||||
def assert_gpg_version(version=(2, 1, 0)):
|
def assert_gpg_version(version=(2, 1, 0)):
|
||||||
with gpg.Context() as c:
|
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(
|
print("GnuPG too old: have {0}, need {1}.".format(
|
||||||
c.engine_info.version, '.'.join(version)))
|
c.engine_info.version, '.'.join(version)))
|
||||||
sys.exit(77)
|
sys.exit(77)
|
||||||
|
Loading…
Reference in New Issue
Block a user