This repository was archived by the owner on May 21, 2019. It is now read-only.
File tree 5 files changed +46
-6
lines changed
5 files changed +46
-6
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,13 @@ if(LLDB_BUILD_FRAMEWORK)
64
64
include (LLDBFramework)
65
65
endif ()
66
66
67
+ if (NOT LLDB_DISABLE_PYTHON)
68
+ execute_process (
69
+ COMMAND
70
+ ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR} /scripts/get_libdir_suffix.py
71
+ OUTPUT_VARIABLE LLDB_PY_LIB_SUFFIX)
72
+ endif ()
73
+
67
74
add_subdirectory (docs)
68
75
if (NOT LLDB_DISABLE_PYTHON)
69
76
if (LLDB_USE_SYSTEM_SIX)
@@ -181,7 +188,7 @@ if (NOT LLDB_DISABLE_PYTHON)
181
188
--cfgBldDir=${LLDB_PYTHON_TARGET_DIR}
182
189
--prefix =${CMAKE_BINARY_DIR}
183
190
--cmakeBuildConfiguration=${CMAKE_CFG_INTDIR}
184
- --lldbLibDir=lib${LLVM_LIBDIR_SUFFIX }
191
+ --lldbLibDir=lib${LLDB_PY_LIB_SUFFIX }
185
192
${SIX_EXTRA_ARGS}
186
193
${FINISH_EXTRA_ARGS}
187
194
VERBATIM
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ if(EPYDOC_EXECUTABLE)
35
35
--url "http://lldb.llvm.org"
36
36
${EPYDOC_OPTIONS}
37
37
DEPENDS swig_wrapper liblldb
38
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} /../../../lib${LLVM_LIBDIR_SUFFIX } /python2.7/site-packages
38
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} /../../../lib${LLDB_PY_LIB_SUFFIX } /python2.7/site-packages
39
39
COMMENT "Generating LLDB Python API reference with epydoc" VERBATIM
40
40
)
41
41
endif (EPYDOC_EXECUTABLE)
Original file line number Diff line number Diff line change @@ -13,12 +13,12 @@ include(FindPythonInterp)
13
13
14
14
if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows" )
15
15
set (SWIG_PYTHON_DIR
16
- ${CMAKE_BINARY_DIR} /lib${LLVM_LIBDIR_SUFFIX } /python${PYTHON_VERSION_MAJOR} .${PYTHON_VERSION_MINOR} )
16
+ ${CMAKE_BINARY_DIR} /lib${LLDB_PY_LIB_SUFFIX } /python${PYTHON_VERSION_MAJOR} .${PYTHON_VERSION_MINOR} )
17
17
else ()
18
- set (SWIG_PYTHON_DIR ${CMAKE_BINARY_DIR} /lib${LLVM_LIBDIR_SUFFIX } /site-packages)
18
+ set (SWIG_PYTHON_DIR ${CMAKE_BINARY_DIR} /lib${LLDB_PY_LIB_SUFFIX } /site-packages)
19
19
endif ()
20
20
21
- set (SWIG_INSTALL_DIR lib${LLVM_LIBDIR_SUFFIX } )
21
+ set (SWIG_INSTALL_DIR lib${LLDB_PY_LIB_SUFFIX } )
22
22
23
23
# Generating the LLDB framework correctly is a bit complicated because the
24
24
# framework depends on the swig output.
Original file line number Diff line number Diff line change @@ -24,4 +24,4 @@ set_target_properties(readline PROPERTIES
24
24
LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} /lib${LLVM_LIBDIR_SUFFIX} /${PYTHON_DIRECTORY} )
25
25
26
26
# Install the readline module.
27
- install (TARGETS readline LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX} /lib${LLVM_LIBDIR_SUFFIX } /${PYTHON_DIRECTORY} )
27
+ install (TARGETS readline LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX} /lib${LLDB_PY_LIB_SUFFIX } /${PYTHON_DIRECTORY} )
Original file line number Diff line number Diff line change
1
+ import distutils .sysconfig
2
+ import os
3
+ import platform
4
+ import re
5
+ import sys
6
+
7
+
8
+ def get_python_libdir_suffix ():
9
+ """Returns the appropropriate python libdir suffix.
10
+
11
+ @return the python libdir suffix, normally either "" or "64".
12
+ """
13
+ if platform .system () != 'Linux' :
14
+ return ""
15
+
16
+ # We currently have a bug in lldb -P that does not account for
17
+ # architecture variants in python paths for
18
+ # architecture-specific modules. Handle the lookup here.
19
+ # When that bug is fixed, we should just ask lldb for the
20
+ # right answer always.
21
+ arch_specific_libdir = distutils .sysconfig .get_python_lib (True , False )
22
+ split_libdir = arch_specific_libdir .split (os .sep )
23
+ lib_re = re .compile (r"^lib.+$" )
24
+
25
+ for i in range (len (split_libdir )):
26
+ match = lib_re .match (split_libdir [i ])
27
+ if match is not None :
28
+ return split_libdir [i ][3 :]
29
+ return ""
30
+
31
+ if __name__ == '__main__' :
32
+ sys .stdout .write (get_python_libdir_suffix ())
33
+ sys .exit (0 )
You can’t perform that action at this time.
0 commit comments