def start(configFile): configFile = getAbsolutePath(configFile) if platform.system() != "Windows": os.system("clear") else: os.system("cls") # Check if a newer version of B3 is available _update = checkUpdate(__version__, singleLine=False, showErrormsg=True) if _update: print _update _delay = 5 print "...resuming in %s seconds" % _delay time.sleep(_delay) print "Starting %s\n" % getB3versionString() if os.path.exists(configFile): print "Using config file: %s" % configFile global _confDir _confDir = os.path.dirname(configFile) # print 'Config dir is : %s' % _confDir conf = config.load(configFile) else: Setup(configFile) # raise SystemExit('Could not find config file %s' % configFile) parserType = conf.get("b3", "parser") if not parserType: raise SystemExit("You must supply a parser") parser = loadParser(parserType) extplugins_dir = conf.getpath("plugins", "external_dir") print "Using external plugin directory: %s" % extplugins_dir global console console = parser(conf) def termSignalHandler(signum, frame): console.bot("TERM signal received. Shutting down") console.shutdown() raise SystemExit(222) signal.signal(signal.SIGTERM, termSignalHandler) try: console.start() except KeyboardInterrupt: console.shutdown() print "Goodbye" return except SystemExit, msg: print "Exiting: %s" % msg raise
def start(configFile, nosetup=False): configFile = getAbsolutePath(configFile) clearScreen() # Check if a newer version of B3 is available _update = checkUpdate(__version__, singleLine=False, showErrormsg=True) if _update: print _update _delay = 5 print "...resuming in %s seconds" % _delay time.sleep(_delay) else: print "...no update available." _delay = 1 time.sleep(_delay) clearScreen() print 'Starting %s\n' % getB3versionString() if os.path.exists(configFile): print 'Using config file: %s' % configFile global _confDir _confDir = os.path.dirname(configFile) #print 'Config dir is : %s' % _confDir conf = config.load(configFile) else: # This happens when a config was entered on the commandline, but it does not exist if nosetup: raise SystemExit('Could not find config file %s' % configFile) else: Setup(configFile) try: parserType = conf.get('b3', 'parser') if not parserType: raise SystemExit('You must supply a parser') try: parser = loadParser(parserType, configFile, nosetup) except ImportError, err: raise SystemExit( "CRITICAL: Cannot find parser '%s'. Check you main config file (b3.xml)\nB3 failed to start.\n%r" % (parserType, err)) extplugins_dir = conf.getpath('plugins', 'external_dir') print "Using external plugin directory: %s" % extplugins_dir global console console = parser(conf)
def start(configFile): configFile = getAbsolutePath(configFile) clearScreen() # Check if a newer version of B3 is available _update = checkUpdate(__version__, singleLine=False, showErrormsg=True) if _update: print _update _delay = 5 print "...resuming in %s seconds" %_delay time.sleep(_delay) else: print "...no update available." _delay = 1 time.sleep(_delay) clearScreen() print 'Starting %s\n' % getB3versionString() if os.path.exists(configFile): print 'Using config file: %s' % configFile global _confDir _confDir = os.path.dirname(configFile) #print 'Config dir is : %s' % _confDir conf = config.load(configFile) else: Setup(configFile) #raise SystemExit('Could not find config file %s' % configFile) try: parserType = conf.get('b3', 'parser') if not parserType: raise SystemExit('You must supply a parser') try: parser = loadParser(parserType) except ImportError: raise SystemExit("CRITICAL: Cannot find parser '%s'. Check you main config file (b3.xml)\nB3 failed to start"% parserType) extplugins_dir = conf.getpath('plugins', 'external_dir'); print "Using external plugin directory: %s" % extplugins_dir global console console = parser(conf) except ConfigParser.NoOptionError, err: raise SystemExit("CRITICAL: option %r not found in section %r. Correct your config file %s" % (err.option, err.section, configFile))
def test_5(self): sys.modules[__name__].URL_B3_LATEST_VERSION = "http://localhost:9000/" self.assertNotEqual(None, functions.checkUpdate("1.2", singleLine=True, showErrormsg=True))
def test_3(self): self.assertIsNone(functions.checkUpdate("1.4.1", singleLine=True, showErrormsg=True))
def test_1(self): self.assertIsInstance(functions.checkUpdate("1.2", singleLine=True, showErrormsg=True), basestring)