[Lldb-commits] [lldb] r255340 - Change finishSwigPythonLLDB.py to copy six.py instead of simlink it

Ted Woodward via lldb-commits lldb-commits at lists.llvm.org
Fri Dec 11 07:43:36 PST 2015


Author: ted
Date: Fri Dec 11 09:43:36 2015
New Revision: 255340

URL: http://llvm.org/viewvc/llvm-project?rev=255340&view=rev
Log:
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

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=255340&r1=255339&r2=255340&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/finishSwigPythonLLDB.py (original)
+++ lldb/trunk/scripts/Python/finishSwigPythonLLDB.py Fri Dec 11 09:43:36 2015
@@ -70,6 +70,8 @@ strErrMsgCreatePyPkgMissingSlash = "Para
 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, vstrFramewor
 
     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, vstrFrame
                                               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, vstrFrame
 
     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)




More information about the lldb-commits mailing list