From aabf02f155ab92172627bd00188218d7a3d01d3f Mon Sep 17 00:00:00 2001 From: jgoerzen Date: Fri, 25 Jul 2003 03:15:27 +0100 Subject: [PATCH] /offlineimap/head: changeset 518 Fixed a problem with the version number printout routine. --- offlineimap/head/offlineimap/init.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/offlineimap/head/offlineimap/init.py b/offlineimap/head/offlineimap/init.py index db778ad..d66a0a1 100644 --- a/offlineimap/head/offlineimap/init.py +++ b/offlineimap/head/offlineimap/init.py @@ -20,16 +20,24 @@ from offlineimap import imaplib, imapserver, repository, folder, mbnames, thread from offlineimap.localeval import LocalEval from offlineimap.threadutil import InstanceLimitedThread, ExitNotifyThread from offlineimap.ui import UIBase -import re, os, os.path, offlineimap, sys, fcntl +import re, os, os.path, offlineimap, sys from offlineimap.CustomConfig import CustomConfigParser from threading import * import threading from getopt import getopt +try: + import fcntl + hasfcntl = 1 +except: + hasfcntl = 0 + lockfd = None def lock(config, ui): - global lockfd + global lockfd, hasfcntl + if not hasfcntl: + return lockfd = open(config.getmetadatadir() + "/lock", "w") try: fcntl.flock(lockfd, fcntl.LOCK_EX | fcntl.LOCK_NB) @@ -38,7 +46,7 @@ def lock(config, ui): ui.terminate(1) def startup(versionno): - assert versionno == version.versionstr, "Revision of main program (%d) does not match that of library (%d). Please double-check your PYTHONPATH and installation locations." % (revno, version.revno) + assert versionno == version.versionstr, "Revision of main program (%s) does not match that of library (%s). Please double-check your PYTHONPATH and installation locations." % (versionno, version.versionstr) options = {} if '--help' in sys.argv[1:]: sys.stdout.write(version.cmdhelp + "\n") -- 2.39.2