def main(): # recreatedb() config.parse_options() config.parse_filetypes() if config.run_bookmarks_manager: run_bookmarks_manager() sys.exit() import os import gtk from gtk import gdk from mainwindow import odin br = odin() br.main_window.show() if config.opt_files: filename = os.path.abspath(config.opt_files[0]) br.set_current_book(filename) else: br.set_current_book() gdk.threads_init() gtk.main()
def main(): config.parse_options() global_vars.storage_handle = storage.connect(global_vars.db_filename) model_list = generate_model_list() clear_tables(model_list) create_new_tables(model_list) storage.close(global_vars.storage_handle)
def setUp(self): yaml_file = os.path.join(os.path.dirname(__file__), '..', '..', 'config.yml') config.load(yaml_file) config.bootstrap(['-vv']) # make sure we're not mocking out google reader app_globals.OPTIONS['test'] = False config.parse_options(['--output-path=/tmp/gris-test', '--num-items=1']) config.check() self.reader = app_globals.READER = Reader()
def main(): config.parse_options() #global_vars.storage_handle = storage.connect(global_vars.db_filename) global_vars.app_handle.run( host=global_vars.bind_address, port=global_vars.listen_port, debug=True ) #storage.close(global_vars.storage_handle) print "Received request for shutdown; halting."
def init_output_folder(): output_folder = '/tmp/GRiS/test_entries' config.parse_options(['--test','--num-items=3','--verbose','--verbose', '--verbose', '--output-path=%s' % output_folder]) assert app_globals.OPTIONS['output_path'] == output_folder ensure_dir_exists(output_folder) app_globals.READER = Reader() assert type(app_globals.READER.gr) == Mock return output_folder
def setup(opts=None): """Parse options. If none given, opts is set to sys.argv""" if opts is None: opts = sys.argv[1:] config.bootstrap(opts) config.load() config.parse_options(opts) ensure_dir_exists(app_globals.OPTIONS['output_path']) log_start() if app_globals.OPTIONS['report_pid']: proctl.report_pid() exit(0) config.check() proctl.ensure_singleton_process() init_signals()
def test_should_not_fail_setting_any_options(self): for opt in config.all_options[1]: opt = '--' + opt args = [opt] if opt.endswith('='): args = [opt[:-1], '123'] if opt == '--help': try: config.bootstrap([opt]) except SystemExit: pass continue print "bootstrapping with %s" % args config.bootstrap(args) print "configging with %s" % args config.parse_options(args)
def test_comparing_unicode_tags(self): config.parse_options(['--tag=caf\xc3\xa9']) # cafe in utf-8 mock_tag_list(self.reader, [u'com.google/label/caf\xe9']) self.assertEqual(app_globals.OPTIONS['tag_list'], [u'caf\xe9']) self.reader.validate_tag_list()
#!/usr/bin/env python from bot import MarvinBot from tui import MarvinTUI import threading import config # see http://www.devshed.com/c/a/Python/IRC-on-a-Higher-Level/1/ if __name__ == '__main__': args = config.parse_options() conf = config.parse_config(args) all_joined = threading.Event() tui = MarvinTUI(conf) bot = MarvinBot(conf, tui, all_joined) bot.start() all_joined.wait() try: tui.cmdloop() except KeyboardInterrupt: tui.do_quit()