Skip to content

Commit f07ddbc

Browse files
[lldb] build failure for LLDB_PYTHON_EXE_RELATIVE_PATH on greendragon
see: https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/38387/console ``` Could not find a relative path to sys.executable under sys.prefix tried: /usr/local/opt/python/bin/python3.7 tried: /usr/local/opt/python/bin/../Frameworks/Python.framework/Versions/3.7/bin/python3.7 sys.prefix: /usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7 ``` It was unable to find LLDB_PYTHON_EXE_RELATIVE_PATH because it was not resolving the real path of sys.prefix. caused by: https://reviews.llvm.org/D113650
1 parent 394d6fc commit f07ddbc

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lldb/bindings/python/get-python-config.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,21 @@ def main():
2424
elif args.variable_name == "LLDB_PYTHON_EXE_RELATIVE_PATH":
2525
tried = list()
2626
exe = sys.executable
27+
prefix = os.path.realpath(sys.prefix)
2728
while True:
2829
try:
29-
print(relpath_nodots(exe, sys.prefix))
30+
print(relpath_nodots(exe, prefix))
3031
break
3132
except ValueError:
3233
tried.append(exe)
3334
if os.path.islink(exe):
34-
exe = os.path.join(os.path.dirname(exe), os.readlink(exe))
35+
exe = os.path.join(os.path.realpath(os.path.dirname(exe)), os.readlink(exe))
3536
continue
3637
else:
3738
print("Could not find a relative path to sys.executable under sys.prefix", file=sys.stderr)
3839
for e in tried:
3940
print("tried:", e, file=sys.stderr)
41+
print("realpath(sys.prefix):", prefix, file=sys.stderr)
4042
print("sys.prefix:", sys.prefix, file=sys.stderr)
4143
sys.exit(1)
4244
elif args.variable_name == "LLDB_PYTHON_EXT_SUFFIX":

0 commit comments

Comments
 (0)