def CheckVersion(self): from spambayes.Version import get_current_version, get_version, \ get_download_page, fetch_latest_dict app_name = "POP3 Proxy" app_display_name = "SpamBayes POP3 Proxy" ver_current = get_current_version() cur_ver_string = ver_current.get_long_version(app_display_name) try: SetWaitCursor(1) latest = fetch_latest_dict() SetWaitCursor(0) ver_latest = get_version(app_name, version_dict=latest) latest_ver_string = ver_latest.get_long_version(app_display_name) except: self.ShowMessage("Error checking the latest version") traceback.print_exc() return ver_message = "Current version is %s.\r\n" \ "Latest version is %s.\r\n\r\n" % \ (cur_ver_string, latest_ver_string) if ver_latest == ver_current: ver_message += "Your are running the latest downloadable version." elif ver_current > ver_latest: ver_message += "Your current version is newer than the latest " \ "downloadable version." else: ver_message += "There is a newer version available. You may " \ "download the updated version from:\r\n" url = get_download_page(app_name, version_dict=latest) ver_message += url self.ShowMessage(ver_message)
def version(): v = get_current_version() print >> sys.stderr, v.get_long_version("SpamBayes Command Line Filter") sys.exit(0)
def run(): try: opts, args = getopt.getopt(sys.argv[1:], 'ho:') except getopt.error as msg: print(str(msg) + '\n\n' + __doc__, file=sys.stderr) sys.exit() for opt, arg in opts: if opt == '-h': print(__doc__, file=sys.stderr) sys.exit() elif opt == '-o': options.set_from_cmdline(arg, sys.stderr) v = get_current_version() print(v.get_long_version()) from twisted.copyright import version as twisted_version print("Twisted version %s.\n" % (twisted_version,)) prepare() start()
def Init(self): from spambayes.Version import get_current_version import sys v = get_current_version() vstring = v.get_long_version("SpamBayes Outlook Addin") if not hasattr(sys, "frozen"): vstring += _(" from source") win32gui.SendMessage(self.GetControl(), win32con.WM_SETTEXT, 0, vstring)
def usage(code, msg=''): """Print usage message and sys.exit(code).""" v = get_current_version() print(v.get_long_version("SpamBayes Command Line Filter"), file=sys.stderr) print(file=sys.stderr) if msg: print(msg, file=sys.stderr) print(file=sys.stderr) print(__doc__ % globals(), file=sys.stderr) sys.exit(code)
def usage(code, msg=''): """Print usage message and sys.exit(code).""" v = get_current_version() print >> sys.stderr, v.get_long_version("SpamBayes Command Line Filter") print >> sys.stderr if msg: print >> sys.stderr, msg print >> sys.stderr print >> sys.stderr, __doc__ % globals() sys.exit(code)
def usage(code, msg=''): """Print usage message and sys.exit(code).""" # Include version info in usage v = get_current_version() print >> sys.stderr, v.get_long_version("SpamBayes Command Line Filter") print >> sys.stderr if msg: print >> sys.stderr, msg print >> sys.stderr print >> sys.stderr, __doc__ % globals() sys.exit(code)
def run(): try: opts, args = getopt.getopt(sys.argv[1:], 'hbd:p:l:u:o:P:') except getopt.error as msg: print(str(msg) + '\n\n' + __doc__, file=sys.stderr) sys.exit() state = CoreState() state.plugin = None for opt, arg in opts: if opt == '-h': print(__doc__, file=sys.stderr) sys.exit() elif opt == '-b': state.launch_ui = True elif opt == '-l': state.proxyPorts = [_addressAndPort(a) for a in arg.split(',')] elif opt == '-u': state.ui_port = int(arg) elif opt == '-o': options.set_from_cmdline(arg, sys.stderr) elif opt == '-P': state.plugin = load_plugin(arg, state) if state.plugin is None: print("No plugin argument (-P) was given.", file=sys.stderr) print(__doc__, file=sys.stderr) sys.exit() v = get_current_version() print("%s\n" % (v.get_long_version("SpamBayes Core Proxy"),)) if 0 <= len(args) <= 2: if len(args) == 1: state.servers = [(args[0], 110)] elif len(args) == 2: state.servers = [(args[0], int(args[1]))] try: state.prepare() except AlreadyRunningException: print("ERROR: The proxy is already running on this machine.", file=sys.stderr) print("Please stop the existing proxy and try again", file=sys.stderr) return try: main(state) finally: state.close() else: print(__doc__, file=sys.stderr)
def run(): global state try: opts, args = getopt.getopt(sys.argv[1:], 'hbd:p:l:u:o:') except getopt.error as msg: print(str(msg) + '\n\n' + __doc__, file=sys.stderr) sys.exit() for opt, arg in opts: if opt == '-h': print(__doc__, file=sys.stderr) sys.exit() elif opt == '-b': state.launchUI = True elif opt == '-l': state.proxyPorts = [_addressAndPort(a) for a in arg.split(',')] elif opt == '-u': state.uiPort = int(arg) elif opt == '-o': options.set_from_cmdline(arg, sys.stderr) state.DBName, state.useDB = storage.database_type(opts) v = get_current_version() print("%s\n" % (v.get_long_version("SpamBayes POP3 Proxy"),)) if 0 <= len(args) <= 2: if len(args) == 1: state.servers = [(args[0], 110)] elif len(args) == 2: state.servers = [(args[0], int(args[1]))] if len(args) > 0 and state.proxyPorts == []: state.proxyPorts = [('', 110)] try: prepare() except AlreadyRunningException: print("ERROR: The proxy is already running on this machine.", file=sys.stderr) print("Please stop the existing proxy and try again", file=sys.stderr) return start() else: print(__doc__, file=sys.stderr)
sys.exit() elif opt == '-b': state.launchUI = True # '-p' and '-d' are handled by the storage.database_type call # below, in case you are wondering why they are missing. elif opt == '-l': state.proxyPorts = [_addressAndPort(a) for a in arg.split(',')] elif opt == '-u': state.uiPort = int(arg) elif opt == '-o': options.set_from_cmdline(arg, sys.stderr) state.DBName, state.useDB = storage.database_type(opts) # Let the user know what they are using... v = get_current_version() print "%s\n" % (v.get_long_version("SpamBayes POP3 Proxy"), ) if 0 <= len(args) <= 2: # Normal usage, with optional server name and port number. if len(args) == 1: state.servers = [(args[0], 110)] elif len(args) == 2: state.servers = [(args[0], int(args[1]))] # Default to listening on port 110 for command-line-specified servers. if len(args) > 0 and state.proxyPorts == []: state.proxyPorts = [('', 110)] try: prepare()
elif opt == '-l': state.proxyPorts = [_addressAndPort(a) for a in arg.split(',')] elif opt == '-u': state.ui_port = int(arg) elif opt == '-o': options.set_from_cmdline(arg, sys.stderr) elif opt == '-P': state.plugin = load_plugin(arg, state) if state.plugin is None: print >> sys.stderr, "No plugin argument (-P) was given." print >> sys.stderr, __doc__ sys.exit() # Let the user know what they are using... v = get_current_version() print "%s\n" % (v.get_long_version("SpamBayes Core Proxy"),) if 0 <= len(args) <= 2: # Normal usage, with optional server name and port number. if len(args) == 1: state.servers = [(args[0], 110)] elif len(args) == 2: state.servers = [(args[0], int(args[1]))] try: state.prepare() except AlreadyRunningException: print >> sys.stderr, \ "ERROR: The proxy is already running on this machine." print >> sys.stderr, "Please stop the existing proxy and try again"