Define version constants etc in __init__.py

Move central constant definitions into __init__.py.  This does away
with version.py which contained nothing else and __init__.py is where
things like __VERSION__ are usually defined.

This commit also changes code to use offlineimap.__version__ rather
than offlineimap.version.__version__ as was before. Cleaned up some
duplicate or unneeded imports while touching those, formatting import
statements per PEP8 (one import per row).

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Sebastian Spaeth
2010-12-22 12:35:41 +01:00
committed by Nicolas Sebrecht
parent 229bcca491
commit 0b5b38d298
7 changed files with 59 additions and 69 deletions

View File

@ -16,21 +16,23 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
from threading import Lock, Event
import time
import sys
import os
import signal
import curses, curses.panel, curses.textpad, curses.wrapper
from Blinkenlights import BlinkenBase
from UIBase import UIBase
from threading import *
import thread, time, sys, os, signal, time
from offlineimap import version, threadutil
from offlineimap.threadutil import MultiLock
import offlineimap
import curses, curses.panel, curses.textpad, curses.wrapper
acctkeys = '1234567890abcdefghijklmnoprstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-=;/.,'
class CursesUtil:
def __init__(self):
self.pairlock = Lock()
self.iolock = MultiLock()
self.iolock = offlineimap.threadutil.MultiLock()
self.start()
def initpairs(self):
@ -251,7 +253,7 @@ class InputHandler:
s.startthread()
def startthread(s):
s.thread = threadutil.ExitNotifyThread(target = s.bgreaderloop,
s.thread = offlineimap.threadutil.ExitNotifyThread(target = s.bgreaderloop,
name = "InputHandler loop")
s.thread.setDaemon(1)
s.thread.start()
@ -321,7 +323,7 @@ class Blinkenlights(BlinkenBase, UIBase):
s.setupwindows()
s.inputhandler = InputHandler(s.c)
s.gettf().setcolor('red')
s._msg(version.banner)
s._msg(offlineimap.banner)
s.inputhandler.set_bgchar(s.keypress)
signal.signal(signal.SIGWINCH, s.resizehandler)
s.resizelock = Lock()
@ -454,10 +456,10 @@ class Blinkenlights(BlinkenBase, UIBase):
else:
color = curses.A_REVERSE
s.bannerwindow.bkgd(' ', color) # Fill background with that color
s.bannerwindow.addstr("%s %s" % (version.productname,
version.versionstr))
s.bannerwindow.addstr(0, s.bannerwindow.getmaxyx()[1] - len(version.copyright) - 1,
version.copyright)
s.bannerwindow.addstr("%s %s" % (offlineimap.__productname__,
offlineimap.__version__))
s.bannerwindow.addstr(0, s.bannerwindow.getmaxyx()[1] - len(offlineimap.__copyright__) - 1,
offlineimap.__copyright__)
s.bannerwindow.noutrefresh()

View File

@ -61,8 +61,8 @@ class UIBase:
def setlogfd(s, logfd):
s.logfile = logfd
logfd.write("This is %s %s\n" % \
(offlineimap.version.productname,
offlineimap.version.versionstr))
(offlineimap.__productname__,
offlineimap.__version__))
logfd.write("Python: %s\n" % sys.version)
logfd.write("Platform: %s\n" % sys.platform)
logfd.write("Args: %s\n" % sys.argv)
@ -174,7 +174,7 @@ class UIBase:
where the UI should do its setup -- TK, for instance, would
create the application window here."""
if s.verbose >= 0:
s._msg(offlineimap.version.banner)
s._msg(offlineimap.banner)
def connecting(s, hostname, port):
if s.verbose < 0: