mirror of
https://github.com/romanz/amodem.git
synced 2026-05-09 21:13:04 +08:00
Allow running NeoPG binary (instead of GnuPG)
This commit is contained in:
@@ -198,16 +198,18 @@ def get_gnupg_components(sp=subprocess):
|
|||||||
|
|
||||||
|
|
||||||
@util.memoize
|
@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`."""
|
"""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):
|
def gpg_command(args, env=None):
|
||||||
"""Prepare common GPG command line arguments."""
|
"""Prepare common GPG command line arguments."""
|
||||||
if env is None:
|
if env is None:
|
||||||
env = os.environ
|
env = os.environ
|
||||||
cmd = [get_gnupg_binary()]
|
cmd = get_gnupg_binary(neopg_binary=env.get('NEOPG_BINARY'))
|
||||||
homedir = env.get('GNUPGHOME')
|
homedir = env.get('GNUPGHOME')
|
||||||
if homedir:
|
if homedir:
|
||||||
cmd.extend(['--homedir', homedir])
|
cmd.extend(['--homedir', homedir])
|
||||||
|
|||||||
Reference in New Issue
Block a user