sbsv2/raptor/python/raptor_data.py
branchfix
changeset 400 554cc189839f
parent 374 96629a6f26e4
child 498 564986768b79
equal deleted inserted replaced
390:421e376bfce4 400:554cc189839f
   728 	def Apply(self, oldValue):
   728 	def Apply(self, oldValue):
   729 		try:
   729 		try:
   730 			value = os.environ[self.name]
   730 			value = os.environ[self.name]
   731 			
   731 			
   732 			if value:
   732 			if value:
   733 				# if this value is a "path" or a "tool" then we need to make sure
   733 				if self.type in ["path", "tool", "toolchainpath"]:
   734 				# it is a proper absolute path in our preferred format.
   734 					# if this value is some sort of path or tool then we need to make sure
   735 				if self.type == "path" or self.type == "tool":
   735 					# it is a proper absolute path in our preferred format.
   736 					try:
   736 					try:
   737 						path = generic_path.Path(value)
   737 						path = generic_path.Path(value)
   738 						value = str(path.Absolute())
   738 						value = str(path.Absolute())
   739 					except ValueError,e:
   739 					except ValueError,e:
   740 						raise BadToolValue("the environment variable %s is incorrect: %s" % (self.name, str(e)))				
   740 						raise BadToolValue("the environment variable %s is incorrect: %s" % (self.name, str(e)))
   741 				# if this value ends in an un-escaped backslash, then it will be treated as a line continuation character
   741 					
   742 				# in makefile parsing - un-escaped backslashes at the end of values are therefore escaped
   742 					if self.type in ["tool", "toolchainpath"]:
       
   743 						# if  we're dealing with tool-related values, then make sure that we can get "safe"
       
   744 						# versions if they contain spaces - if we can't, that's an error, as they won't
       
   745 						# survive full usage in the toolcheck or when used and/or referenced in FLMs						
       
   746 						if ' ' in value:
       
   747 							path = generic_path.Path(value)
       
   748 							spaceSafeValue = path.GetSpaceSafePath()
       
   749 						
       
   750 							if not spaceSafeValue:
       
   751 								raise BadToolValue("the environment variable %s is incorrect - it is a '%s' type but contains spaces that cannot be neutralised: %s" % (self.name, self.type, value))
       
   752 							
       
   753 							value = spaceSafeValue	
   743 				elif value.endswith('\\'):
   754 				elif value.endswith('\\'):
   744 					# an odd number of backslashes means there's one to escape
   755 					# if this value ends in an un-escaped backslash, then it will be treated as a line continuation character
   745 					count = len(value) - len(value.rstrip('\\'))
   756 					# in makefile parsing - un-escaped backslashes at the end of values are therefore escaped					
       
   757 					count = len(value) - len(value.rstrip('\\'))	# an odd number of backslashes means there's one to escape
   746 					if count % 2:
   758 					if count % 2:
   747 						value += '\\'	
   759 						value += '\\'	
   748 		except KeyError:
   760 		except KeyError:
   749 			if self.default != None:
   761 			if self.default != None:
   750 				value = self.default
   762 				value = self.default