From 30a1c9c41e5e6d4166f171b9477c6f46cafa782f Mon Sep 17 00:00:00 2001 From: Christian Tismer Date: Tue, 23 May 2017 17:10:26 +0200 Subject: Implement introspection with __signature__ package The signature module was turned into a package under 'PySide2/support/signature'. The package is completely isolated so that nothing is leaking into the normal import machinery. The package is also not initialized unless a __signature__ attribute is accessed. The only change to Python during a PySide run is the existence of the __signature__ attribute. As a side effect, all tests run at the same speed as before this extension. The module does not actively import PySide modules. Instead, it inspects sys.modules and reloads its mapping.py if needed. Example usage: >>> PySide2.QtWidgets.QGraphicsAnchorLayout.addAnchors.__signature__ >>> PySide2.QtWidgets.QGraphicsAnchorLayout.__signature__ The module has been thoroughly tested on macOS. I consider this ready. Task-number: PYSIDE-510 Change-Id: Ibb231a7fbb4ccc1a7249df55e3881a4e21a19c0d Reviewed-by: Christian Tismer --- sources/pyside2/PySide2/CMakeLists.txt | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'sources/pyside2/PySide2/CMakeLists.txt') diff --git a/sources/pyside2/PySide2/CMakeLists.txt b/sources/pyside2/PySide2/CMakeLists.txt index 31810b68f..601c43ed6 100644 --- a/sources/pyside2/PySide2/CMakeLists.txt +++ b/sources/pyside2/PySide2/CMakeLists.txt @@ -10,6 +10,26 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/__init__.py.in" configure_file("${CMAKE_CURRENT_SOURCE_DIR}/_utils.py.in" "${CMAKE_CURRENT_BINARY_DIR}/_utils.py" @ONLY) +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/support/__init__.py" + "${CMAKE_CURRENT_BINARY_DIR}/support/__init__.py" COPYONLY) +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/support/signature/__init__.py" + "${CMAKE_CURRENT_BINARY_DIR}/support/signature/__init__.py" COPYONLY) +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/support/signature/loader.py" + "${CMAKE_CURRENT_BINARY_DIR}/support/signature/loader.py" COPYONLY) +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/support/signature/mapping.py" + "${CMAKE_CURRENT_BINARY_DIR}/support/signature/mapping.py" COPYONLY) +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/support/signature/parser.py" + "${CMAKE_CURRENT_BINARY_DIR}/support/signature/parser.py" COPYONLY) +if (PYTHON_VERSION_MAJOR EQUAL 3) + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/support/signature/inspect.py" + "${CMAKE_CURRENT_BINARY_DIR}/support/signature/inspect.py" COPYONLY) + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/support/signature/typing.py" + "${CMAKE_CURRENT_BINARY_DIR}/support/signature/typing.py" COPYONLY) +else() + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/support/signature/backport_inspect.py" + "${CMAKE_CURRENT_BINARY_DIR}/support/signature/backport_inspect.py" COPYONLY) +endif() + # Add the collected includes to the global include file(READ "${CMAKE_CURRENT_BINARY_DIR}/pyside2_global.h.add" GLOBAL_APPEND) file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/pyside2_global.h" "${GLOBAL_APPEND}") -- cgit v1.2.3