--- a/sbsv2/raptor/python/raptor.py Wed Apr 14 14:40:58 2010 +0100
+++ b/sbsv2/raptor/python/raptor.py Tue Apr 27 16:46:48 2010 +0100
@@ -448,9 +448,10 @@
created by the Main function. When operated by an IDE several Raptor
objects may be created and operated at the same time."""
-
+ # mission enumeration
M_BUILD = 1
- M_VERSION = 2
+ M_QUERY = 2
+ M_VERSION = 3
def __init__(self, home = None):
@@ -520,7 +521,8 @@
self.noDependInclude = False
self.noDependGenerate = False
self.projects = set()
-
+ self.queries = []
+
self.cache = raptor_cache.Cache(self)
self.override = {env: str(self.home)}
self.targets = []
@@ -717,6 +719,11 @@
self.projects.add(projectName.lower())
return True
+ def AddQuery(self, q):
+ self.queries.append(q)
+ self.mission = Raptor.M_QUERY
+ return True
+
def FilterList(self, value):
self.filterList = value
return True
@@ -1219,6 +1226,31 @@
return layers
+ def Query(self):
+ "process command-line queries."
+
+ if self.mission != Raptor.M_QUERY:
+ return 0
+
+ # establish an object cache based on the current settings
+ self.LoadCache()
+
+ # our "self" is a valid object for initialising an API Context
+ import raptor_api
+ api = raptor_api.Context(self)
+
+ print "<sbs version='%s'>" % raptor_version.fullversion()
+
+ for q in self.queries:
+ try:
+ print api.StringQuery(q)
+
+ except Exception, e:
+ self.Error("exception '%s' with query '%s'", str(e), q)
+
+ print "</sbs>"
+ return self.errorCode
+
def Build(self):
if self.mission != Raptor.M_BUILD: # help or version requested instead.
@@ -1356,6 +1388,9 @@
# object which represents a build
b = Raptor.CreateCommandlineBuild(argv)
+ if b.mission == Raptor.M_QUERY:
+ return b.Query()
+
return b.Build()