sbsv2/raptor/python/raptor_data.py
branchwip
changeset 60 28ee654acf42
parent 5 593a8820b912
child 61 f520dfd22025
--- a/sbsv2/raptor/python/raptor_data.py	Wed Dec 09 14:14:31 2009 +0000
+++ b/sbsv2/raptor/python/raptor_data.py	Wed Dec 09 18:30:33 2009 +0000
@@ -722,15 +722,24 @@
 	def Apply(self, oldValue):
 		try:
 			value = os.environ[self.name]
-
-			# if this value is a "path" or a "tool" then we need to make sure
-			# it is a proper absolute path in our preferred format.
-			if value and (self.type == "path" or self.type == "tool"):
-				try:
-					path = generic_path.Path(value)
-					value = str(path.Absolute())
-				except ValueError,e:
-					raise BadToolValue("the environment variable %s is incorrect: %s" % (self.name, str(e)))
+			
+			if value:
+				# if this value ends in an un-escaped backslash, then it will be treated as a line continuation character in makefile
+				# parsing - un-escaped backslashes at the end of values are therefore escaped
+				if value.endswith('\\'):
+					# an odd number of backslashes means there's one to escape
+					count = len(value) - len(value.rstrip('\\'))
+					if count % 2:
+						value += '\\'
+	
+				# if this value is a "path" or a "tool" then we need to make sure
+				# it is a proper absolute path in our preferred format.
+				if self.type == "path" or self.type == "tool":
+					try:
+						path = generic_path.Path(value)
+						value = str(path.Absolute())
+					except ValueError,e:
+						raise BadToolValue("the environment variable %s is incorrect: %s" % (self.name, str(e)))
 		except KeyError:
 			if self.default != None:
 				value = self.default