From 4f811e611df9101e84fcf0ebdef6764cfc3d9fa2 Mon Sep 17 00:00:00 2001 From: Charles Duffy Date: Thu, 12 Nov 2015 13:12:13 -0600 Subject: [PATCH] Allow automatic trustdb checks to be disabled. Skip auto trustdb creation if option to not refer to it is given --- gnupg/_parsers.py | 1 + gnupg/gnupg.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/gnupg/_parsers.py b/gnupg/_parsers.py index 0c92e52..d59fd6d 100644 --- a/gnupg/_parsers.py +++ b/gnupg/_parsers.py @@ -561,6 +561,7 @@ def _get_options_group(group=None): '--lock-multiple', '--lock-never', '--lock-once', + '--no-auto-check-trustdb', '--no-default-keyring', '--no-default-recipient', '--no-emit-version', diff --git a/gnupg/gnupg.py b/gnupg/gnupg.py index 215233e..2df0a5a 100644 --- a/gnupg/gnupg.py +++ b/gnupg/gnupg.py @@ -159,7 +159,8 @@ def __init__(self, binary=None, homedir=None, verbose=False, # Make sure that the trustdb exists, or else GnuPG will exit with a # fatal error (at least it does with GnuPG>=2.0.0): - self.create_trustdb() + if not (self.options is not None and '--no-auto-check-trustdb' in self.options): + self.create_trustdb() # 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