Skip to content

Commit ac1f055

Browse files
Revert "Push down the swig module to avoid an import cycle (#129135)"
This reverts commit 396139a.
1 parent e5d5503 commit ac1f055

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

lldb/bindings/python/CMakeLists.txt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,8 @@ endfunction()
5959
function(finish_swig_python swig_target lldb_python_bindings_dir lldb_python_target_dir)
6060
# Add a Post-Build Event to copy over Python files and create the symlink to
6161
# liblldb.so for the Python API(hardlink on Windows).
62-
# Note that Swig-generated code is located one level deeper in the `native`
63-
# module, in order to avoid cyclic importing.
6462
add_custom_target(${swig_target} ALL VERBATIM
65-
COMMAND ${CMAKE_COMMAND} -E make_directory ${lldb_python_target_dir}/native/
63+
COMMAND ${CMAKE_COMMAND} -E make_directory ${lldb_python_target_dir}
6664
DEPENDS ${lldb_python_bindings_dir}/lldb.py
6765
COMMENT "Python script sym-linking LLDB Python API")
6866

@@ -76,8 +74,6 @@ function(finish_swig_python swig_target lldb_python_bindings_dir lldb_python_tar
7674
"${LLDB_SOURCE_DIR}/source/Interpreter/embedded_interpreter.py"
7775
"${lldb_python_target_dir}")
7876

79-
create_python_package(${swig_target} ${lldb_python_target_dir} "native" FILES)
80-
8177
# Distribute the examples as python packages.
8278
create_python_package(
8379
${swig_target}
@@ -145,7 +141,7 @@ function(finish_swig_python swig_target lldb_python_bindings_dir lldb_python_tar
145141
endif()
146142
set(LIBLLDB_SYMLINK_OUTPUT_FILE "_lldb${LLDB_PYTHON_EXT_SUFFIX}")
147143
create_relative_symlink(${swig_target} ${LIBLLDB_SYMLINK_DEST}
148-
${lldb_python_target_dir}/native/ ${LIBLLDB_SYMLINK_OUTPUT_FILE})
144+
${lldb_python_target_dir} ${LIBLLDB_SYMLINK_OUTPUT_FILE})
149145

150146

151147
if (NOT WIN32)

lldb/bindings/python/python.swig

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,7 @@ Older swig versions will simply ignore this setting.
5050
import $module
5151
except ImportError:
5252
# Relative import should work if we are being loaded by Python.
53-
# The cpython module built by swig is pushed one level down into
54-
# the native submodule, because at this point the interpreter
55-
# is still constructing the lldb module itself.
56-
# Simply importing anything using `from . import` constitutes
57-
# a cyclic importing.
58-
from .native import $module"
53+
from . import $module"
5954
%enddef
6055

6156
// The name of the module to be created.

0 commit comments

Comments
 (0)