This revision was automatically updated to reflect the committed changes.
Closed by commit rG9e84e038447e: [lldb] Allow configuring on Windows with 
python interpreter within a junction (authored by zero9178).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141042/new/

https://reviews.llvm.org/D141042

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


Index: lldb/bindings/python/get-python-config.py
===================================================================
--- lldb/bindings/python/get-python-config.py
+++ lldb/bindings/python/get-python-config.py
@@ -51,8 +51,10 @@
                 break
             except ValueError:
                 tried.append(exe)
-                if os.path.islink(exe):
-                    exe = os.path.join(os.path.realpath(os.path.dirname(exe)), 
os.readlink(exe))
+                # Retry if the executable is symlinked or similar.
+                # This is roughly equal to os.path.islink, except it also 
works for junctions on Windows.
+                if os.path.realpath(exe) != exe:
+                    exe = os.path.realpath(exe)
                     continue
                 else:
                     print("Could not find a relative path to sys.executable 
under sys.prefix", file=sys.stderr)


Index: lldb/bindings/python/get-python-config.py
===================================================================
--- lldb/bindings/python/get-python-config.py
+++ lldb/bindings/python/get-python-config.py
@@ -51,8 +51,10 @@
                 break
             except ValueError:
                 tried.append(exe)
-                if os.path.islink(exe):
-                    exe = os.path.join(os.path.realpath(os.path.dirname(exe)), os.readlink(exe))
+                # Retry if the executable is symlinked or similar.
+                # This is roughly equal to os.path.islink, except it also works for junctions on Windows.
+                if os.path.realpath(exe) != exe:
+                    exe = os.path.realpath(exe)
                     continue
                 else:
                     print("Could not find a relative path to sys.executable under sys.prefix", file=sys.stderr)
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to