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:
parent
229bcca491
commit
0b5b38d298
@ -1,5 +1,23 @@
|
|||||||
|
__all__ = ['OfflineImap']
|
||||||
|
|
||||||
|
__productname__ = 'OfflineIMAP'
|
||||||
|
__version__ = "6.3.1"
|
||||||
|
__copyright__ = "Copyright (C) 2002 - 2010 John Goerzen"
|
||||||
|
__author__ = "John Goerzen"
|
||||||
|
__author_email__= "john@complete.org"
|
||||||
|
__description__ = "Disconnected Universal IMAP Mail Synchronization/Reader Support"
|
||||||
|
__bigcopyright__ = """%(__productname__)s %(__version__)s
|
||||||
|
%(__copyright__)s <%(__author_email__)s>""" % locals()
|
||||||
|
|
||||||
|
banner = __bigcopyright__ + """
|
||||||
|
|
||||||
|
This software comes with ABSOLUTELY NO WARRANTY; see the file
|
||||||
|
COPYING for details. This is free software, and you are welcome
|
||||||
|
to distribute it under the conditions laid out in COPYING."""
|
||||||
|
|
||||||
|
__homepage__ = "http://github.com/nicolas33/offlineimap"
|
||||||
|
__license__ = "Licensed under the GNU GPL v2+ (v2 or any later version)."
|
||||||
|
|
||||||
|
# put this last, so we don't run into circular dependencies using
|
||||||
|
# e.g. offlineimap.__version__.
|
||||||
from offlineimap.init import OfflineImap
|
from offlineimap.init import OfflineImap
|
||||||
|
|
||||||
__all__ = ['ui', 'folder', 'repository', 'mbnames', 'threadutil', 'init']
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,16 +16,18 @@
|
|||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
from Base import BaseFolder
|
|
||||||
import imaplib
|
import imaplib
|
||||||
from offlineimap import imaputil, imaplibutil
|
import rfc822
|
||||||
from offlineimap.ui import UIBase
|
import string
|
||||||
from offlineimap.version import versionstr
|
import random
|
||||||
import rfc822, time, string, random, binascii, re
|
import binascii
|
||||||
|
import re
|
||||||
from StringIO import StringIO
|
from StringIO import StringIO
|
||||||
from copy import copy
|
from copy import copy
|
||||||
import time
|
import time
|
||||||
|
from Base import BaseFolder
|
||||||
|
from offlineimap import imaputil, imaplibutil, __version__
|
||||||
|
from offlineimap.ui import UIBase
|
||||||
|
|
||||||
class IMAPFolder(BaseFolder):
|
class IMAPFolder(BaseFolder):
|
||||||
def __init__(self, imapserver, name, visiblename, accountname, repository):
|
def __init__(self, imapserver, name, visiblename, accountname, repository):
|
||||||
@ -226,7 +228,7 @@ class IMAPFolder(BaseFolder):
|
|||||||
headervalue += binascii.hexlify(self.getname())
|
headervalue += binascii.hexlify(self.getname())
|
||||||
headervalue += '-%d-' % long(time.time())
|
headervalue += '-%d-' % long(time.time())
|
||||||
headervalue += str(self.randomgenerator.random()).replace('.', '')
|
headervalue += str(self.randomgenerator.random()).replace('.', '')
|
||||||
headervalue += '-v' + versionstr
|
headervalue += '-v' + offlineimap.__version__
|
||||||
return (headername, headervalue)
|
return (headername, headervalue)
|
||||||
|
|
||||||
def savemessage_addheader(self, content, headername, headervalue):
|
def savemessage_addheader(self, content, headername, headervalue):
|
||||||
|
@ -59,7 +59,10 @@ class OfflineImap:
|
|||||||
def run(self):
|
def run(self):
|
||||||
"""Parse the commandline and invoke everything"""
|
"""Parse the commandline and invoke everything"""
|
||||||
|
|
||||||
parser = OptionParser()
|
parser = OptionParser(version=offlineimap.banner,
|
||||||
|
description="%s.\n\n%s" %
|
||||||
|
(offlineimap.__copyright__,
|
||||||
|
offlineimap.__license__))
|
||||||
parser.add_option("-1",
|
parser.add_option("-1",
|
||||||
action="store_true", dest="singlethreading",
|
action="store_true", dest="singlethreading",
|
||||||
default=False,
|
default=False,
|
||||||
@ -90,7 +93,7 @@ class OfflineImap:
|
|||||||
parser.add_option("-c", dest="configfile", metavar="FILE",
|
parser.add_option("-c", dest="configfile", metavar="FILE",
|
||||||
default="~/.offlineimaprc",
|
default="~/.offlineimaprc",
|
||||||
help="Specifies a configuration file to use in lieu of "
|
help="Specifies a configuration file to use in lieu of "
|
||||||
"the default, ~/.offlineimaprc.")
|
"%default.")
|
||||||
|
|
||||||
parser.add_option("-d", dest="debugtype", metavar="type1,[type2...]",
|
parser.add_option("-d", dest="debugtype", metavar="type1,[type2...]",
|
||||||
help=
|
help=
|
||||||
|
@ -16,21 +16,23 @@
|
|||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
# 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 Blinkenlights import BlinkenBase
|
||||||
from UIBase import UIBase
|
from UIBase import UIBase
|
||||||
from threading import *
|
import offlineimap
|
||||||
import thread, time, sys, os, signal, time
|
|
||||||
from offlineimap import version, threadutil
|
|
||||||
from offlineimap.threadutil import MultiLock
|
|
||||||
|
|
||||||
import curses, curses.panel, curses.textpad, curses.wrapper
|
|
||||||
|
|
||||||
acctkeys = '1234567890abcdefghijklmnoprstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-=;/.,'
|
acctkeys = '1234567890abcdefghijklmnoprstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-=;/.,'
|
||||||
|
|
||||||
class CursesUtil:
|
class CursesUtil:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.pairlock = Lock()
|
self.pairlock = Lock()
|
||||||
self.iolock = MultiLock()
|
self.iolock = offlineimap.threadutil.MultiLock()
|
||||||
self.start()
|
self.start()
|
||||||
|
|
||||||
def initpairs(self):
|
def initpairs(self):
|
||||||
@ -251,7 +253,7 @@ class InputHandler:
|
|||||||
s.startthread()
|
s.startthread()
|
||||||
|
|
||||||
def startthread(s):
|
def startthread(s):
|
||||||
s.thread = threadutil.ExitNotifyThread(target = s.bgreaderloop,
|
s.thread = offlineimap.threadutil.ExitNotifyThread(target = s.bgreaderloop,
|
||||||
name = "InputHandler loop")
|
name = "InputHandler loop")
|
||||||
s.thread.setDaemon(1)
|
s.thread.setDaemon(1)
|
||||||
s.thread.start()
|
s.thread.start()
|
||||||
@ -321,7 +323,7 @@ class Blinkenlights(BlinkenBase, UIBase):
|
|||||||
s.setupwindows()
|
s.setupwindows()
|
||||||
s.inputhandler = InputHandler(s.c)
|
s.inputhandler = InputHandler(s.c)
|
||||||
s.gettf().setcolor('red')
|
s.gettf().setcolor('red')
|
||||||
s._msg(version.banner)
|
s._msg(offlineimap.banner)
|
||||||
s.inputhandler.set_bgchar(s.keypress)
|
s.inputhandler.set_bgchar(s.keypress)
|
||||||
signal.signal(signal.SIGWINCH, s.resizehandler)
|
signal.signal(signal.SIGWINCH, s.resizehandler)
|
||||||
s.resizelock = Lock()
|
s.resizelock = Lock()
|
||||||
@ -454,10 +456,10 @@ class Blinkenlights(BlinkenBase, UIBase):
|
|||||||
else:
|
else:
|
||||||
color = curses.A_REVERSE
|
color = curses.A_REVERSE
|
||||||
s.bannerwindow.bkgd(' ', color) # Fill background with that color
|
s.bannerwindow.bkgd(' ', color) # Fill background with that color
|
||||||
s.bannerwindow.addstr("%s %s" % (version.productname,
|
s.bannerwindow.addstr("%s %s" % (offlineimap.__productname__,
|
||||||
version.versionstr))
|
offlineimap.__version__))
|
||||||
s.bannerwindow.addstr(0, s.bannerwindow.getmaxyx()[1] - len(version.copyright) - 1,
|
s.bannerwindow.addstr(0, s.bannerwindow.getmaxyx()[1] - len(offlineimap.__copyright__) - 1,
|
||||||
version.copyright)
|
offlineimap.__copyright__)
|
||||||
|
|
||||||
s.bannerwindow.noutrefresh()
|
s.bannerwindow.noutrefresh()
|
||||||
|
|
||||||
|
@ -61,8 +61,8 @@ class UIBase:
|
|||||||
def setlogfd(s, logfd):
|
def setlogfd(s, logfd):
|
||||||
s.logfile = logfd
|
s.logfile = logfd
|
||||||
logfd.write("This is %s %s\n" % \
|
logfd.write("This is %s %s\n" % \
|
||||||
(offlineimap.version.productname,
|
(offlineimap.__productname__,
|
||||||
offlineimap.version.versionstr))
|
offlineimap.__version__))
|
||||||
logfd.write("Python: %s\n" % sys.version)
|
logfd.write("Python: %s\n" % sys.version)
|
||||||
logfd.write("Platform: %s\n" % sys.platform)
|
logfd.write("Platform: %s\n" % sys.platform)
|
||||||
logfd.write("Args: %s\n" % sys.argv)
|
logfd.write("Args: %s\n" % sys.argv)
|
||||||
@ -174,7 +174,7 @@ class UIBase:
|
|||||||
where the UI should do its setup -- TK, for instance, would
|
where the UI should do its setup -- TK, for instance, would
|
||||||
create the application window here."""
|
create the application window here."""
|
||||||
if s.verbose >= 0:
|
if s.verbose >= 0:
|
||||||
s._msg(offlineimap.version.banner)
|
s._msg(offlineimap.banner)
|
||||||
|
|
||||||
def connecting(s, hostname, port):
|
def connecting(s, hostname, port):
|
||||||
if s.verbose < 0:
|
if s.verbose < 0:
|
||||||
|
@ -1,35 +0,0 @@
|
|||||||
productname = 'OfflineIMAP'
|
|
||||||
versionstr = "6.3.1"
|
|
||||||
|
|
||||||
versionlist = versionstr.split(".")
|
|
||||||
major = versionlist[0]
|
|
||||||
minor = versionlist[1]
|
|
||||||
patch = versionlist[2]
|
|
||||||
copyright = "Copyright (C) 2002 - 2009 John Goerzen"
|
|
||||||
author = "John Goerzen"
|
|
||||||
author_email = "jgoerzen@complete.org"
|
|
||||||
description = "Disconnected Universal IMAP Mail Synchronization/Reader Support"
|
|
||||||
bigcopyright = """%(productname)s %(versionstr)s
|
|
||||||
%(copyright)s <%(author_email)s>""" % locals()
|
|
||||||
|
|
||||||
banner = bigcopyright + """
|
|
||||||
This software comes with ABSOLUTELY NO WARRANTY; see the file
|
|
||||||
COPYING for details. This is free software, and you are welcome
|
|
||||||
to distribute it under the conditions laid out in COPYING."""
|
|
||||||
|
|
||||||
homepage = "http://software.complete.org/offlineimap/"
|
|
||||||
license = """Copyright (C) 2002 - 2009 John Goerzen <jgoerzen@complete.org>
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA"""
|
|
12
setup.py
12
setup.py
@ -27,15 +27,15 @@ from distutils.core import setup
|
|||||||
import offlineimap.version
|
import offlineimap.version
|
||||||
|
|
||||||
setup(name = "offlineimap",
|
setup(name = "offlineimap",
|
||||||
version = offlineimap.version.versionstr,
|
version = offlineimap.__version__,
|
||||||
description = offlineimap.version.description,
|
description = offlineimap.__description__,
|
||||||
author = offlineimap.version.author,
|
author = offlineimap.__author__,
|
||||||
author_email = offlineimap.version.author_email,
|
author_email = offlineimap.__author_email__,
|
||||||
url = offlineimap.version.homepage,
|
url = offlineimap.__homepage__,
|
||||||
packages = ['offlineimap', 'offlineimap.folder',
|
packages = ['offlineimap', 'offlineimap.folder',
|
||||||
'offlineimap.repository', 'offlineimap.ui'],
|
'offlineimap.repository', 'offlineimap.ui'],
|
||||||
scripts = ['bin/offlineimap'],
|
scripts = ['bin/offlineimap'],
|
||||||
license = offlineimap.version.copyright + \
|
license = offlineimap.__copyright__ + \
|
||||||
", Licensed under the GPL version 2"
|
", Licensed under the GPL version 2"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user