blob: d630b4f030a01d3a452e5b39a34fab8a52b0dc37 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
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)
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:
return ""
|