Index: llvm/utils/lit/lit/llvm/config.py =================================================================== --- llvm/utils/lit/lit/llvm/config.py +++ llvm/utils/lit/lit/llvm/config.py @@ -124,10 +124,9 @@ def norm(x): return os.path.normcase(os.path.normpath(x)) - current_paths = self.config.environment.get(variable, None) - if current_paths: - current_paths = current_paths.split(os.path.pathsep) - paths = [norm(p) for p in current_paths] + paths = self.config.environment.get(variable, None) + if paths: + paths = paths.split(os.path.pathsep) else: paths = [] @@ -137,9 +136,8 @@ for p in reversed(paths_to_add): # Move it to the front if it already exists, otherwise insert # it at the beginning. - p = norm(p) try: - paths.remove(p) + paths.pop(map(norm, paths).index(norm(p))) except ValueError: pass paths = [p] + paths Index: llvm/utils/lit/lit/util.py =================================================================== --- llvm/utils/lit/lit/util.py +++ llvm/utils/lit/lit/util.py @@ -223,7 +223,7 @@ # Check for absolute match first. if os.path.isabs(command) and os.path.isfile(command): - return os.path.normcase(os.path.normpath(command)) + return os.path.normpath(command) # Would be nice if Python had a lib function for this. if not paths: @@ -241,7 +241,7 @@ for ext in pathext: p = os.path.join(path, command + ext) if os.path.exists(p) and not os.path.isdir(p): - return os.path.normcase(os.path.normpath(p)) + return os.path.normpath(p) return None