/offlineimap/head: changeset 521

A few fixes for Jython compatibility.
This commit is contained in:
jgoerzen 2003-07-26 03:01:25 +01:00
parent ef95d2e5e7
commit 6051f47b28
3 changed files with 17 additions and 13 deletions

View File

@ -1,3 +1,3 @@
__all__ = ['ui', 'folder', 'repository', 'mbnames', 'threadutil'] __all__ = ['ui', 'folder', 'repository', 'mbnames', 'threadutil', 'init']

View File

@ -55,15 +55,15 @@ def startup(versionno):
for optlist in getopt(sys.argv[1:], 'P:1oa:c:d:l:u:h')[0]: for optlist in getopt(sys.argv[1:], 'P:1oa:c:d:l:u:h')[0]:
options[optlist[0]] = optlist[1] options[optlist[0]] = optlist[1]
if '-h' in options: if options.has_key('-h'):
sys.stdout.write(version.cmdhelp) sys.stdout.write(version.cmdhelp)
sys.stdout.write("\n") sys.stdout.write("\n")
sys.exit(0) sys.exit(0)
configfilename = os.path.expanduser("~/.offlineimaprc") configfilename = os.path.expanduser("~/.offlineimaprc")
if '-c' in options: if options.has_key('-c'):
configfilename = options['-c'] configfilename = options['-c']
if '-P' in options: if options.has_key('-P'):
if not '-1' in options: if not options.has_key('-1'):
sys.stderr.write("FATAL: profile mode REQUIRES -1\n") sys.stderr.write("FATAL: profile mode REQUIRES -1\n")
sys.exit(100) sys.exit(100)
profiledir = options['-P'] profiledir = options['-P']
@ -81,12 +81,12 @@ def startup(versionno):
ui = offlineimap.ui.detector.findUI(config, options.get('-u')) ui = offlineimap.ui.detector.findUI(config, options.get('-u'))
UIBase.setglobalui(ui) UIBase.setglobalui(ui)
if '-l' in options: if options.has_key('-l'):
ui.setlogfd(open(options['-l'], 'wt')) ui.setlogfd(open(options['-l'], 'wt'))
ui.init_banner() ui.init_banner()
if '-d' in options: if options.has_key('-d'):
for debugtype in options['-d'].split(','): for debugtype in options['-d'].split(','):
ui.add_debug(debugtype.strip()) ui.add_debug(debugtype.strip())
if debugtype == 'imap': if debugtype == 'imap':
@ -94,18 +94,18 @@ def startup(versionno):
if debugtype == 'thread': if debugtype == 'thread':
threading._VERBOSE = 1 threading._VERBOSE = 1
if '-o' in options: if options.has_key('-o'):
# FIXME: maybe need a better # FIXME: maybe need a better
for section in accounts.getaccountlist(config): for section in accounts.getaccountlist(config):
config.remove_option('Account ' + section, "autorefresh") config.remove_option('Account ' + section, "autorefresh")
lock(config, ui) lock(config, ui)
if '-l' in options: if options.has_key('-l'):
sys.stderr = ui.logfile sys.stderr = ui.logfile
activeaccounts = config.get("general", "accounts") activeaccounts = config.get("general", "accounts")
if '-a' in options: if options.has_key('-a'):
activeaccounts = options['-a'] activeaccounts = options['-a']
activeaccounts = activeaccounts.replace(" ", "") activeaccounts = activeaccounts.replace(" ", "")
activeaccounts = activeaccounts.split(",") activeaccounts = activeaccounts.split(",")
@ -119,7 +119,7 @@ def startup(versionno):
remoterepos = None remoterepos = None
localrepos = None localrepos = None
if '-1' in options: if options.has_key('-1'):
threadutil.initInstanceLimit("ACCOUNTLIMIT", 1) threadutil.initInstanceLimit("ACCOUNTLIMIT", 1)
else: else:
threadutil.initInstanceLimit("ACCOUNTLIMIT", threadutil.initInstanceLimit("ACCOUNTLIMIT",
@ -128,7 +128,7 @@ def startup(versionno):
for reposname in config.getsectionlist('Repository'): for reposname in config.getsectionlist('Repository'):
for instancename in ["FOLDER_" + reposname, for instancename in ["FOLDER_" + reposname,
"MSGCOPY_" + reposname]: "MSGCOPY_" + reposname]:
if '-1' in options: if options.has_key('-1'):
threadutil.initInstanceLimit(instancename, 1) threadutil.initInstanceLimit(instancename, 1)
else: else:
threadutil.initInstanceLimit(instancename, threadutil.initInstanceLimit(instancename,

View File

@ -17,7 +17,11 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import imp, errno import imp
try:
import errno
except:
pass
class LocalEval: class LocalEval:
def __init__(self, path=None): def __init__(self, path=None):