diff options
author | Michał Górny <mgorny@gentoo.org> | 2020-05-16 11:16:38 +0200 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2020-05-16 11:16:38 +0200 |
commit | ccde2e8dcd7db281319a872e71d76a4cc46a49bf (patch) | |
tree | c3f0fdd623a70d5ef369258197cb144c423fa727 | |
parent | d6f93713ae8c8e0db0bccd510e982e9e255ff22a (diff) | |
download | gemato-ccde2e8dcd7db281319a872e71d76a4cc46a49bf.tar.gz |
openpgp: Remove support for old Debian gpg2 executable
Signed-off-by: Michał Górny <mgorny@gentoo.org>
-rw-r--r-- | gemato/openpgp.py | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/gemato/openpgp.py b/gemato/openpgp.py index 53f2c13..c7a6a34 100644 --- a/gemato/openpgp.py +++ b/gemato/openpgp.py @@ -34,11 +34,10 @@ class OpenPGPSystemEnvironment(object): (user's home directory or GNUPGHOME). """ - __slots__ = ['debug', '_impl'] + __slots__ = ['debug'] def __init__(self, debug=False): self.debug = debug - self._impl = None def __enter__(self): return self @@ -154,27 +153,17 @@ class OpenPGPSystemEnvironment(object): env['TZ'] = 'UTC' env.update(env_override) - impls = ['gpg2', 'gpg'] - if self._impl is not None: - impls = [self._impl] - - for impl in impls: - try: - p = subprocess.Popen([impl, '--batch'] + options, - stdin=subprocess.PIPE, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, - env=env) - except OSError as e: - if e.errno != errno.ENOENT: - raise - else: - break - else: + try: + p = subprocess.Popen(['gpg', '--batch'] + options, + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + env=env) + except OSError as e: + if e.errno != errno.ENOENT: + raise raise gemato.exceptions.OpenPGPNoImplementation() - self._impl = impl - out, err = p.communicate(stdin) return (p.wait(), out, err) |