aboutsummaryrefslogtreecommitdiff
path: root/lldb/scripts/Python
diff options
context:
space:
mode:
authorHaibo Huang <hhb@google.com>2019-10-03 21:52:20 +0000
committerHaibo Huang <hhb@google.com>2019-10-03 21:52:20 +0000
commit958091c209d0a92e38b9cb27fb77a0ff7da11853 (patch)
treeae5c0c07d327a22e502878935f0ebc88a3b2e774 /lldb/scripts/Python
parent9588ae772d6a3742e8429d86d65e3fd68f6d9444 (diff)
downloadllvm-958091c209d0a92e38b9cb27fb77a0ff7da11853.zip
llvm-958091c209d0a92e38b9cb27fb77a0ff7da11853.tar.gz
llvm-958091c209d0a92e38b9cb27fb77a0ff7da11853.tar.bz2
[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 llvm-svn: 373668
Diffstat (limited to 'lldb/scripts/Python')
-rw-r--r--lldb/scripts/Python/finishSwigPythonLLDB.py21
1 files changed, 4 insertions, 17 deletions
diff --git a/lldb/scripts/Python/finishSwigPythonLLDB.py b/lldb/scripts/Python/finishSwigPythonLLDB.py
index ff6a131..d23e103 100644
--- a/lldb/scripts/Python/finishSwigPythonLLDB.py
+++ b/lldb/scripts/Python/finishSwigPythonLLDB.py
@@ -365,7 +365,6 @@ def make_symlink_native(vDictArgs, strSrc, strTarget):
# 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