From ccde2e8dcd7db281319a872e71d76a4cc46a49bf Mon Sep 17 00:00:00 2001 From: Michał Górny Date: Sat, 16 May 2020 11:16:38 +0200 Subject: openpgp: Remove support for old Debian gpg2 executable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Górny --- gemato/openpgp.py | 31 ++++++++++--------------------- 1 file 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) -- cgit v1.2.3