summaryrefslogtreecommitdiffstats
path: root/lldb/scripts/Python/finishSwigPythonLLDB.py
diff options
context:
space:
mode:
authorTed Woodward <ted.woodward@codeaurora.org>2015-12-11 15:43:36 +0000
committerTed Woodward <ted.woodward@codeaurora.org>2015-12-11 15:43:36 +0000
commitec2422364f1893246dd4809d4ccb28d286a42f21 (patch)
treef1312a96ee2da3b5ddc89290fab5a1aae881cc5b /lldb/scripts/Python/finishSwigPythonLLDB.py
parentf016a1bb860d5fcdf3491750e806c6b210e26f0a (diff)
downloadbcm5719-llvm-ec2422364f1893246dd4809d4ccb28d286a42f21.tar.gz
bcm5719-llvm-ec2422364f1893246dd4809d4ccb28d286a42f21.zip
Change finishSwigPythonLLDB.py to copy six.py instead of simlink it
Summary: If six.py is simlink'd, an installation won't be able to find it unless it has access to the source tree that lldb was built from. Reviewers: zturner Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D15422 llvm-svn: 255340
Diffstat (limited to 'lldb/scripts/Python/finishSwigPythonLLDB.py')
-rw-r--r--lldb/scripts/Python/finishSwigPythonLLDB.py37
1 files changed, 26 insertions, 11 deletions
diff --git a/lldb/scripts/Python/finishSwigPythonLLDB.py b/lldb/scripts/Python/finishSwigPythonLLDB.py
index c9a6da5240a..435cb88c20f 100644
--- a/lldb/scripts/Python/finishSwigPythonLLDB.py
+++ b/lldb/scripts/Python/finishSwigPythonLLDB.py
@@ -70,6 +70,8 @@ strErrMsgCreatePyPkgMissingSlash = "Parameter 3 fn create_py_pkg() missing slash
strErrMsgMkLinkExecute = "Command mklink failed: %s"
strErrMsgMakeSymlink = "creating symbolic link"
strErrMsgUnexpected = "Unexpected error: %s"
+strMsgCopySixPy = "Copying six.py from '%s' to '%s'"
+strErrMsgCopySixPyFailed = "Unable to copy '%s' to '%s'"
def is_debug_interpreter():
return hasattr(sys, 'gettotalrefcount')
@@ -336,14 +338,6 @@ def make_symlink(vDictArgs, vstrFrameworkPythonDir, vstrSrcFile, vstrTargetFile)
return make_symlink_native(vDictArgs, strSrc, strTarget)
-def make_symlink_six(vDictArgs, vstrFrameworkPythonDir):
- dbg = utilsDebug.CDebugFnVerbose("Python script make_symlink_six()")
- site_packages_dir = os.path.dirname(vstrFrameworkPythonDir)
- six_module_filename = "six.py"
- src_file = os.path.join(vDictArgs['--srcRoot'], "third_party", "Python", "module", "six", six_module_filename)
- src_file = os.path.normpath(src_file)
- target = os.path.join(site_packages_dir, six_module_filename)
- return make_symlink_native(vDictArgs, src_file, target)
#++---------------------------------------------------------------------------
# Details: Make the symbolic that the script bridge for Python will need in
@@ -472,9 +466,6 @@ def create_symlinks(vDictArgs, vstrFrameworkPythonDir):
vstrFrameworkPythonDir,
strLibLldbFileName)
- if bOk:
- bOk, strErrMsg = make_symlink_six(vDictArgs, vstrFrameworkPythonDir)
-
# Make symlink for darwin-debug on Darwin
strDarwinDebugFileName = "darwin-debug"
if bOk and eOSType == utilsOsType.EnumOsType.Darwin:
@@ -491,6 +482,27 @@ def create_symlinks(vDictArgs, vstrFrameworkPythonDir):
return (bOk, strErrMsg)
+def copy_six(vDictArgs, vstrFrameworkPythonDir):
+ dbg = utilsDebug.CDebugFnVerbose("Python script copy_six()")
+ bDbg = "-d" in vDictArgs
+ bOk = True
+ strMsg = ""
+ site_packages_dir = os.path.dirname(vstrFrameworkPythonDir)
+ six_module_filename = "six.py"
+ src_file = os.path.join(vDictArgs['--srcRoot'], "third_party", "Python", "module", "six", six_module_filename)
+ src_file = os.path.normpath(src_file)
+ target = os.path.join(site_packages_dir, six_module_filename)
+
+ if bDbg:
+ print((strMsgCopySixPy % (src_file, target)))
+ try:
+ shutil.copyfile(src_file, target)
+ except:
+ bOk = False
+ strMsg = strErrMsgCopySixPyFailed % (src_file, target)
+
+ return (bOk, strMsg)
+
#++---------------------------------------------------------------------------
# Details: Look for the directory in which to put the Python files if it
# does not already exist, attempt to make it.
@@ -708,6 +720,9 @@ def main(vDictArgs):
bOk, strMsg = create_symlinks(vDictArgs, strFrameworkPythonDir)
if bOk:
+ bOk, strMsg = copy_six(vDictArgs, strFrameworkPythonDir)
+
+ if bOk:
bOk, strMsg = copy_lldbpy_file_to_lldb_pkg_dir(vDictArgs,
strFrameworkPythonDir,
strCfgBldDir)
OpenPOWER on IntegriCloud