def init(database = True, options = None, ui = None, comar = True): """Initialize PiSi subsystem""" import pisi.config ctx.config = pisi.config.Config(options) # TODO: this is definitely not dynamic beyond this point! ctx.comar = comar and not ctx.config.get_option('ignore_comar') if ui is None: if options: pisi.context.ui = pisi.cli.CLI(options.debug) else: pisi.context.ui = pisi.cli.CLI() else: pisi.context.ui = ui # initialize repository databases if database: shelve.init_dbenv() ctx.repodb = pisi.repodb.init() ctx.installdb = pisi.installdb.init() ctx.filesdb = pisi.files.FilesDB() ctx.componentdb = pisi.component.ComponentDB() packagedb.init_db() pisi.sourcedb.init() pisi.search.init(['summary', 'description'], ['en', 'tr']) else: ctx.repodb = None ctx.installdb = None ctx.filesdb = None ctx.componentdb = None ctx.ui.debug('PISI API initialized') ctx.initialized = True
def init(database=True, options=None, ui=None, comar=True): """Initialize PiSi subsystem""" import pisi.config ctx.config = pisi.config.Config(options) # TODO: this is definitely not dynamic beyond this point! ctx.comar = comar and not ctx.config.get_option("ignore_comar") if ui is None: if options: pisi.context.ui = pisi.cli.CLI(options.debug) else: pisi.context.ui = pisi.cli.CLI() else: pisi.context.ui = ui # initialize repository databases if database: ctx.repodb = pisi.repodb.init() ctx.installdb = pisi.installdb.init() ctx.filesdb = pisi.files.FilesDB() packagedb.init_db() pisi.sourcedb.init() else: ctx.repodb = None ctx.installdb = None ctx.filesdb = None ctx.ui.debug("PISI API initialized") ctx.initialized = True
def init(database=True, write=True, options=None, ui=None, comar=True, stdout=None, stderr=None): """Initialize PiSi subsystem""" # UI comes first if ui is None: from pisi.cli import CLI if options: ctx.ui = CLI(options.debug) else: ctx.ui = CLI() else: ctx.ui = ui # If given define stdout and stderr. Needed by buildfarm currently # but others can benefit from this too. if stdout: ctx.stdout = stdout if stderr: ctx.stderr = stderr import pisi.config ctx.config = pisi.config.Config(options) # TODO: this is definitely not dynamic beyond this point! ctx.comar = comar and not ctx.config.get_option("ignore_comar") # initialize repository databases ctx.database = database if database: shelve.init_dbenv(write=write) ctx.repodb = pisi.repodb.init() ctx.installdb = pisi.installdb.init() ctx.filesdb = pisi.files.FilesDB() ctx.componentdb = pisi.component.ComponentDB() ctx.packagedb = packagedb.init_db() ctx.sourcedb = pisi.sourcedb.init() pisi.search.init(["summary", "description"], ["en", "tr"]) else: ctx.repodb = None ctx.installdb = None ctx.filesdb = None ctx.componentdb = None ctx.packagedb = None ctx.sourcedb = None ctx.ui.debug("PISI API initialized") ctx.initialized = True
def init(database = True, write = True, options = None, ui = None, comar = True, stdout = None, stderr = None, comar_sockname = None): """Initialize PiSi subsystem""" # UI comes first if ui is None: from pisi.cli import CLI if options: ctx.ui = CLI(options.debug, options.verbose) else: ctx.ui = CLI() else: ctx.ui = ui if os.access('/var/log', os.W_OK): handler = logging.handlers.RotatingFileHandler('/var/log/pisi.log') #handler.setLevel(logging.DEBUG) formatter = logging.Formatter('%(asctime)-12s: %(levelname)-8s %(message)s') handler.setFormatter(formatter) ctx.log = logging.getLogger('pisi') ctx.log.addHandler(handler) ctx.loghandler = handler ctx.log.setLevel(logging.DEBUG) else: ctx.log = None # If given define stdout and stderr. Needed by buildfarm currently # but others can benefit from this too. if stdout: ctx.stdout = stdout if stderr: ctx.stderr = stderr import pisi.config ctx.config = pisi.config.Config(options) # TODO: this is definitely not dynamic beyond this point! ctx.comar = comar and not ctx.config.get_option('ignore_comar') # This is for YALI, used in comariface.py:make_com() ctx.comar_sockname = comar_sockname # initialize repository databases ctx.database = database if database: shelve.init_dbenv(write=write) ctx.repodb = pisi.repodb.init() ctx.installdb = pisi.installdb.init() ctx.filesdb = pisi.files.FilesDB() ctx.componentdb = pisi.component.ComponentDB() ctx.packagedb = packagedb.init_db() ctx.sourcedb = pisi.sourcedb.init() pisi.search.init(['summary', 'description'], ['en', 'tr']) else: ctx.repodb = None ctx.installdb = None ctx.filesdb = None ctx.componentdb = None ctx.packagedb = None ctx.sourcedb = None ctx.ui.debug('PiSi API initialized') ctx.initialized = True
def init( database=True, write=True, options=None, ui=None, comar=True, #stdout = None, stderr = None, stdout=sys.stdout, stderr=sys.stderr, comar_sockname=None): """Initialize PiSi subsystem""" # UI comes first if ui is None: from pisi.cli import CLI if options: ctx.ui = CLI(options.debug, options.verbose) else: ctx.ui = CLI() else: ctx.ui = ui if os.access('/var/log', os.W_OK): handler = logging.handlers.RotatingFileHandler('/var/log/pisi.log') #handler.setLevel(logging.DEBUG) formatter = logging.Formatter( '%(asctime)-12s: %(levelname)-8s %(message)s') handler.setFormatter(formatter) ctx.log = logging.getLogger('pisi') ctx.log.addHandler(handler) ctx.loghandler = handler ctx.log.setLevel(logging.DEBUG) else: ctx.log = None # If given define stdout and stderr. Needed by buildfarm currently # but others can benefit from this too. if stdout: ctx.stdout = stdout if stderr: ctx.stderr = stderr import pisi.config ctx.config = pisi.config.Config(options) # TODO: this is definitely not dynamic beyond this point! ctx.comar = comar and not ctx.config.get_option('ignore_comar') # This is for YALI, used in comariface.py:make_com() ctx.comar_sockname = comar_sockname # initialize repository databases ctx.database = database if database: shelve.init_dbenv(write=write) ctx.repodb = pisi.repodb.init() ctx.installdb = pisi.installdb.init() ctx.filesdb = pisi.files.FilesDB() ctx.componentdb = pisi.component.ComponentDB() ctx.packagedb = packagedb.init_db() ctx.sourcedb = pisi.sourcedb.init() pisi.search.init(['summary', 'description'], ['en', 'tr']) else: ctx.repodb = None ctx.installdb = None ctx.filesdb = None ctx.componentdb = None ctx.packagedb = None ctx.sourcedb = None ctx.ui.debug('PISI API initialized') ctx.initialized = True