Skip to content

Commit e07eb41

Browse files
committed
Review comment: Move python lib search logic to lit.cfg.
1 parent 42d833f commit e07eb41

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
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 & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import os
1414
import platform
1515
import sys
16-
from distutils.sysconfig import get_python_lib
1716

1817
config.llvm_src_root = "@LLVM_MAIN_SRC_DIR@"
1918
config.llvm_obj_root = "@LLVM_BINARY_DIR@"
@@ -35,6 +34,7 @@ config.android_ndk_path = "@SWIFT_ANDROID_NDK_PATH@"
3534
config.android_ndk_gcc_version = "@SWIFT_ANDROID_NDK_GCC_VERSION@"
3635

3736
config.coverage_mode = "@SWIFT_ANALYZE_CODE_COVERAGE@"
37+
config.lldb_build_root = "@LLDB_BUILD_DIR@"
3838

3939
if "@SWIFT_ASAN_BUILD@" == "TRUE":
4040
config.available_features.add("asan")
@@ -80,11 +80,6 @@ if "@CMAKE_GENERATOR@" == "Xcode":
8080

8181
config.available_features.add("CMAKE_GENERATOR=@CMAKE_GENERATOR@")
8282

83-
if "@LLDB_ENABLE@" == "TRUE":
84-
config.available_features.add('lldb')
85-
python_lib_dir = get_python_lib(True, False, "@LLDB_BUILD_DIR@")
86-
config.substitutions.append(('%lldb-python-path', python_lib_dir))
87-
8883
# Let the main config do the real work.
8984
if config.test_exec_root is None:
9085
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)