[llvm] [lit][bazel] Fall back to a default PATHEXT when the variable is unset (PR #217416)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 19 17:28:55 PDT 2026
https://github.com/UebelAndre updated https://github.com/llvm/llvm-project/pull/217416
>From 38dd4a3b832903de200f0cd52e9fa67cd51ec6c8 Mon Sep 17 00:00:00 2001
From: UebelAndre <github at uebelandre.com>
Date: Wed, 19 Aug 2026 11:00:14 -0700
Subject: [PATCH] [lit][bazel] Fall back to a default PATHEXT when the variable
is unset
---
llvm/utils/lit/lit/util.py | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/llvm/utils/lit/lit/util.py b/llvm/utils/lit/lit/util.py
index 8ab109fe15d45..5ca158f358cd8 100644
--- a/llvm/utils/lit/lit/util.py
+++ b/llvm/utils/lit/lit/util.py
@@ -11,6 +11,7 @@
import sys
import threading
+
def pythonize_bool(value):
if value is None:
return False
@@ -43,10 +44,9 @@ def usable_core_count():
return n
-def abs_path_preserve_drive(path):
- """Return the absolute path without resolving drive mappings on Windows.
- """
+def abs_path_preserve_drive(path):
+ """Return the absolute path without resolving drive mappings on Windows."""
if platform.system() == "Windows":
# Windows has limitations on path length (MAX_PATH) that
# can be worked around using substitute drives, which map
@@ -131,6 +131,10 @@ def which(command, paths=None):
# On Cygwin, 'PATHEXT' may exist but it should not be used.
if os.pathsep == ";":
pathext = os.environ.get("PATHEXT", "").split(";")
+ # If PATHEXT was stripped from the environment then use
+ # a sane fallback so binaries can still be located.
+ if not any(pathext):
+ pathext = [".COM", ".EXE", ".BAT", ".CMD"]
else:
pathext = [""]
@@ -333,7 +337,7 @@ def addAIXVersion(target_triple):
"""Add the AIX version to the given target triple,
e.g. powerpc64-ibm-aix7.2.5.6
"""
- os_cmd = "oslevel -s | awk -F\'-\' \'{printf \"%.1f.%d.%d\", $1/1000, $2, $3}\'"
+ os_cmd = "oslevel -s | awk -F'-' '{printf \"%.1f.%d.%d\", $1/1000, $2, $3}'"
os_version = subprocess.run(os_cmd, capture_output=True, shell=True).stdout.decode()
return re.sub("aix", "aix" + os_version, target_triple)
More information about the llvm-commits
mailing list