diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2018-07-28 11:09:23 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2018-07-28 11:09:23 +0000 |
commit | f73363f1dd94996356cefbf24388f561891acf0b (patch) | |
tree | e3c31248bdb36eaec5fd833490d4278162dba2a0 /scripts/Python | |
parent | 160ee69dd7ae18978f4068116777639ea98dc951 (diff) |
Notes
Diffstat (limited to 'scripts/Python')
-rw-r--r-- | scripts/Python/modules/readline/CMakeLists.txt | 8 | ||||
-rw-r--r-- | scripts/Python/python-extensions.swig | 27 |
2 files changed, 13 insertions, 22 deletions
diff --git a/scripts/Python/modules/readline/CMakeLists.txt b/scripts/Python/modules/readline/CMakeLists.txt index 0a4376c1c324..876ab341682b 100644 --- a/scripts/Python/modules/readline/CMakeLists.txt +++ b/scripts/Python/modules/readline/CMakeLists.txt @@ -6,11 +6,13 @@ SET(PYTHON_DIRECTORY python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site- # Build the readline python module include_directories(${PYTHON_INCLUDE_DIR}) add_library(readline SHARED readline.cpp) +target_link_libraries(readline ${PYTHON_LIBRARY}) if (NOT LLDB_DISABLE_LIBEDIT) - target_link_libraries(readline ${PYTHON_LIBRARY} edit) -else() - target_link_libraries(readline ${PYTHON_LIBRARY}) + target_include_directories(readline + PRIVATE + ${libedit_INCLUDE_DIRS}) + target_link_libraries(readline ${libedit_LIBRARIES}) endif() # FIXME: the LIBRARY_OUTPUT_PATH seems to be ignored - this is not a diff --git a/scripts/Python/python-extensions.swig b/scripts/Python/python-extensions.swig index d79917b92158..5543bee95d47 100644 --- a/scripts/Python/python-extensions.swig +++ b/scripts/Python/python-extensions.swig @@ -839,29 +839,18 @@ %pythoncode %{ -def command(*args, **kwargs): +def command(command_name=None, doc=None): import lldb - import inspect """A decorator function that registers an LLDB command line command that is bound to the function it is attached to.""" - class obj(object): - """The object that tracks adding the command to LLDB one time and handles - calling the function on subsequent calls.""" - def __init__(self, function, command_name, doc = None): - if doc: - function.__doc__ = doc - command = "command script add -f %s.%s %s" % (function.__module__, function.__name__, command_name) - lldb.debugger.HandleCommand(command) - self.function = function - def __call__(self, debugger, command, exe_ctx, result, dict): - if len(inspect.getargspec(self.function).args) == 5: - self.function(debugger, command, exe_ctx, result, dict) - else: - self.function(debugger, command, result, dict) def callable(function): - """Creates a callable object that gets used.""" - f = obj(function, *args, **kwargs) - return f.__call__ + """Registers an lldb command for the decorated function.""" + command = "command script add -f %s.%s %s" % (function.__module__, function.__name__, command_name or function.__name__) + lldb.debugger.HandleCommand(command) + if doc: + function.__doc__ = doc + return function + return callable class declaration(object): |