1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 18:42:46 +02:00

[lit] Reverse path list when updating environment vars.

Bug pointed out by EricWF.  This would construct a path where
items would be added in the wrong order, potentially leading
to using the wrong tools for testing.

llvm-svn: 313765
This commit is contained in:
Zachary Turner 2017-09-20 17:08:20 +00:00
parent a3baf1b07f
commit 2d0987456a

View File

@ -106,7 +106,10 @@ class LLVMConfig(object):
current_paths = self.config.environment.get(variable, "") current_paths = self.config.environment.get(variable, "")
current_paths = current_paths.split(os.path.pathsep) current_paths = current_paths.split(os.path.pathsep)
paths = [norm(p) for p in current_paths] paths = [norm(p) for p in current_paths]
for p in paths_to_add: # If we are passed a list [a b c], then iterating this list forwards
# and adding each to the beginning would result in b c a. So we
# need to iterate in reverse to end up with the original ordering.
for p in reversed(paths_to_add):
# Move it to the front if it already exists, otherwise insert it at the # Move it to the front if it already exists, otherwise insert it at the
# beginning. # beginning.
p = norm(p) p = norm(p)