sbsv2/raptor/python/raptor_make.py
branchwip
changeset 330 f3b3d9f9a008
parent 197 dc0508fdfc44
child 226 59f343577f92
--- a/sbsv2/raptor/python/raptor_make.py	Mon Feb 15 16:01:55 2010 +0000
+++ b/sbsv2/raptor/python/raptor_make.py	Wed Feb 17 17:03:27 2010 +0000
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+# Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
 # All rights reserved.
 # This component and the accompanying materials are made available
 # under the terms of the License "Eclipse Public License v1.0"
@@ -33,18 +33,19 @@
 from xml.sax.saxutils import escape
 
 
+class BadMakeEngineException(Exception):
+	pass
+
 # raptor_make module classes
 
 class MakeEngine(object):
 
-	def __init__(self, Raptor):
+	def __init__(self, Raptor, engine="make_engine"):
 		self.raptor = Raptor
 		self.valid = True
 		self.descrambler = None
 		self.descrambler_started = False
 
-		engine = Raptor.makeEngine
-		
 		# look for an alias first as this gives end-users a chance to modify
 		# the shipped variant rather than completely replacing it.
 		if engine in Raptor.cache.aliases:
@@ -52,8 +53,10 @@
 		elif engine in Raptor.cache.variants:
 			avar = Raptor.cache.FindNamedVariant(engine)
 		else:
-			Raptor.Error("No settings found for build engine '%s'", engine)
-			return
+			raise BadMakeEngineException("'%s' does not appear to be a make engine - no settings found for it" % engine)
+
+		if not avar.isDerivedFrom("make_engine", Raptor.cache):
+			raise BadMakeEngineException("'%s' is not a build engine (it's a variant but it does not extend 'make_engine')" % engine)
 					
 		# find the variant and extract the values
 		try:
@@ -105,14 +108,13 @@
 				self.selectors = []
 
 		except KeyError:
-			Raptor.Error("Bad '%s' configuration found.", engine)
 			self.valid = False
-			return
+			raise BadMakeEngineException("Bad '%s' configuration found." % engine)
 
 		# there must at least be a build command...
 		if not self.buildCommand:
-				Raptor.Error("No build command for '%s'", engine)
-				self.valid = False
+			self.valid = False
+			raise BadMakeEngineException("No build command for '%s'"% engine)
 
 
 		if self.usetalon: