summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Gorny <mgorny@gentoo.org>2019-09-25 09:47:35 +0000
committerMichal Gorny <mgorny@gentoo.org>2019-09-25 09:47:35 +0000
commit7efca81f7debcc6fa87f2a9763c2af3d6a8f10ac (patch)
tree945538384a051124e2cd05504176b3a4c1a20e6b
parent286860986e2281d2b7c67a1d50d142b4834b0d1f (diff)
downloadbcm5719-llvm-7efca81f7debcc6fa87f2a9763c2af3d6a8f10ac.tar.gz
bcm5719-llvm-7efca81f7debcc6fa87f2a9763c2af3d6a8f10ac.zip
[lldb] [cmake] Fix installing Python modules on systems using /usr/lib
Fix installing Python modules on systems that use /usr/lib for Python while installing other libraries in /usr/lib64. Rewrite CMake logic to query correct directories from Python, similarly to how prepare_binding_Python.py does it. Furthermore, change the regex used in get_relative_lib_dir.py to allow 'lib' without suffix. I think that the code can be further improved but I'd like to take this enterprise in smaller steps in case one of them breaks something. Differential Revision: https://reviews.llvm.org/D67890 llvm-svn: 372835
-rw-r--r--lldb/scripts/CMakeLists.txt21
-rw-r--r--lldb/scripts/get_relative_lib_dir.py2
2 files changed, 13 insertions, 10 deletions
diff --git a/lldb/scripts/CMakeLists.txt b/lldb/scripts/CMakeLists.txt
index 1a0ea96ff9f..7de79730279 100644
--- a/lldb/scripts/CMakeLists.txt
+++ b/lldb/scripts/CMakeLists.txt
@@ -42,15 +42,18 @@ add_custom_target(swig_wrapper ALL DEPENDS
)
if(NOT LLDB_BUILD_FRAMEWORK)
- if(CMAKE_SYSTEM_NAME MATCHES "Windows")
- set(swig_python_subdir site-packages)
- else()
- set(swig_python_subdir python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
- endif()
-
- set(SWIG_PYTHON_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${swig_python_subdir})
- set(SWIG_INSTALL_DIR lib${LLVM_LIBDIR_SUFFIX})
+ execute_process(
+ COMMAND ${PYTHON_EXECUTABLE}
+ -c "import distutils.sysconfig, sys; print(distutils.sysconfig.get_python_lib(True, False, sys.argv[1]))"
+ ${CMAKE_BINARY_DIR}
+ OUTPUT_VARIABLE SWIG_PYTHON_DIR
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ execute_process(
+ COMMAND ${PYTHON_EXECUTABLE}
+ -c "import distutils.sysconfig; print(distutils.sysconfig.get_python_lib(True, False, ''))"
+ OUTPUT_VARIABLE SWIG_INSTALL_DIR
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
# Install the LLDB python module
- install(DIRECTORY ${SWIG_PYTHON_DIR} DESTINATION ${SWIG_INSTALL_DIR})
+ install(DIRECTORY ${SWIG_PYTHON_DIR}/ DESTINATION ${SWIG_INSTALL_DIR})
endif()
diff --git a/lldb/scripts/get_relative_lib_dir.py b/lldb/scripts/get_relative_lib_dir.py
index f7020d653fd..3afeeafd7b4 100644
--- a/lldb/scripts/get_relative_lib_dir.py
+++ b/lldb/scripts/get_relative_lib_dir.py
@@ -23,7 +23,7 @@ def get_python_relative_libdir():
# right answer always.
arch_specific_libdir = distutils.sysconfig.get_python_lib(True, False)
split_libdir = arch_specific_libdir.split(os.sep)
- lib_re = re.compile(r"^lib.+$")
+ lib_re = re.compile(r"^lib.*$")
for i in range(len(split_libdir)):
match = lib_re.match(split_libdir[i])
OpenPOWER on IntegriCloud