Skip to content

Commit d2d0b1f

Browse files
authored
Merge pull request #7685 from gmilos/sr-100-lit-python-search-path
Use get_python_lib to look for lldb python lib dir.
2 parents cbdc917 + e07eb41 commit d2d0b1f

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

test/lit.cfg

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import tempfile
2727
import socket
2828
import glob
2929
import pipes
30+
from distutils.sysconfig import get_python_lib
3031

3132
import lit
3233
import lit.formats
@@ -1068,3 +1069,10 @@ if os.path.exists(libswiftCore_path):
10681069
config.available_features.add("static_stdlib")
10691070
config.substitutions.append(('%target-static-stdlib-path', static_stdlib_path))
10701071
lit_config.note('using static stdlib path: %s' % static_stdlib_path)
1072+
1073+
if config.lldb_build_root != "":
1074+
config.available_features.add('lldb')
1075+
# Note: using the same approach to locating the lib dir as in
1076+
# finishSwigPythonLLDB.py in the lldb repo
1077+
python_lib_dir = get_python_lib(True, False, config.lldb_build_root)
1078+
config.substitutions.append(('%lldb-python-path', python_lib_dir))

test/lit.site.cfg.in

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ config.android_ndk_path = "@SWIFT_ANDROID_NDK_PATH@"
3434
config.android_ndk_gcc_version = "@SWIFT_ANDROID_NDK_GCC_VERSION@"
3535

3636
config.coverage_mode = "@SWIFT_ANALYZE_CODE_COVERAGE@"
37+
config.lldb_build_root = "@LLDB_BUILD_DIR@"
3738

3839
if "@SWIFT_ASAN_BUILD@" == "TRUE":
3940
config.available_features.add("asan")
@@ -79,13 +80,6 @@ if "@CMAKE_GENERATOR@" == "Xcode":
7980

8081
config.available_features.add("CMAKE_GENERATOR=@CMAKE_GENERATOR@")
8182

82-
if "@LLDB_ENABLE@" == "TRUE":
83-
config.available_features.add('lldb')
84-
for root, dirs, files in os.walk("@LLDB_BUILD_DIR@"):
85-
if root.endswith("site-packages"):
86-
config.substitutions.append(('%lldb-python-path', root))
87-
break
88-
8983
# Let the main config do the real work.
9084
if config.test_exec_root is None:
9185
config.test_exec_root = os.path.dirname(os.path.realpath(__file__))

validation-test/lit.site.cfg.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ config.android_ndk_path = "@SWIFT_ANDROID_NDK_PATH@"
3232
config.android_ndk_gcc_version = "@SWIFT_ANDROID_NDK_GCC_VERSION@"
3333

3434
config.coverage_mode = "@SWIFT_ANALYZE_CODE_COVERAGE@"
35+
config.lldb_build_root = "@LLDB_BUILD_DIR@"
3536

3637
if "@SWIFT_ASAN_BUILD@" == "TRUE":
3738
config.available_features.add("asan")

0 commit comments

Comments
 (0)