Unset GPG.user_agent if using gpg2 binary.

* FIXES #96.
fix/96-no-use-agent
Isis Lovecruft 2015-03-09 08:33:11 +00:00
parent d3e6ae33b4
commit ae5cb33d63
No known key found for this signature in database
GPG Key ID: 18C16EC5F9F1D673
2 changed files with 7 additions and 4 deletions

View File

@ -537,8 +537,8 @@ class GPGBase(object):
if passphrase: cmd.append('--batch --passphrase-fd 0')
if self.use_agent: cmd.append('--use-agent')
elif self.use_agent==False: cmd.append('--no-use-agent') # obsolete for GPG 2.0
if self.use_agent is True: cmd.append('--use-agent')
elif self.use_agent is False: cmd.append('--no-use-agent')
# The arguments for debugging and verbosity should be placed into the
# cmd list before the options/args in order to resolve Issue #76:

View File

@ -161,8 +161,11 @@ class GPG(GPGBase):
# fatal error (at least it does with GnuPG>=2.0.0):
self.create_trustdb()
# --no-use-agent is obsolete
if not self.use_agent: self.use_agent = None
# The --no-use-agent and --use-agent options were deprecated in GnuPG
# 2.x, so we should set use_agent to None here to avoid having
# GPGBase._make_args() add either one.
if self.is_gpg2():
self.use_agent = None
@functools.wraps(_trust._create_trustdb)
def create_trustdb(self):