[Lldb-commits] [PATCH] D67993: [lldb] Calculate relative path for symbol links

Haibo Huang via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 3 14:52:20 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL373668: [lldb] Calculate relative path for symbol links (authored by hhb, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D67993?vs=221612&id=223102#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D67993

Files:
  lldb/trunk/scripts/Python/finishSwigPythonLLDB.py


Index: lldb/trunk/scripts/Python/finishSwigPythonLLDB.py
===================================================================
--- lldb/trunk/scripts/Python/finishSwigPythonLLDB.py
+++ lldb/trunk/scripts/Python/finishSwigPythonLLDB.py
@@ -365,7 +365,6 @@
 # Throws:   None.
 #--
 
-
 def make_symlink(
         vDictArgs,
         vstrFrameworkPythonDir,
@@ -377,27 +376,15 @@
     bDbg = "-d" in vDictArgs
     strTarget = os.path.join(vstrFrameworkPythonDir, vstrTargetFile)
     strTarget = os.path.normcase(strTarget)
-    strSrc = ""
+    strPrefix = vDictArgs['--prefix']
 
     os.chdir(vstrFrameworkPythonDir)
     bMakeFileCalled = "-m" in vDictArgs
     eOSType = utilsOsType.determine_os_type()
-    if not bMakeFileCalled:
-        strBuildDir = os.path.join("..", "..", "..")
-    else:
-        # Resolve vstrSrcFile path relatively the build directory
-        if eOSType == utilsOsType.EnumOsType.Windows:
-            # On a Windows platform the vstrFrameworkPythonDir looks like:
-            # llvm\\build\\Lib\\site-packages\\lldb
-            strBuildDir = os.path.join("..", "..", "..")
-        else:
-            # On a UNIX style platform the vstrFrameworkPythonDir looks like:
-            # llvm/build/lib/python2.7/site-packages/lldb
-            strBuildDir = os.path.join("..", "..", "..", "..")
-    strSrc = os.path.normcase(os.path.join(strBuildDir, vstrSrcFile))
-
-    return make_symlink_native(vDictArgs, strSrc, strTarget)
 
+    strSrc = os.path.normcase(os.path.join(strPrefix, vstrSrcFile))
+    strRelSrc = os.path.relpath(strSrc, os.path.dirname(strTarget))
+    return make_symlink_native(vDictArgs, strRelSrc, strTarget)
 
 #++---------------------------------------------------------------------------
 # Details:  Make the symbolic that the script bridge for Python will need in


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67993.223102.patch
Type: text/x-patch
Size: 1824 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191003/6e9e7a92/attachment.bin>


More information about the lldb-commits mailing list