Skip to content

Commit

Permalink
Add GPG binary availability checking.
Browse files Browse the repository at this point in the history
  • Loading branch information
Smári McCarthy committed Dec 20, 2013
1 parent d242c9e commit 71587a0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions mailpile/gpgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ class GnuPG:
"""

def __init__(self):
self.available = None
self.gpgbinary = 'gpg'
self.passphrase = None
self.fds = {"passphrase": True,
Expand Down Expand Up @@ -470,6 +471,15 @@ def run(self, args=[], callbacks={}, output=None, debug=False):

return proc.returncode, retvals

def is_available(self):
try:
retvals = self.run(["--version"])
self.available = True
except OSError:
self.available = False

return self.available

def list_keys(self):
"""
>>> g = GnuPG()
Expand Down

0 comments on commit 71587a0

Please sign in to comment.