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
This commit is contained in:
Francis Ricci
2016-04-25 20:34:34 +00:00
parent 1ef1bf87dc
commit 4692f52daa
3 changed files with 45 additions and 10 deletions

View File

@@ -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.
@@ -726,11 +753,14 @@ def main(vDictArgs):
print((strMsgPyFileLocatedHere % strFrameworkPythonDir))
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)