From f36ef4ffe0b7d9422ee825f1958708115eca60c6 Mon Sep 17 00:00:00 2001 From: Roman Zeyde Date: Sat, 30 Jun 2018 12:44:17 +0300 Subject: [PATCH] Allow running NeoPG binary (instead of GnuPG) --- libagent/gpg/keyring.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libagent/gpg/keyring.py b/libagent/gpg/keyring.py index 85adc55..1be4b35 100644 --- a/libagent/gpg/keyring.py +++ b/libagent/gpg/keyring.py @@ -198,16 +198,18 @@ def get_gnupg_components(sp=subprocess): @util.memoize -def get_gnupg_binary(sp=subprocess): +def get_gnupg_binary(sp=subprocess, neopg_binary=None): """Starting GnuPG 2.2.x, the default installation uses `gpg`.""" - return get_gnupg_components(sp=sp)['gpg'] + if neopg_binary: + return [neopg_binary, 'gpg2'] + return [get_gnupg_components(sp=sp)['gpg']] def gpg_command(args, env=None): """Prepare common GPG command line arguments.""" if env is None: env = os.environ - cmd = [get_gnupg_binary()] + cmd = get_gnupg_binary(neopg_binary=env.get('NEOPG_BINARY')) homedir = env.get('GNUPGHOME') if homedir: cmd.extend(['--homedir', homedir])