[Lldb-commits] [lldb] r373668 - [lldb] Calculate relative path for symbol links
Haibo Huang via lldb-commits
lldb-commits at lists.llvm.org
Thu Oct 3 14:52:20 PDT 2019
Author: hhb
Date: Thu Oct 3 14:52:20 2019
New Revision: 373668
URL: http://llvm.org/viewvc/llvm-project?rev=373668&view=rev
Log:
[lldb] Calculate relative path for symbol links
Summary: This replaces the hard coded path.
Reviewers: labath, mgorny
Subscribers: lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D67993
Modified:
lldb/trunk/scripts/Python/finishSwigPythonLLDB.py
Modified: lldb/trunk/scripts/Python/finishSwigPythonLLDB.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/finishSwigPythonLLDB.py?rev=373668&r1=373667&r2=373668&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/finishSwigPythonLLDB.py (original)
+++ lldb/trunk/scripts/Python/finishSwigPythonLLDB.py Thu Oct 3 14:52:20 2019
@@ -365,7 +365,6 @@ def make_symlink_native(vDictArgs, strSr
# Throws: None.
#--
-
def make_symlink(
vDictArgs,
vstrFrameworkPythonDir,
@@ -377,27 +376,15 @@ def make_symlink(
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
More information about the lldb-commits
mailing list