sbsv2/raptor/python/raptor_make.py
branchwip
changeset 330 f3b3d9f9a008
parent 197 dc0508fdfc44
child 226 59f343577f92
equal deleted inserted replaced
329:b2c00b774e4f 330:f3b3d9f9a008
     1 #
     1 #
     2 # Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 # Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 # All rights reserved.
     3 # All rights reserved.
     4 # This component and the accompanying materials are made available
     4 # This component and the accompanying materials are made available
     5 # under the terms of the License "Eclipse Public License v1.0"
     5 # under the terms of the License "Eclipse Public License v1.0"
     6 # which accompanies this distribution, and is available
     6 # which accompanies this distribution, and is available
     7 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
    31 import traceback
    31 import traceback
    32 import sys
    32 import sys
    33 from xml.sax.saxutils import escape
    33 from xml.sax.saxutils import escape
    34 
    34 
    35 
    35 
       
    36 class BadMakeEngineException(Exception):
       
    37 	pass
       
    38 
    36 # raptor_make module classes
    39 # raptor_make module classes
    37 
    40 
    38 class MakeEngine(object):
    41 class MakeEngine(object):
    39 
    42 
    40 	def __init__(self, Raptor):
    43 	def __init__(self, Raptor, engine="make_engine"):
    41 		self.raptor = Raptor
    44 		self.raptor = Raptor
    42 		self.valid = True
    45 		self.valid = True
    43 		self.descrambler = None
    46 		self.descrambler = None
    44 		self.descrambler_started = False
    47 		self.descrambler_started = False
    45 
    48 
    46 		engine = Raptor.makeEngine
       
    47 		
       
    48 		# look for an alias first as this gives end-users a chance to modify
    49 		# look for an alias first as this gives end-users a chance to modify
    49 		# the shipped variant rather than completely replacing it.
    50 		# the shipped variant rather than completely replacing it.
    50 		if engine in Raptor.cache.aliases:
    51 		if engine in Raptor.cache.aliases:
    51 			avar = Raptor.cache.FindNamedAlias(engine)
    52 			avar = Raptor.cache.FindNamedAlias(engine)
    52 		elif engine in Raptor.cache.variants:
    53 		elif engine in Raptor.cache.variants:
    53 			avar = Raptor.cache.FindNamedVariant(engine)
    54 			avar = Raptor.cache.FindNamedVariant(engine)
    54 		else:
    55 		else:
    55 			Raptor.Error("No settings found for build engine '%s'", engine)
    56 			raise BadMakeEngineException("'%s' does not appear to be a make engine - no settings found for it" % engine)
    56 			return
    57 
       
    58 		if not avar.isDerivedFrom("make_engine", Raptor.cache):
       
    59 			raise BadMakeEngineException("'%s' is not a build engine (it's a variant but it does not extend 'make_engine')" % engine)
    57 					
    60 					
    58 		# find the variant and extract the values
    61 		# find the variant and extract the values
    59 		try:
    62 		try:
    60 			units = avar.GenerateBuildUnits(Raptor.cache)
    63 			units = avar.GenerateBuildUnits(Raptor.cache)
    61 			evaluator = Raptor.GetEvaluator( None, units[0] , gathertools=True)
    64 			evaluator = Raptor.GetEvaluator( None, units[0] , gathertools=True)
   103 			except KeyError:
   106 			except KeyError:
   104 				Raptor.Error("%s.selector.iface, %s.selector.target not found in make engine configuration", name, name)
   107 				Raptor.Error("%s.selector.iface, %s.selector.target not found in make engine configuration", name, name)
   105 				self.selectors = []
   108 				self.selectors = []
   106 
   109 
   107 		except KeyError:
   110 		except KeyError:
   108 			Raptor.Error("Bad '%s' configuration found.", engine)
       
   109 			self.valid = False
   111 			self.valid = False
   110 			return
   112 			raise BadMakeEngineException("Bad '%s' configuration found." % engine)
   111 
   113 
   112 		# there must at least be a build command...
   114 		# there must at least be a build command...
   113 		if not self.buildCommand:
   115 		if not self.buildCommand:
   114 				Raptor.Error("No build command for '%s'", engine)
   116 			self.valid = False
   115 				self.valid = False
   117 			raise BadMakeEngineException("No build command for '%s'"% engine)
   116 
   118 
   117 
   119 
   118 		if self.usetalon:
   120 		if self.usetalon:
   119 			talon_settings="""
   121 			talon_settings="""
   120 TALON_SHELL:=%s
   122 TALON_SHELL:=%s