summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorLuke Smith <luke@lukesmith.xyz>2019-02-22 08:15:36 -0500
committerLuke Smith <luke@lukesmith.xyz>2019-02-22 08:15:36 -0500
commitde6bd6e5b0ea2c97b1780789d57cabb54f4ec0d4 (patch)
tree1162ccdea36d1596d62ab9f0ed73e5ea2dac428f /bin
parentb4204352a64bccc6734c0930611cf3924cd179ef (diff)
gpg autodetermined in python script
Diffstat (limited to 'bin')
-rwxr-xr-xbin/imappwd.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/bin/imappwd.py b/bin/imappwd.py
index 9b25fcc..d630b4f 100755
--- a/bin/imappwd.py
+++ b/bin/imappwd.py
@@ -1,10 +1,15 @@
import os.path
import subprocess
+import distutils.spawn
home = os.path.expanduser("~")
def mailpasswd(acct):
acct = os.path.basename(acct)
path = "%s/.local/share/muttwizard/%s.gpg" % (home,acct)
- args = ["gpg2", "--use-agent", "--quiet", "--batch", "-d", path]
+ if distutils.spawn.find_executable("gpg"):
+ GPG="gpg"
+ else:
+ GPG="gpg2"
+ args = [GPG, "--use-agent", "--quiet", "--batch", "-d", path]
try:
return subprocess.check_output(args).strip().decode('UTF-8')
except subprocess.CalledProcessError: