aboutsummaryrefslogtreecommitdiff
path: root/lldb/scripts/Python/finishSwigPythonLLDB.py
diff options
context:
space:
mode:
authorFrancis Ricci <francisjricci@gmail.com>2016-04-25 20:34:34 +0000
committerFrancis Ricci <francisjricci@gmail.com>2016-04-25 20:34:34 +0000
commit4692f52daa9d305b375cf2d2e9f3b5da8a352021 (patch)
treeefd028832b9bbd03c724e33df05c6ccc1ba4d587 /lldb/scripts/Python/finishSwigPythonLLDB.py
parent1ef1bf87dc8c26c61a2a51fea4c9d3aadda07d13 (diff)
downloadllvm-4692f52daa9d305b375cf2d2e9f3b5da8a352021.zip
llvm-4692f52daa9d305b375cf2d2e9f3b5da8a352021.tar.gz
llvm-4692f52daa9d305b375cf2d2e9f3b5da8a352021.tar.bz2
Create _lldb python symlink correctly when LLVM_LIBDIR_SUFFIX is used
Summary: Do not assume that liblldb.so is located in $(lldb -P)/../../../lib when creating the _lldb python symlink. Instead, use the path passed to LLVM_LIBDIR_SUFFIX, defaulting to $(lldb -P)/../../../lib when this variable is not set. Reviewers: vharron, emaste, zturner Subscribers: zturner, labath, lldb-commits, sas Differential Revision: http://reviews.llvm.org/D19067 llvm-svn: 267462
Diffstat (limited to 'lldb/scripts/Python/finishSwigPythonLLDB.py')
-rw-r--r--lldb/scripts/Python/finishSwigPythonLLDB.py42
1 files changed, 36 insertions, 6 deletions
diff --git a/lldb/scripts/Python/finishSwigPythonLLDB.py b/lldb/scripts/Python/finishSwigPythonLLDB.py
index cbd229b..4d733a1 100644
--- a/lldb/scripts/Python/finishSwigPythonLLDB.py
+++ b/lldb/scripts/Python/finishSwigPythonLLDB.py
@@ -358,11 +358,12 @@ def make_symlink(vDictArgs, vstrFrameworkPythonDir, vstrSrcFile, vstrTargetFile)
# Args: vDictArgs - (R) Program input parameters.
# vstrFrameworkPythonDir - (R) Python framework directory.
# vstrLiblldbName - (R) File name for _lldb library.
+# vstrLiblldbDir - (R) liblldb directory.
# Returns: Bool - True = function success, False = failure.
# Str - Error description on task failure.
# Throws: None.
#--
-def make_symlink_liblldb(vDictArgs, vstrFrameworkPythonDir, vstrLiblldbFileName):
+def make_symlink_liblldb(vDictArgs, vstrFrameworkPythonDir, vstrLiblldbFileName, vstrLldbLibDir):
dbg = utilsDebug.CDebugFnVerbose("Python script make_symlink_liblldb()")
bOk = True
strErrMsg = ""
@@ -382,7 +383,7 @@ def make_symlink_liblldb(vDictArgs, vstrFrameworkPythonDir, vstrLiblldbFileName)
bMakeFileCalled = "-m" in vDictArgs
if not bMakeFileCalled:
- strSrc = os.path.join("lib", "LLDB")
+ strSrc = os.path.join(vstrLldbLibDir, "LLDB")
else:
strLibFileExtn = ""
if eOSType == utilsOsType.EnumOsType.Windows:
@@ -392,7 +393,7 @@ def make_symlink_liblldb(vDictArgs, vstrFrameworkPythonDir, vstrLiblldbFileName)
strLibFileExtn = ".dylib"
else:
strLibFileExtn = ".so"
- strSrc = os.path.join("lib", "liblldb" + strLibFileExtn)
+ strSrc = os.path.join(vstrLldbLibDir, "liblldb" + strLibFileExtn)
bOk, strErrMsg = make_symlink(vDictArgs, vstrFrameworkPythonDir, strSrc, strTarget)
@@ -462,11 +463,12 @@ def make_symlink_lldb_argdumper(vDictArgs, vstrFrameworkPythonDir, vstrArgdumper
# the Python framework directory.
# Args: vDictArgs - (R) Program input parameters.
# vstrFrameworkPythonDir - (R) Python framework directory.
+# vstrLldbLibDir - (R) liblldb directory.
# Returns: Bool - True = function success, False = failure.
# strErrMsg - Error description on task failure.
# Throws: None.
#--
-def create_symlinks(vDictArgs, vstrFrameworkPythonDir):
+def create_symlinks(vDictArgs, vstrFrameworkPythonDir, vstrLldbLibDir):
dbg = utilsDebug.CDebugFnVerbose("Python script create_symlinks()")
bOk = True
strErrMsg = ""
@@ -477,7 +479,8 @@ def create_symlinks(vDictArgs, vstrFrameworkPythonDir):
if bOk:
bOk, strErrMsg = make_symlink_liblldb(vDictArgs,
vstrFrameworkPythonDir,
- strLibLldbFileName)
+ strLibLldbFileName,
+ vstrLldbLibDir)
# Make symlink for darwin-debug on Darwin
strDarwinDebugFileName = "darwin-debug"
@@ -672,6 +675,28 @@ def get_framework_python_dir(vDictArgs):
return (bOk, strWkDir, strErrMsg)
+#++---------------------------------------------------------------------------
+# Details: Retrieve the liblldb directory path, if it exists and is valid.
+# Args: vDictArgs - (R) Program input parameters.
+# Returns: Bool - True = function success, False = failure.
+# Str - liblldb directory path.
+# strErrMsg - Error description on task failure.
+# Throws: None.
+#--
+def get_liblldb_dir(vDictArgs):
+ dbg = utilsDebug.CDebugFnVerbose("Python script get_liblldb_dir()")
+ bOk = True
+ strErrMsg = ""
+
+ strLldbLibDir = ""
+ bHaveLldbLibDir = "--lldbLibDir" in vDictArgs
+ if bHaveLldbLibDir:
+ strLldbLibDir = vDictArgs["--lldbLibDir"]
+ if (bHaveLldbLibDir == False) or (strLldbLibDir.__len__() == 0):
+ strLldbLibDir = "lib"
+
+ return (bOk, strLldbLibDir, strErrMsg)
+
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
@@ -697,6 +722,8 @@ def get_framework_python_dir(vDictArgs):
be installed. Where non-Darwin systems want to put
the .py and .so files so that Python can find them
automatically. Python install directory.
+ --lldbLibDir The name of the directory containing liblldb.so.
+ (optional) "lib" by default.
Results: 0 Success
-100+ Error from this script to the caller script.
-100 Error program failure with optional message.
@@ -727,10 +754,13 @@ def main(vDictArgs):
print((strMsgConfigBuildDir % strCfgBldDir))
if bOk:
+ bOk, strLldbLibDir, strMsg = get_liblldb_dir(vDictArgs)
+
+ if bOk:
bOk, strMsg = find_or_create_python_dir(vDictArgs, strFrameworkPythonDir)
if bOk:
- bOk, strMsg = create_symlinks(vDictArgs, strFrameworkPythonDir)
+ bOk, strMsg = create_symlinks(vDictArgs, strFrameworkPythonDir, strLldbLibDir)
if bOk:
bOk, strMsg = copy_six(vDictArgs, strFrameworkPythonDir)