[Lldb-commits] [lldb] r294071 - Install six.py conditionally

Kamil Rytarowski via lldb-commits lldb-commits at lists.llvm.org
Fri Feb 3 16:20:25 PST 2017


Author: kamil
Date: Fri Feb  3 18:20:24 2017
New Revision: 294071

URL: http://llvm.org/viewvc/llvm-project?rev=294071&view=rev
Log:
Install six.py conditionally

Summary:
The current version of LLDB installs six.py into global python library directory. This approach produces conflicts downstream with distribution's py-six copy.

Introduce new configure option LLDB_USE_SYSTEM_SIX (disabled by default). Once specified as TRUE, six.py won't be installed to Python's directory.

Add new option in finishSwigWrapperClasses.py, namely --useSystemSix.

Sponsored by <The NetBSD Foundation>

Reviewers: mgorny, emaste, clayborg, joerg, labath

Reviewed By: labath

Subscribers: #lldb

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D29405

Modified:
    lldb/trunk/CMakeLists.txt
    lldb/trunk/cmake/modules/LLDBConfig.cmake
    lldb/trunk/scripts/Python/finishSwigPythonLLDB.py
    lldb/trunk/scripts/finishSwigWrapperClasses.py
    lldb/trunk/scripts/utilsArgsParse.py

Modified: lldb/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=294071&r1=294070&r2=294071&view=diff
==============================================================================
--- lldb/trunk/CMakeLists.txt (original)
+++ lldb/trunk/CMakeLists.txt Fri Feb  3 18:20:24 2017
@@ -20,6 +20,10 @@ endif()
 # add_subdirectory(include)
 add_subdirectory(docs)
 if (NOT LLDB_DISABLE_PYTHON)
+  if(LLDB_USE_SYSTEM_SIX)
+    set(SIX_EXTRA_ARGS "--useSystemSix")
+  endif()
+
   set(LLDB_PYTHON_TARGET_DIR ${LLDB_BINARY_DIR}/scripts)
   if(LLDB_BUILD_FRAMEWORK)
     set(LLDB_PYTHON_TARGET_DIR
@@ -50,6 +54,7 @@ if (NOT LLDB_DISABLE_PYTHON)
                --prefix=${CMAKE_BINARY_DIR}
                --cmakeBuildConfiguration=${CMAKE_CFG_INTDIR}
                --lldbLibDir=lib${LLVM_LIBDIR_SUFFIX}
+               ${SIX_EXTRA_ARGS}
                ${FINISH_EXTRA_ARGS}
         VERBATIM
         DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/finishSwigWrapperClasses.py

Modified: lldb/trunk/cmake/modules/LLDBConfig.cmake
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/LLDBConfig.cmake?rev=294071&r1=294070&r2=294071&view=diff
==============================================================================
--- lldb/trunk/cmake/modules/LLDBConfig.cmake (original)
+++ lldb/trunk/cmake/modules/LLDBConfig.cmake Fri Feb  3 18:20:24 2017
@@ -29,6 +29,9 @@ set(LLDB_DISABLE_CURSES ${LLDB_DEFAULT_D
 set(LLDB_RELOCATABLE_PYTHON 0 CACHE BOOL
   "Causes LLDB to use the PYTHONHOME environment variable to locate Python.")
 
+set(LLDB_USE_SYSTEM_SIX 0 CACHE BOOL
+  "Use six.py shipped with system and do not install a copy of it")
+
 if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
   set(LLDB_EXPORT_ALL_SYMBOLS 0 CACHE BOOL
     "Causes lldb to export all symbols when building liblldb.")

Modified: lldb/trunk/scripts/Python/finishSwigPythonLLDB.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/finishSwigPythonLLDB.py?rev=294071&r1=294070&r2=294071&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/finishSwigPythonLLDB.py (original)
+++ lldb/trunk/scripts/Python/finishSwigPythonLLDB.py Fri Feb  3 18:20:24 2017
@@ -821,7 +821,9 @@ def main(vDictArgs):
         bOk, strMsg = create_symlinks(
             vDictArgs, strFrameworkPythonDir, strLldbLibDir)
 
-    if bOk:
+    bUseSystemSix = "--useSystemSix" in vDictArgs
+
+    if not bUseSystemSix and bOk:
         bOk, strMsg = copy_six(vDictArgs, strFrameworkPythonDir)
 
     if bOk:

Modified: lldb/trunk/scripts/finishSwigWrapperClasses.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/finishSwigWrapperClasses.py?rev=294071&r1=294070&r2=294071&view=diff
==============================================================================
--- lldb/trunk/scripts/finishSwigWrapperClasses.py (original)
+++ lldb/trunk/scripts/finishSwigWrapperClasses.py Fri Feb  3 18:20:24 2017
@@ -81,6 +81,7 @@ Args:   -h              (optional) Print
                     created for a Windows build.\n\
     --argsFile=         The args are read from a file instead of the\n\
                     command line. Other command line args are ignored.\n\
+    --useSystemSix  Use system six.py version.\n\
 \n\
 Usage:\n\
     finishSwigWrapperClasses.py --srcRoot=ADirPath --targetDir=ADirPath\n\
@@ -178,7 +179,8 @@ def validate_arguments(vArgv):
         "prefix=",
         "cmakeBuildConfiguration=",
         "lldbLibDir=",
-        "argsFile"]
+        "argsFile",
+        "useSystemSix"]
     dictArgReq = {"-h": "o",          # o = optional, m = mandatory
                   "-d": "o",
                   "-m": "o",
@@ -188,7 +190,8 @@ def validate_arguments(vArgv):
                   "--prefix": "o",
                   "--cmakeBuildConfiguration": "o",
                   "--lldbLibDir": "o",
-                  "--argsFile": "o"}
+                  "--argsFile": "o",
+                  "--useSystemSix": "o"}
 
     # Check for mandatory parameters
     nResult, dictArgs, strMsg = utilsArgsParse.parse(vArgv, strListArgs,
@@ -376,9 +379,11 @@ def main(vArgv):
             (optional)      "lib" by default.
             --argsFile=     The args are read from a file instead of the
                             command line. Other command line args are ignored.
+            --useSystemSix  Use system six.py version.
     Usage:
             finishSwigWrapperClasses.py --srcRoot=ADirPath --targetDir=ADirPath
             --cfgBldDir=ADirPath --prefix=ADirPath --lldbLibDir=ADirPath -m -d
+            --useSystemSix
 
     Results:    0 Success
                 -1 Error - invalid parameters passed.

Modified: lldb/trunk/scripts/utilsArgsParse.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/utilsArgsParse.py?rev=294071&r1=294070&r2=294071&view=diff
==============================================================================
--- lldb/trunk/scripts/utilsArgsParse.py (original)
+++ lldb/trunk/scripts/utilsArgsParse.py Fri Feb  3 18:20:24 2017
@@ -113,12 +113,12 @@ def parse(vArgv, vstrListArgs, vListLong
                 break
         if match == 0:
             for arg in vListLongArgs:
-                argg = "--" + arg[:arg.__len__() - 1]
+                argg = "--" + arg.rstrip('=')
                 if opt == argg:
                     if "m" == vDictArgReq[opt]:
                         countMandatoryOpts = countMandatoryOpts + 1
                     dictArgs[opt] = val
-                    if val.__len__() == 0:
+                    if arg[-1:] == '=' and val.__len__() == 0:
                         bFoundNoInputValue = True
                     break
 




More information about the lldb-commits mailing list