sbsv2/raptor/python/raptor_xml.py
changeset 28 b8fa7dfeeaa1
parent 18 de5b887c98f7
equal deleted inserted replaced
27:3a31ca4b29c4 28:b8fa7dfeeaa1
   315 		component = SystemModelComponent(aBldInfFile, layer, containers, self.__SystemDefinitionFile, self.__SystemDefinitionBase, self.__Version)
   315 		component = SystemModelComponent(aBldInfFile, layer, containers, self.__SystemDefinitionFile, self.__SystemDefinitionBase, self.__Version)
   316 
   316 
   317 		return component
   317 		return component
   318 
   318 
   319 	def __GetEffectiveLayer(self, aElement):
   319 	def __GetEffectiveLayer(self, aElement):
   320 		#' return the ID of the topmost item which has an ID. For 1.x and 2.x, this will always be layer, for 3.x, it will be the topmost ID'd element in the file
   320 		# return the ID of the topmost item which has an ID. For 1.x and 2.x, this will always be layer,
   321 		# never call this on the root element
   321 		# for 3.x, it will be the topmost ID'd element in the file never call this on the root element
   322 		if aElement.parentNode.hasAttribute(self.__IdAttribute):
   322 		if aElement.parentNode.hasAttribute(self.__IdAttribute):
   323 			return self.__GetEffectiveLayer(aElement.parentNode)
   323 			return self.__GetEffectiveLayer(aElement.parentNode)
   324 		elif aElement.hasAttribute(self.__IdAttribute):
   324 		elif aElement.hasAttribute(self.__IdAttribute):
   325 			return aElement.getAttribute(self.__IdAttribute)
   325 			return aElement.getAttribute(self.__IdAttribute)
   326 		return ""
   326 		return ""
   335 			if name:
   335 			if name:
   336 				aContainers[parent.tagName] = name
   336 				aContainers[parent.tagName] = name
   337 
   337 
   338 			self.__GetElementContainers(parent, aContainers)
   338 			self.__GetElementContainers(parent, aContainers)
   339 
   339 
       
   340 	def __ProcessSystemModelMetaElement(self, aElement):
       
   341 		# stub method - may deal with metadata elements at some point in the future
       
   342 		return
       
   343 
   340 	def __ProcessSystemModelElement(self, aElement):
   344 	def __ProcessSystemModelElement(self, aElement):
   341 		"""Search for XML <unit/> elements with 'bldFile' attributes and resolve concrete bld.inf locations
   345 		"""Search for XML <unit/> elements with 'bldFile' attributes and resolve concrete bld.inf locations
   342 		with an appreciation of different schema versions."""
   346 		with an appreciation of different schema versions."""
       
   347 
       
   348 		# Metadata elements are processed separately - there are no further child nodes
       
   349 		# to process in this context
       
   350 		if aElement.tagName == "meta" :
       
   351 			return self.__ProcessSystemModelMetaElement(aElement)
   343 
   352 
   344 		# The effective "layer" is the item whose parent does not have an id (or name in 2.x and earlier)
   353 		# The effective "layer" is the item whose parent does not have an id (or name in 2.x and earlier)
   345 		if not aElement.parentNode.hasAttribute(self.__IdAttribute) :
   354 		if not aElement.parentNode.hasAttribute(self.__IdAttribute) :
   346 			currentLayer = aElement.getAttribute(self.__IdAttribute)
   355 			currentLayer = aElement.getAttribute(self.__IdAttribute)
   347 
   356 
   378 				if self.__Version['MAJOR'] < 3:
   387 				if self.__Version['MAJOR'] < 3:
   379 					# absolute paths are not changed by root var in 1.x and 2.x
   388 					# absolute paths are not changed by root var in 1.x and 2.x
   380 					if not group.isAbsolute() and bldInfRoot:
   389 					if not group.isAbsolute() and bldInfRoot:
   381 						group = generic_path.Join(bldInfRoot, group)
   390 						group = generic_path.Join(bldInfRoot, group)
   382 				else:
   391 				else:
   383 					# only absolute paths are changed by root var in 3.x
   392 					# relative paths for v3
   384 					if group.isAbsolute() and bldInfRoot:
   393 					if not group.isAbsolute():
       
   394 						group = generic_path.Join(generic_path.Join(self.__SystemDefinitionFile).Dir(),group)
       
   395 					# absolute paths for v3
       
   396 					# are relative to bldInfRoot if set, or relative to the drive root otherwise
       
   397 					elif bldInfRoot:
   385 						group = generic_path.Join(bldInfRoot, group)
   398 						group = generic_path.Join(bldInfRoot, group)
   386 
   399 
   387 				bldinf = generic_path.Join(group, "bld.inf").FindCaseless()
   400 				bldinf = generic_path.Join(group, "bld.inf").FindCaseless()
   388 
   401 
   389 				if bldinf == None:
   402 				if bldinf == None:
   390 					# recording layers containing non existent bld.infs
   403 					# recording layers containing non existent bld.infs
   391 					bldinfname = group.GetLocalString()
   404 					bldinfname = group.GetLocalString()
   392 					bldinfname = bldinfname + 'bld.inf'
   405 					bldinfname = bldinfname+'/'+'bld.inf'
   393 					layer = self.__GetEffectiveLayer(aElement)
   406 					layer = self.__GetEffectiveLayer(aElement)
   394 					if not layer in self.__MissingBldInfs:
   407 					if not layer in self.__MissingBldInfs:
   395 						self.__MissingBldInfs[layer]=[]
   408 						self.__MissingBldInfs[layer]=[]
   396 					self.__MissingBldInfs[layer].append(bldinfname)
   409 					self.__MissingBldInfs[layer].append(bldinfname)
   397 
   410