From 17776601554011319e824e5815a3fe4597d344da Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Fri, 9 Sep 2016 17:00:42 +0800 Subject: offlineimap.py: remove unused code and fix errors/warnings --- _offlineimap/offlineimap.py | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/_offlineimap/offlineimap.py b/_offlineimap/offlineimap.py index 9a60d99..e34d8a6 100755 --- a/_offlineimap/offlineimap.py +++ b/_offlineimap/offlineimap.py @@ -21,11 +21,12 @@ # # Aaron LI # Created: 2015-02-02 -# Updated: 2016-01-29 +# Updated: 2016-09-09 # import os +import sys import subprocess @@ -39,21 +40,6 @@ def mailpasswd(account): except subprocess.CalledProcessError: return '' -# subprocess.check_output() only introduced in python 2.7 -# this version of 'mailpasswd' works with older version of python -#def mailpasswd(account): -# account = os.path.basename(account) -# path = '{0}/.offlineimap/{1}.gpg'.format(os.environ['HOME'], account) -# args = ['gpg2', '--for-your-eyes-only', '--no-tty', -# '--quiet', '--batch', '--decrypt', path] -# proc = subprocess.Popen(args, stdout=subprocess.PIPE) -# output = proc.communicate()[0].strip() -# retcode = proc.wait() -# if retcode == 0: -# return output -# else: -# return '' - # If you have several accounts that get checked simultaneously, and you # use 'gpg-agent', then it will ask for you passphrase for each account. @@ -72,5 +58,6 @@ def prime_gpg_agent(): i += 1 return ret -prime_gpg_agent() +if __name__ == "__main__": + prime_gpg_agent() -- cgit v1.2.2