Browse Source

gpg autodetermined in python script

tags/v3.1
Luke Smith 5 years ago
parent
commit
de6bd6e5b0
No known key found for this signature in database GPG Key ID: 4C50B54A911F6252
1 changed files with 6 additions and 1 deletions
  1. +6
    -1
      bin/imappwd.py

+ 6
- 1
bin/imappwd.py View File

@@ -1,10 +1,15 @@
import os.path import os.path
import subprocess import subprocess
import distutils.spawn
home = os.path.expanduser("~") home = os.path.expanduser("~")
def mailpasswd(acct): def mailpasswd(acct):
acct = os.path.basename(acct) acct = os.path.basename(acct)
path = "%s/.local/share/muttwizard/%s.gpg" % (home,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: try:
return subprocess.check_output(args).strip().decode('UTF-8') return subprocess.check_output(args).strip().decode('UTF-8')
except subprocess.CalledProcessError: except subprocess.CalledProcessError:


Loading…
Cancel
Save