* api.init(): do UI initialization too
This commit is contained in:
@@ -21,3 +21,6 @@ class Error(Exception):
|
|||||||
class Exception(Exception):
|
class Exception(Exception):
|
||||||
"""Class of exceptions that must be caught and handled within PISI"""
|
"""Class of exceptions that must be caught and handled within PISI"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
# FIXME: can't do this due to name clashes in config and other singletons booo
|
||||||
|
#from pisi.api import *
|
||||||
|
|||||||
+21
-10
@@ -18,6 +18,27 @@ if ver[0] <= 2 and ver[1] < 4:
|
|||||||
from sets import Set as set
|
from sets import Set as set
|
||||||
|
|
||||||
import pisi
|
import pisi
|
||||||
|
|
||||||
|
class Error(pisi.Error):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def init(database = True, options = None, ui = None ):
|
||||||
|
import pisi.config
|
||||||
|
import pisi.ui
|
||||||
|
"""Initialize PiSi subsystem"""
|
||||||
|
pisi.config.config = pisi.config.Config(options)
|
||||||
|
if ui is None:
|
||||||
|
if options:
|
||||||
|
pisi.ui.ui = pisi.ui.CLI(options.debug)
|
||||||
|
else:
|
||||||
|
pisi.ui.ui = pisi.ui.CLI()
|
||||||
|
else:
|
||||||
|
pisi.ui.ui = ui
|
||||||
|
# initialize repository databases
|
||||||
|
if database:
|
||||||
|
from pisi.repodb import repodb
|
||||||
|
repodb.init_dbs()
|
||||||
|
|
||||||
from pisi.config import config
|
from pisi.config import config
|
||||||
from pisi.constants import const
|
from pisi.constants import const
|
||||||
from pisi.ui import ui
|
from pisi.ui import ui
|
||||||
@@ -31,16 +52,6 @@ from pisi.repodb import repodb
|
|||||||
from pisi.installdb import installdb
|
from pisi.installdb import installdb
|
||||||
from pisi.index import Index
|
from pisi.index import Index
|
||||||
|
|
||||||
class Error(pisi.Error):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def init(database = True):
|
|
||||||
"""Kickstart PISI subsystem"""
|
|
||||||
# initialize repository databases
|
|
||||||
if database:
|
|
||||||
from pisi.repodb import repodb
|
|
||||||
repodb.init_dbs()
|
|
||||||
|
|
||||||
|
|
||||||
def install(packages):
|
def install(packages):
|
||||||
"""install a list of packages (either files/urls, or names)"""
|
"""install a list of packages (either files/urls, or names)"""
|
||||||
|
|||||||
@@ -58,12 +58,6 @@ class Command(object):
|
|||||||
self.commonopts()
|
self.commonopts()
|
||||||
(self.options, self.args) = self.parser.parse_args()
|
(self.options, self.args) = self.parser.parse_args()
|
||||||
self.args.pop(0) # exclude command arg
|
self.args.pop(0) # exclude command arg
|
||||||
|
|
||||||
import pisi
|
|
||||||
|
|
||||||
# initialize PiSi
|
|
||||||
pisi.config.config = pisi.config.Config(self.options)
|
|
||||||
pisi.ui.ui = pisi.ui.CLI(self.options.debug)
|
|
||||||
|
|
||||||
self.check_auth_info()
|
self.check_auth_info()
|
||||||
|
|
||||||
@@ -119,11 +113,11 @@ class Command(object):
|
|||||||
"""initialize PiSi components"""
|
"""initialize PiSi components"""
|
||||||
|
|
||||||
# NB: command imports here or in the command class run fxns
|
# NB: command imports here or in the command class run fxns
|
||||||
|
import pisi
|
||||||
import pisi.api
|
import pisi.api
|
||||||
|
pisi.api.init(database, self.options)
|
||||||
from pisi.ui import ui
|
from pisi.ui import ui
|
||||||
|
|
||||||
pisi.api.init(database)
|
|
||||||
|
|
||||||
def finalize(self):
|
def finalize(self):
|
||||||
"""do cleanup work for PiSi components"""
|
"""do cleanup work for PiSi components"""
|
||||||
pass
|
pass
|
||||||
|
|||||||
Reference in New Issue
Block a user