diff --git a/pisi/api.py b/pisi/api.py index 1f5dda4f..195ba9c8 100644 --- a/pisi/api.py +++ b/pisi/api.py @@ -40,13 +40,13 @@ class Error(pisi.Error): pass -def init(database = True, options = None, ui = None ): +def init(database = True, options = None, ui = None, comar = True): """Initialize PiSi subsystem""" import pisi.config ctx.config = pisi.config.Config(options) - if not ctx.config.get_option('ignore_comar'): + if comar and not ctx.config.get_option('ignore_comar'): # FIXME: just try for others (that don't use comar) try: import comar diff --git a/pisi/cli/commands.py b/pisi/cli/commands.py index 3534249e..c0f221bf 100644 --- a/pisi/cli/commands.py +++ b/pisi/cli/commands.py @@ -52,12 +52,12 @@ class Command(object): def __init__(self): # now for the real parser import pisi + self.comar = False self.parser = OptionParser(usage=getattr(self, "__doc__"), version="%prog " + pisi.__version__) self.options() self.commonopts() (self.options, self.args) = self.parser.parse_args() - self.override_options() self.args.pop(0) # exclude command arg self.check_auth_info() @@ -87,12 +87,6 @@ class Command(object): options function it will be called""" pass - def override_options(self): - # if ignore_comar is not defined, it is True, where it is defined - # its default is False. Confused? Don't get confused, it's correct :) - if not hasattr(self.options, 'ignore_comar'): - self.options.ignore_comar = True - def check_auth_info(self): username = self.options.username password = self.options.password @@ -121,7 +115,8 @@ class Command(object): # NB: command imports here or in the command class run fxns import pisi.api - pisi.api.init(database, self.options) + pisi.api.init(database = database, options = self.options, + comar = self.comar) def finalize(self): """do cleanup work for PiSi components""" @@ -281,6 +276,7 @@ class PackageOp(Command): """Abstract package operation command""" def __init__(self): super(PackageOp, self).__init__() + self.comar = True def options(self): p = self.parser diff --git a/tests/archivetests.py b/tests/archivetests.py index 7acbbd2f..3e147d48 100644 --- a/tests/archivetests.py +++ b/tests/archivetests.py @@ -25,7 +25,7 @@ from pisi import uri class ArchiveFileTestCase(unittest.TestCase): def setUp(self): - pisi.api.init() + pisi.api.init(comar = False) def testUnpackTar(self): bctx = BuildContext("tests/popt/pspec.xml") diff --git a/tests/fetchertests.py b/tests/fetchertests.py index 2cf232f1..d791b236 100644 --- a/tests/fetchertests.py +++ b/tests/fetchertests.py @@ -20,7 +20,7 @@ from pisi import uri class FetcherTestCase(unittest.TestCase): def setUp(self): - pisi.api.init() + pisi.api.init(database = False, comar = False) self.spec = SpecFile() self.spec.read("tests/popt/pspec.xml") diff --git a/tests/installdbtests.py b/tests/installdbtests.py index 9a0c4b6e..93622b94 100644 --- a/tests/installdbtests.py +++ b/tests/installdbtests.py @@ -19,7 +19,7 @@ from pisi import util class InstallDBTestCase(unittest.TestCase): def setUp(self): - pisi.api.init() + pisi.api.init(database = True, comar = False) self.installdb = ctx.installdb def testRemoveDummy(self): diff --git a/tests/packagedbtests.py b/tests/packagedbtests.py index 50ba0375..5b72f561 100644 --- a/tests/packagedbtests.py +++ b/tests/packagedbtests.py @@ -21,7 +21,7 @@ class PackageDBTestCase(unittest.TestCase): def setUp(self): # setUp will be called for each test individually - pisi.api.init() + pisi.api.init(comar = False) self.spec = SpecFile() self.spec.read('tests/popt/pspec.xml') diff --git a/tests/sourcedbtests.py b/tests/sourcedbtests.py index 02edee3e..0a836c69 100644 --- a/tests/sourcedbtests.py +++ b/tests/sourcedbtests.py @@ -20,7 +20,7 @@ from pisi.specfile import SpecFile class SourceDBTestCase(unittest.TestCase): def setUp(self): - pisi.api.init() + pisi.api.init(comar = False) self.sourcedb = pisi.sourcedb.init() self.spec = SpecFile() diff --git a/tests/xmlfiletests.py b/tests/xmlfiletests.py index 1af3e57f..f465398d 100644 --- a/tests/xmlfiletests.py +++ b/tests/xmlfiletests.py @@ -24,7 +24,7 @@ from pisi.xmlext import * class XmlFileTestCase(unittest.TestCase): def setUp(self): - pisi.api.init(False) + pisi.api.init(database = False, comar = False) def testMetaClass(self):