aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2017-11-06 15:50:34 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2017-11-06 15:50:38 +0100
commitb197a0dbb9f317dd9061ac002b039c53ab662d4e (patch)
tree29f852df50f2b8db8ed8d495749717c66d11a7c6
parent63ab34b618538b6ab1a186754031ed88d730dcd3 (diff)
parent06e4edac7133d322fe3398502396e1cd8afd8329 (diff)
Merge remote-tracking branch 'origin/5.9' into dev
-rw-r--r--sources/pyside2/CMakeLists.txt3
-rw-r--r--sources/pyside2/PySide2/CMakeLists.txt15
-rw-r--r--sources/pyside2/PySide2/QtCharts/CMakeLists.txt11
-rw-r--r--sources/pyside2/PySide2/QtCharts/typesystem_charts.xml2
-rw-r--r--sources/pyside2/PySide2/QtConcurrent/CMakeLists.txt6
-rw-r--r--sources/pyside2/PySide2/QtConcurrent/typesystem_concurrent.xml2
-rw-r--r--sources/pyside2/PySide2/QtCore/CMakeLists.txt5
-rw-r--r--sources/pyside2/PySide2/QtCore/typesystem_core.xml.in4
-rw-r--r--sources/pyside2/PySide2/QtCore/typesystem_core_common.xml4
-rw-r--r--sources/pyside2/PySide2/QtDataVisualization/CMakeLists.txt9
-rw-r--r--sources/pyside2/PySide2/QtDataVisualization/typesystem_datavisualization.xml2
-rw-r--r--sources/pyside2/PySide2/QtGui/CMakeLists.txt5
-rw-r--r--sources/pyside2/PySide2/QtGui/typesystem_gui.xml.in6
-rw-r--r--sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml2
-rw-r--r--sources/pyside2/PySide2/QtHelp/CMakeLists.txt6
-rw-r--r--sources/pyside2/PySide2/QtHelp/typesystem_help.xml2
-rw-r--r--sources/pyside2/PySide2/QtMacExtras/CMakeLists.txt8
-rw-r--r--sources/pyside2/PySide2/QtMacExtras/typesystem_macextras.xml4
-rw-r--r--sources/pyside2/PySide2/QtMultimedia/CMakeLists.txt6
-rw-r--r--sources/pyside2/PySide2/QtMultimedia/typesystem_multimedia.xml4
-rw-r--r--sources/pyside2/PySide2/QtMultimedia/typesystem_multimedia_common.xml6
-rw-r--r--sources/pyside2/PySide2/QtMultimediaWidgets/CMakeLists.txt7
-rw-r--r--sources/pyside2/PySide2/QtMultimediaWidgets/typesystem_multimediawidgets.xml8
-rw-r--r--sources/pyside2/PySide2/QtNetwork/CMakeLists.txt6
-rw-r--r--sources/pyside2/PySide2/QtNetwork/typesystem_network.xml2
-rw-r--r--sources/pyside2/PySide2/QtOpenGL/CMakeLists.txt6
-rw-r--r--sources/pyside2/PySide2/QtOpenGL/typesystem_opengl.xml2
-rw-r--r--sources/pyside2/PySide2/QtPrintSupport/CMakeLists.txt6
-rw-r--r--sources/pyside2/PySide2/QtPrintSupport/typesystem_printsupport.xml2
-rw-r--r--sources/pyside2/PySide2/QtQml/CMakeLists.txt6
-rw-r--r--sources/pyside2/PySide2/QtQml/typesystem_qml.xml6
-rw-r--r--sources/pyside2/PySide2/QtQuick/CMakeLists.txt9
-rw-r--r--sources/pyside2/PySide2/QtQuick/typesystem_quick.xml8
-rw-r--r--sources/pyside2/PySide2/QtQuickWidgets/CMakeLists.txt8
-rw-r--r--sources/pyside2/PySide2/QtQuickWidgets/typesystem_quickwidgets.xml12
-rw-r--r--sources/pyside2/PySide2/QtScript/CMakeLists.txt4
-rw-r--r--sources/pyside2/PySide2/QtScript/qscript_value_iterator_glue.cpp3
-rw-r--r--sources/pyside2/PySide2/QtScript/typesystem_script.xml6
-rw-r--r--sources/pyside2/PySide2/QtScriptTools/CMakeLists.txt7
-rw-r--r--sources/pyside2/PySide2/QtScriptTools/typesystem_scripttools.xml6
-rw-r--r--sources/pyside2/PySide2/QtSql/CMakeLists.txt6
-rw-r--r--sources/pyside2/PySide2/QtSql/typesystem_sql.xml2
-rw-r--r--sources/pyside2/PySide2/QtSvg/CMakeLists.txt6
-rw-r--r--sources/pyside2/PySide2/QtSvg/typesystem_svg.xml2
-rw-r--r--sources/pyside2/PySide2/QtTest/CMakeLists.txt6
-rw-r--r--sources/pyside2/PySide2/QtTest/typesystem_test.xml6
-rw-r--r--sources/pyside2/PySide2/QtTextToSpeech/CMakeLists.txt7
-rw-r--r--sources/pyside2/PySide2/QtTextToSpeech/typesystem_texttospeech.xml2
-rw-r--r--sources/pyside2/PySide2/QtUiTools/CMakeLists.txt7
-rw-r--r--sources/pyside2/PySide2/QtUiTools/typesystem_uitools.xml4
-rw-r--r--sources/pyside2/PySide2/QtWebChannel/CMakeLists.txt4
-rw-r--r--sources/pyside2/PySide2/QtWebChannel/typesystem_webchannel.xml2
-rw-r--r--sources/pyside2/PySide2/QtWebEngineWidgets/CMakeLists.txt9
-rw-r--r--sources/pyside2/PySide2/QtWebEngineWidgets/typesystem_webenginewidgets.xml10
-rw-r--r--sources/pyside2/PySide2/QtWebKit/CMakeLists.txt6
-rw-r--r--sources/pyside2/PySide2/QtWebKit/typesystem_webkit.xml6
-rw-r--r--sources/pyside2/PySide2/QtWebKitWidgets/CMakeLists.txt9
-rw-r--r--sources/pyside2/PySide2/QtWebKitWidgets/typesystem_webkitwidgets.xml10
-rw-r--r--sources/pyside2/PySide2/QtWebSockets/CMakeLists.txt5
-rw-r--r--sources/pyside2/PySide2/QtWebSockets/typesystem_websockets.xml4
-rw-r--r--sources/pyside2/PySide2/QtWidgets/CMakeLists.txt6
-rw-r--r--sources/pyside2/PySide2/QtWidgets/typesystem_widgets.xml.in6
-rw-r--r--sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml2
-rw-r--r--sources/pyside2/PySide2/QtWinExtras/CMakeLists.txt8
-rw-r--r--sources/pyside2/PySide2/QtWinExtras/typesystem_winextras.xml4
-rw-r--r--sources/pyside2/PySide2/QtX11Extras/CMakeLists.txt8
-rw-r--r--sources/pyside2/PySide2/QtX11Extras/typesystem_x11extras.xml2
-rw-r--r--sources/pyside2/PySide2/QtXml/CMakeLists.txt5
-rw-r--r--sources/pyside2/PySide2/QtXml/typesystem_xml.xml2
-rw-r--r--sources/pyside2/PySide2/QtXmlPatterns/CMakeLists.txt5
-rw-r--r--sources/pyside2/PySide2/QtXmlPatterns/typesystem_xmlpatterns.xml2
-rw-r--r--sources/pyside2/PySide2/support/__init__.py10
-rw-r--r--sources/pyside2/cmake/Macros/PySideModules.cmake17
-rw-r--r--sources/pyside2/libpyside/CMakeLists.txt1
-rw-r--r--sources/pyside2/libpyside/globalreceiver.cpp1
-rw-r--r--sources/pyside2/libpyside/globalreceiverv2.cpp1
-rw-r--r--sources/pyside2/libpyside/pyside.cpp5
-rw-r--r--sources/pyside2/libpyside/pysideconversions.h275
-rw-r--r--sources/pyside2/libpyside/signalmanager.cpp.in28
-rw-r--r--sources/pyside2/tests/QtXml/qxmlsimplereader_test.py1
-rw-r--r--sources/pyside2/tests/pysidetest/CMakeLists.txt7
-rw-r--r--sources/pyside2/tests/pysidetest/typesystem_pysidetest.xml2
-rw-r--r--sources/shiboken2/ApiExtractor/typedatabase.cpp25
-rw-r--r--sources/shiboken2/ApiExtractor/typedatabase.h4
-rw-r--r--sources/shiboken2/ApiExtractor/typesystem.cpp21
-rw-r--r--sources/shiboken2/ApiExtractor/typesystem_p.h1
-rw-r--r--sources/shiboken2/CMakeLists.txt27
-rw-r--r--sources/shiboken2/generator/shiboken2/cppgenerator.cpp23
-rw-r--r--sources/shiboken2/generator/shiboken2/headergenerator.cpp2
-rw-r--r--sources/shiboken2/libshiboken/CMakeLists.txt5
-rw-r--r--sources/shiboken2/libshiboken/basewrapper.cpp7
-rw-r--r--sources/shiboken2/libshiboken/conversions.h731
-rw-r--r--sources/shiboken2/libshiboken/helper.cpp1
-rw-r--r--sources/shiboken2/libshiboken/helper.h41
-rw-r--r--sources/shiboken2/libshiboken/sbkconverter.cpp4
-rw-r--r--sources/shiboken2/libshiboken/sbkconverter.h33
-rw-r--r--sources/shiboken2/libshiboken/sbkconverter_p.h49
-rw-r--r--sources/shiboken2/libshiboken/sbkenum.cpp6
-rw-r--r--sources/shiboken2/libshiboken/shiboken.h2
-rw-r--r--sources/shiboken2/libshiboken/typeresolver.cpp160
-rw-r--r--sources/shiboken2/libshiboken/typeresolver.h139
-rw-r--r--sources/shiboken2/libshiboken/voidptr.cpp452
-rw-r--r--sources/shiboken2/libshiboken/voidptr.h65
-rw-r--r--sources/shiboken2/shibokenmodule/CMakeLists.txt5
-rw-r--r--sources/shiboken2/shibokenmodule/typesystem_shiboken.xml3
-rw-r--r--sources/shiboken2/tests/libsample/voidholder.h4
-rw-r--r--sources/shiboken2/tests/samplebinding/typesystem_sample.xml12
-rw-r--r--sources/shiboken2/tests/samplebinding/voidholder_test.py20
-rw-r--r--utils.py34
109 files changed, 833 insertions, 1780 deletions
diff --git a/sources/pyside2/CMakeLists.txt b/sources/pyside2/CMakeLists.txt
index d4bb023a0..e880a3e69 100644
--- a/sources/pyside2/CMakeLists.txt
+++ b/sources/pyside2/CMakeLists.txt
@@ -230,9 +230,6 @@ macro(COLLECT_MODULE_IF_FOUND shortname)
if(${_name_found})
message(STATUS "module ${name} found (${ARGN})")
- # Put the module at the end of pyside2_global.h
- file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/PySide2/pyside2_global.h.add"
- "#include \"Qt${shortname}/Qt${shortname}\"\n")
# record the shortnames for the tests
list(APPEND all_module_shortnames ${shortname})
else()
diff --git a/sources/pyside2/PySide2/CMakeLists.txt b/sources/pyside2/PySide2/CMakeLists.txt
index 601c43ed6..0b8210359 100644
--- a/sources/pyside2/PySide2/CMakeLists.txt
+++ b/sources/pyside2/PySide2/CMakeLists.txt
@@ -30,15 +30,20 @@ else()
"${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}")
-file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/pyside2_global.h.add")
-
# now compile all modules.
+file(READ "${CMAKE_CURRENT_BINARY_DIR}/pyside2_global.h" pyside2_global_contents)
+
foreach(shortname IN LISTS all_module_shortnames)
set(name "Qt5${shortname}")
HAS_QT_MODULE(${name}_FOUND Qt${shortname})
+
+ # Create a module header consisting of pyside2_global.h and the module
+ # include. Note: The contents of pyside2_global.h must be copied instead of
+ # just #including it since shiboken will otherwise generate an
+ # #include <pyside2_global.h> for the the type entries originating from it
+ # (cf AbstractMetaBuilderPrivate::setInclude()).
+ set(module_header "${CMAKE_CURRENT_BINARY_DIR}/Qt${shortname}_global.h")
+ file(WRITE ${module_header} "${pyside2_global_contents}\n#include <Qt${shortname}/Qt${shortname}>\n")
endforeach()
# install
diff --git a/sources/pyside2/PySide2/QtCharts/CMakeLists.txt b/sources/pyside2/PySide2/QtCharts/CMakeLists.txt
index 5d6ed6aaf..fa177300d 100644
--- a/sources/pyside2/PySide2/QtCharts/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtCharts/CMakeLists.txt
@@ -58,15 +58,6 @@ ${QtCharts_GEN_DIR}/qtcharts_wrapper.cpp
${QtCharts_GEN_DIR}/qtcharts_module_wrapper.cpp
)
-make_path(QtCharts_typesystem_path
- ${QtCore_SOURCE_DIR}
- ${QtCore_BINARY_DIR}
- ${QtGui_SOURCE_DIR}
- ${QtGui_BINARY_DIR}
- ${QtWidgets_SOURCE_DIR}
- ${QtWidgets_BINARY_DIR}
- ${QtCharts_SOURCE_DIR})
-
set(QtCharts_include_dirs ${QtCharts_SOURCE_DIR}
${QtCharts_BINARY_DIR}
${Qt5Core_INCLUDE_DIRS}
@@ -94,6 +85,6 @@ create_pyside_module(QtCharts
QtCharts_include_dirs
QtCharts_libraries
QtCharts_deps
- QtCharts_typesystem_path
+ QtCharts_SOURCE_DIR
QtCharts_SRC
"")
diff --git a/sources/pyside2/PySide2/QtCharts/typesystem_charts.xml b/sources/pyside2/PySide2/QtCharts/typesystem_charts.xml
index 6c0c02a47..ca7646421 100644
--- a/sources/pyside2/PySide2/QtCharts/typesystem_charts.xml
+++ b/sources/pyside2/PySide2/QtCharts/typesystem_charts.xml
@@ -40,7 +40,7 @@
****************************************************************************/
-->
<typesystem package="PySide2.QtCharts">
- <load-typesystem name="typesystem_widgets.xml" generate="no" />
+ <load-typesystem name="QtWidgets/typesystem_widgets.xml" generate="no" />
<namespace-type name="QtCharts">
<object-type name="QAbstractAxis" since="5.7">
<enum-type name="AxisType"/>
diff --git a/sources/pyside2/PySide2/QtConcurrent/CMakeLists.txt b/sources/pyside2/PySide2/QtConcurrent/CMakeLists.txt
index 4a7fd53ff..4fb62ee99 100644
--- a/sources/pyside2/PySide2/QtConcurrent/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtConcurrent/CMakeLists.txt
@@ -6,10 +6,6 @@ ${QtConcurrent_GEN_DIR}/qtconcurrent_wrapper.cpp
${QtConcurrent_GEN_DIR}/qtconcurrent_module_wrapper.cpp
)
-make_path(QtConcurrent_typesystem_path ${QtCore_SOURCE_DIR}
- ${QtCore_BINARY_DIR}
- ${QtConcurrent_SOURCE_DIR})
-
set(QtConcurrent_include_dirs ${QtConcurrent_SOURCE_DIR}
${QtConcurrent_BINARY_DIR}
${Qt5Core_INCLUDE_DIRS}
@@ -30,6 +26,6 @@ create_pyside_module(QtConcurrent
QtConcurrent_include_dirs
QtConcurrent_libraries
QtConcurrent_deps
- QtConcurrent_typesystem_path
+ QtConcurrent_SOURCE_DIR
QtConcurrent_SRC
"")
diff --git a/sources/pyside2/PySide2/QtConcurrent/typesystem_concurrent.xml b/sources/pyside2/PySide2/QtConcurrent/typesystem_concurrent.xml
index 692e744a1..09f590914 100644
--- a/sources/pyside2/PySide2/QtConcurrent/typesystem_concurrent.xml
+++ b/sources/pyside2/PySide2/QtConcurrent/typesystem_concurrent.xml
@@ -40,7 +40,7 @@
****************************************************************************/
-->
<typesystem package="PySide2.QtConcurrent">
- <load-typesystem name="typesystem_core.xml" generate="no"/>
+ <load-typesystem name="QtCore/typesystem_core.xml" generate="no"/>
<!-- Qt5: this is currently the minimum possible QtConcurrent support, by just extracting
the name space from QtCore -->
diff --git a/sources/pyside2/PySide2/QtCore/CMakeLists.txt b/sources/pyside2/PySide2/QtCore/CMakeLists.txt
index 384243f7c..dd2e212b0 100644
--- a/sources/pyside2/PySide2/QtCore/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtCore/CMakeLists.txt
@@ -164,9 +164,6 @@ ${QtCore_GEN_DIR}/qtcore_module_wrapper.cpp
configure_file("${QtCore_SOURCE_DIR}/typesystem_core.xml.in"
"${QtCore_BINARY_DIR}/typesystem_core.xml" @ONLY)
-make_path(QtCore_typesystem_path ${QtCore_SOURCE_DIR})
-
-
set(QtCore_include_dirs ${QtCore_SOURCE_DIR}
${QtCore_BINARY_DIR}
${Qt5Core_INCLUDE_DIRS}
@@ -183,7 +180,7 @@ create_pyside_module(QtCore
QtCore_include_dirs
QtCore_libraries
""
- QtCore_typesystem_path
+ QtCore_SOURCE_DIR
QtCore_SRC
QtCore_gluecode
${QtCore_BINARY_DIR}/typesystem_core.xml)
diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core.xml.in b/sources/pyside2/PySide2/QtCore/typesystem_core.xml.in
index 4ccf6423f..58caaee55 100644
--- a/sources/pyside2/PySide2/QtCore/typesystem_core.xml.in
+++ b/sources/pyside2/PySide2/QtCore/typesystem_core.xml.in
@@ -40,6 +40,6 @@
****************************************************************************/
-->
<typesystem package="PySide2.QtCore">
- <load-typesystem name="typesystem_core_@AUTO_OS@.xml" generate="yes"/>
- <load-typesystem name="typesystem_core_common.xml" generate="yes"/>
+ <load-typesystem name="QtCore/typesystem_core_@AUTO_OS@.xml" generate="yes"/>
+ <load-typesystem name="QtCore/typesystem_core_common.xml" generate="yes"/>
</typesystem>
diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
index 0695436ed..a8dc54e98 100644
--- a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
+++ b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
@@ -354,7 +354,6 @@
</primitive-type>
<primitive-type name="QVariant" target-lang-api-name="PyObject">
- <include file-name="typeresolver.h" location="global"/>
<conversion-rule>
<native-to-target>
if (!%in.isValid())
@@ -797,7 +796,8 @@
<container-type name="QHash" type="hash">
<include file-name="QHash" location="global"/>
- <include file-name="pysideconversions.h" location="global"/>
+ <!-- Include to make enum flags work. -->
+ <include file-name="pysideqflags.h" location="global"/>
<conversion-rule>
<native-to-target>
<insert-template name="cppmap_to_pymap_conversion"/>
diff --git a/sources/pyside2/PySide2/QtDataVisualization/CMakeLists.txt b/sources/pyside2/PySide2/QtDataVisualization/CMakeLists.txt
index 54809807c..e61a70234 100644
--- a/sources/pyside2/PySide2/QtDataVisualization/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtDataVisualization/CMakeLists.txt
@@ -41,13 +41,6 @@ ${QtDataVisualization_GEN_DIR}/qtdatavisualization_wrapper.cpp
${QtDataVisualization_GEN_DIR}/qtdatavisualization_module_wrapper.cpp
)
-make_path(QtDataVisualization_typesystem_path
- ${QtCore_SOURCE_DIR}
- ${QtCore_BINARY_DIR}
- ${QtGui_SOURCE_DIR}
- ${QtGui_BINARY_DIR}
- ${QtDataVisualization_SOURCE_DIR})
-
set(QtDataVisualization_include_dirs ${QtDataVisualization_SOURCE_DIR}
${QtDataVisualization_BINARY_DIR}
${Qt5Core_INCLUDE_DIRS}
@@ -72,6 +65,6 @@ create_pyside_module(QtDataVisualization
QtDataVisualization_include_dirs
QtDataVisualization_libraries
QtDataVisualization_deps
- QtDataVisualization_typesystem_path
+ QtDataVisualization_SOURCE_DIR
QtDataVisualization_SRC
"")
diff --git a/sources/pyside2/PySide2/QtDataVisualization/typesystem_datavisualization.xml b/sources/pyside2/PySide2/QtDataVisualization/typesystem_datavisualization.xml
index bc2d66df4..6b628c9bf 100644
--- a/sources/pyside2/PySide2/QtDataVisualization/typesystem_datavisualization.xml
+++ b/sources/pyside2/PySide2/QtDataVisualization/typesystem_datavisualization.xml
@@ -74,7 +74,7 @@
result.append(row);
}
</template>
- <load-typesystem name="typesystem_gui.xml" generate="no" />
+ <load-typesystem name="QtGui/typesystem_gui.xml" generate="no" />
<namespace-type name="QtDataVisualization">
<primitive-type name="QBarDataArray">
<include file-name="qbardataproxy.h" location="global"/>
diff --git a/sources/pyside2/PySide2/QtGui/CMakeLists.txt b/sources/pyside2/PySide2/QtGui/CMakeLists.txt
index b0973debe..b21120115 100644
--- a/sources/pyside2/PySide2/QtGui/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtGui/CMakeLists.txt
@@ -192,9 +192,6 @@ ${QtGui_GEN_DIR}/qtgui_module_wrapper.cpp
configure_file("${QtGui_SOURCE_DIR}/typesystem_gui.xml.in"
"${QtGui_BINARY_DIR}/typesystem_gui.xml" @ONLY)
-make_path(QtGui_typesystem_path ${QtCore_SOURCE_DIR} ${QtCore_BINARY_DIR}
- ${QtGui_SOURCE_DIR})
-
set(QtGui_include_dirs ${QtGui_SOURCE_DIR}
${QtGui_BINARY_DIR}
${pyside2_SOURCE_DIR}
@@ -215,7 +212,7 @@ create_pyside_module(QtGui
QtGui_include_dirs
QtGui_libraries
QtGui_deps
- QtGui_typesystem_path
+ QtGui_SOURCE_DIR
QtGui_SRC
QPYTEXTOBJECT_MOC
${QtGui_BINARY_DIR}/typesystem_gui.xml)
diff --git a/sources/pyside2/PySide2/QtGui/typesystem_gui.xml.in b/sources/pyside2/PySide2/QtGui/typesystem_gui.xml.in
index 0de65876a..ee909875e 100644
--- a/sources/pyside2/PySide2/QtGui/typesystem_gui.xml.in
+++ b/sources/pyside2/PySide2/QtGui/typesystem_gui.xml.in
@@ -40,7 +40,7 @@
****************************************************************************/
-->
<typesystem package="PySide2.QtGui">
- <load-typesystem name="typesystem_core.xml" generate="no"/>
- <load-typesystem name="typesystem_gui_@AUTO_OS@.xml" generate="yes"/>
- <load-typesystem name="typesystem_gui_common.xml" generate="yes"/>
+ <load-typesystem name="QtCore/typesystem_core.xml" generate="no"/>
+ <load-typesystem name="QtGui/typesystem_gui_@AUTO_OS@.xml" generate="yes"/>
+ <load-typesystem name="QtGui/typesystem_gui_common.xml" generate="yes"/>
</typesystem>
diff --git a/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml b/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml
index 9260b3d38..b316d90ad 100644
--- a/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml
+++ b/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml
@@ -40,7 +40,7 @@
****************************************************************************/
-->
<typesystem package="PySide2.QtGui">
- <load-typesystem name="typesystem_core.xml" generate="no"/>
+ <load-typesystem name="QtCore/typesystem_core.xml" generate="no"/>
<template name="QFontCharFix">
int size = Shiboken::String::len(%PYARG_1);
diff --git a/sources/pyside2/PySide2/QtHelp/CMakeLists.txt b/sources/pyside2/PySide2/QtHelp/CMakeLists.txt
index ba8b419f3..6e3334a80 100644
--- a/sources/pyside2/PySide2/QtHelp/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtHelp/CMakeLists.txt
@@ -16,10 +16,6 @@ ${QtHelp_GEN_DIR}/qhelpsearchresultwidget_wrapper.cpp
${QtHelp_GEN_DIR}/qthelp_module_wrapper.cpp
)
-make_path(QtHelp_typesystem_path ${QtCore_SOURCE_DIR} ${QtGui_SOURCE_DIR} ${QtWidgets_SOURCE_DIR}
- ${QtCore_BINARY_DIR} ${QtGui_BINARY_DIR} ${QtWidgets_BINARY_DIR}
- ${QtHelp_SOURCE_DIR})
-
set(QtHelp_include_dirs ${QtHelp_SOURCE_DIR}
${QtHelp_BINARY_DIR}
${Qt5Core_INCLUDE_DIRS}
@@ -46,6 +42,6 @@ create_pyside_module(QtHelp
QtHelp_include_dirs
QtHelp_libraries
QtHelp_deps
- QtHelp_typesystem_path
+ QtHelp_SOURCE_DIR
QtHelp_SRC
"")
diff --git a/sources/pyside2/PySide2/QtHelp/typesystem_help.xml b/sources/pyside2/PySide2/QtHelp/typesystem_help.xml
index 4d42e7fb9..7668cf8ad 100644
--- a/sources/pyside2/PySide2/QtHelp/typesystem_help.xml
+++ b/sources/pyside2/PySide2/QtHelp/typesystem_help.xml
@@ -41,7 +41,7 @@
-->
<typesystem package="PySide2.QtHelp">
- <load-typesystem name="typesystem_widgets.xml" generate="no" />
+ <load-typesystem name="QtWidgets/typesystem_widgets.xml" generate="no" />
<value-type name="QHelpContentItem">
<modify-function signature="parent() const">
diff --git a/sources/pyside2/PySide2/QtMacExtras/CMakeLists.txt b/sources/pyside2/PySide2/QtMacExtras/CMakeLists.txt
index b23b20c5f..6c69a784c 100644
--- a/sources/pyside2/PySide2/QtMacExtras/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtMacExtras/CMakeLists.txt
@@ -9,12 +9,6 @@ ${QtMacExtras_GEN_DIR}/qmactoolbaritem_wrapper.cpp
${QtMacExtras_GEN_DIR}/qtmacextras_module_wrapper.cpp
)
-make_path(QtMacExtras_typesystem_path ${QtMacExtras_SOURCE_DIR}
- ${QtCore_SOURCE_DIR}
- ${QtCore_BINARY_DIR}
- ${QtGui_SOURCE_DIR}
- ${QtGui_BINARY_DIR})
-
set(QtMacExtras_include_dirs ${QtMacExtras_SOURCE_DIR}
${QtMacExtras_BINARY_DIR}
${Qt5MacExtras_INCLUDE_DIRS}
@@ -38,6 +32,6 @@ create_pyside_module(QtMacExtras
QtMacExtras_include_dirs
QtMacExtras_libraries
QtMacExtras_deps
- QtMacExtras_typesystem_path
+ QtMacExtras_SOURCE_DIR
QtMacExtras_SRC
"")
diff --git a/sources/pyside2/PySide2/QtMacExtras/typesystem_macextras.xml b/sources/pyside2/PySide2/QtMacExtras/typesystem_macextras.xml
index 55c7d0160..69c9bc963 100644
--- a/sources/pyside2/PySide2/QtMacExtras/typesystem_macextras.xml
+++ b/sources/pyside2/PySide2/QtMacExtras/typesystem_macextras.xml
@@ -40,8 +40,8 @@
****************************************************************************/
-->
<typesystem package="PySide2.QtMacExtras">
- <load-typesystem name="typesystem_core.xml" generate="no"/>
- <load-typesystem name="typesystem_gui.xml" generate="no"/>
+ <load-typesystem name="QtCore/typesystem_core.xml" generate="no"/>
+ <load-typesystem name="QtGui/typesystem_gui.xml" generate="no"/>
<function signature="qRegisterDraggedTypes(QStringList)" since="5.2"/>
diff --git a/sources/pyside2/PySide2/QtMultimedia/CMakeLists.txt b/sources/pyside2/PySide2/QtMultimedia/CMakeLists.txt
index a17455eec..cfca07862 100644
--- a/sources/pyside2/PySide2/QtMultimedia/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtMultimedia/CMakeLists.txt
@@ -82,10 +82,6 @@ ${QtMultimedia_GEN_DIR}/qvideowindowcontrol_wrapper.cpp
${QtMultimedia_GEN_DIR}/qtmultimedia_module_wrapper.cpp
)
-make_path(QtMultimedia_typesystem_path ${QtCore_SOURCE_DIR} ${QtGui_SOURCE_DIR} ${QtNetwork_SOURCE_DIR}
- ${QtCore_BINARY_DIR} ${QtGui_BINARY_DIR} ${QtNetwork_BINARY_DIR}
- ${QtMultimedia_SOURCE_DIR})
-
set(QtMultimedia_include_dirs ${QtMultimedia_SOURCE_DIR}
${QtMultimedia_BINARY_DIR}
${Qt5Core_INCLUDE_DIRS}
@@ -113,6 +109,6 @@ create_pyside_module(QtMultimedia
QtMultimedia_include_dirs
QtMultimedia_libraries
QtMultimedia_deps
- QtMultimedia_typesystem_path
+ QtMultimedia_SOURCE_DIR
QtMultimedia_SRC
"")
diff --git a/sources/pyside2/PySide2/QtMultimedia/typesystem_multimedia.xml b/sources/pyside2/PySide2/QtMultimedia/typesystem_multimedia.xml
index 275719f59..e89104284 100644
--- a/sources/pyside2/PySide2/QtMultimedia/typesystem_multimedia.xml
+++ b/sources/pyside2/PySide2/QtMultimedia/typesystem_multimedia.xml
@@ -40,6 +40,6 @@
****************************************************************************/
-->
<typesystem package="PySide2.QtMultimedia">
- <load-typesystem name="typesystem_multimedia_common.xml" generate="yes"/>
- <load-typesystem name="typesystem_multimedia_forward_declarations.xml" generate="yes"/>
+ <load-typesystem name="QtMultimedia/typesystem_multimedia_common.xml" generate="yes"/>
+ <load-typesystem name="QtMultimedia/typesystem_multimedia_forward_declarations.xml" generate="yes"/>
</typesystem>
diff --git a/sources/pyside2/PySide2/QtMultimedia/typesystem_multimedia_common.xml b/sources/pyside2/PySide2/QtMultimedia/typesystem_multimedia_common.xml
index f708d46ab..8058954a1 100644
--- a/sources/pyside2/PySide2/QtMultimedia/typesystem_multimedia_common.xml
+++ b/sources/pyside2/PySide2/QtMultimedia/typesystem_multimedia_common.xml
@@ -40,9 +40,9 @@
****************************************************************************/
-->
<typesystem package="PySide2.QtMultimedia">
- <load-typesystem name="typesystem_core.xml" generate="no" />
- <load-typesystem name="typesystem_gui.xml" generate="no" />
- <load-typesystem name="typesystem_network.xml" generate="no" />
+ <load-typesystem name="QtCore/typesystem_core.xml" generate="no" />
+ <load-typesystem name="QtGui/typesystem_gui.xml" generate="no" />
+ <load-typesystem name="QtNetwork/typesystem_network.xml" generate="no" />
<namespace-type name="QAudio">
<enum-type name="Error"/>
diff --git a/sources/pyside2/PySide2/QtMultimediaWidgets/CMakeLists.txt b/sources/pyside2/PySide2/QtMultimediaWidgets/CMakeLists.txt
index 1368fc3aa..abae2ceb7 100644
--- a/sources/pyside2/PySide2/QtMultimediaWidgets/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtMultimediaWidgets/CMakeLists.txt
@@ -9,11 +9,6 @@ ${QtMultimediaWidgets_GEN_DIR}/qvideowidgetcontrol_wrapper.cpp
${QtMultimediaWidgets_GEN_DIR}/qtmultimediawidgets_module_wrapper.cpp
)
-make_path(QtMultimediaWidgets_typesystem_path
- ${QtCore_SOURCE_DIR} ${QtGui_SOURCE_DIR} ${QtNetwork_SOURCE_DIR} ${QtWidgets_SOURCE_DIR} ${QtMultimedia_SOURCE_DIR}
- ${QtCore_BINARY_DIR} ${QtGui_BINARY_DIR} ${QtNetwork_BINARY_DIR} ${QtWidgets_BINARY_DIR} ${QtMultimedia_BINARY_DIR}
- ${QtMultimediaWidgets_SOURCE_DIR})
-
set(QtMultimediaWidgets_include_dirs ${QtMultimediaWidgets_SOURCE_DIR}
${QtMultimediaWidgets_BINARY_DIR}
${Qt5Core_INCLUDE_DIRS}
@@ -47,6 +42,6 @@ create_pyside_module(QtMultimediaWidgets
QtMultimediaWidgets_include_dirs
QtMultimediaWidgets_libraries
QtMultimediaWidgets_deps
- QtMultimediaWidgets_typesystem_path
+ QtMultimediaWidgets_SOURCE_DIR
QtMultimediaWidgets_SRC
"")
diff --git a/sources/pyside2/PySide2/QtMultimediaWidgets/typesystem_multimediawidgets.xml b/sources/pyside2/PySide2/QtMultimediaWidgets/typesystem_multimediawidgets.xml
index 76214baef..07f6f99c3 100644
--- a/sources/pyside2/PySide2/QtMultimediaWidgets/typesystem_multimediawidgets.xml
+++ b/sources/pyside2/PySide2/QtMultimediaWidgets/typesystem_multimediawidgets.xml
@@ -40,10 +40,10 @@
****************************************************************************/
-->
<typesystem package="PySide2.QtMultimediaWidgets">
- <load-typesystem name="typesystem_core.xml" generate="no" />
- <load-typesystem name="typesystem_gui.xml" generate="no" />
- <load-typesystem name="typesystem_multimedia_common.xml" generate="no" />
- <load-typesystem name="typesystem_widgets.xml" generate="no" />
+ <load-typesystem name="QtCore/typesystem_core.xml" generate="no" />
+ <load-typesystem name="QtGui/typesystem_gui.xml" generate="no" />
+ <load-typesystem name="QtMultimedia/typesystem_multimedia_common.xml" generate="no" />
+ <load-typesystem name="QtWidgets/typesystem_widgets.xml" generate="no" />
<object-type name="QCameraViewfinder"/>
<object-type name="QGraphicsVideoItem"/>
diff --git a/sources/pyside2/PySide2/QtNetwork/CMakeLists.txt b/sources/pyside2/PySide2/QtNetwork/CMakeLists.txt
index f01aaf77a..68037017d 100644
--- a/sources/pyside2/PySide2/QtNetwork/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtNetwork/CMakeLists.txt
@@ -43,10 +43,6 @@ ${QtNetwork_OPTIONAL_SRC}
${QtNetwork_GEN_DIR}/qtnetwork_module_wrapper.cpp
)
-make_path(QtNetwork_typesystem_path ${QtCore_SOURCE_DIR}
- ${QtCore_BINARY_DIR}
- ${QtNetwork_SOURCE_DIR})
-
set(QtNetwork_include_dirs ${QtNetwork_SOURCE_DIR}
${QtNetwork_BINARY_DIR}
${Qt5Core_INCLUDE_DIRS}
@@ -67,7 +63,7 @@ create_pyside_module(QtNetwork
QtNetwork_include_dirs
QtNetwork_libraries
QtNetwork_deps
- QtNetwork_typesystem_path
+ QtNetwork_SOURCE_DIR
QtNetwork_SRC
""
""
diff --git a/sources/pyside2/PySide2/QtNetwork/typesystem_network.xml b/sources/pyside2/PySide2/QtNetwork/typesystem_network.xml
index 2f8424ac7..06a402e3c 100644
--- a/sources/pyside2/PySide2/QtNetwork/typesystem_network.xml
+++ b/sources/pyside2/PySide2/QtNetwork/typesystem_network.xml
@@ -40,7 +40,7 @@
****************************************************************************/
-->
<typesystem package="PySide2.QtNetwork">
- <load-typesystem name="typesystem_core.xml" generate="no"/>
+ <load-typesystem name="QtCore/typesystem_core.xml" generate="no"/>
<namespace-type name="QSsl">
<enum-type name="AlternativeNameEntryType"/>
diff --git a/sources/pyside2/PySide2/QtOpenGL/CMakeLists.txt b/sources/pyside2/PySide2/QtOpenGL/CMakeLists.txt
index ebc08946c..9a8b64050 100644
--- a/sources/pyside2/PySide2/QtOpenGL/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtOpenGL/CMakeLists.txt
@@ -16,10 +16,6 @@ ${QtOpenGL_GEN_DIR}/qglwidget_wrapper.cpp
${QtOpenGL_GEN_DIR}/qtopengl_module_wrapper.cpp
)
-make_path(QtOpenGL_typesystem_path ${QtCore_SOURCE_DIR} ${QtGui_SOURCE_DIR} ${QtWidgets_SOURCE_DIR}
- ${QtCore_BINARY_DIR} ${QtGui_BINARY_DIR} ${QtWidgets_BINARY_DIR}
- ${QtOpenGL_SOURCE_DIR})
-
set(QtOpenGL_include_dirs ${QtOpenGL_SOURCE_DIR}
${Qt5Core_INCLUDE_DIRS}
${Qt5Gui_INCLUDE_DIRS}
@@ -45,6 +41,6 @@ create_pyside_module(QtOpenGL
QtOpenGL_include_dirs
QtOpenGL_libraries
QtOpenGL_deps
- QtOpenGL_typesystem_path
+ QtOpenGL_SOURCE_DIR
QtOpenGL_SRC
"")
diff --git a/sources/pyside2/PySide2/QtOpenGL/typesystem_opengl.xml b/sources/pyside2/PySide2/QtOpenGL/typesystem_opengl.xml
index 8dea5d67c..38cec3188 100644
--- a/sources/pyside2/PySide2/QtOpenGL/typesystem_opengl.xml
+++ b/sources/pyside2/PySide2/QtOpenGL/typesystem_opengl.xml
@@ -40,7 +40,7 @@
****************************************************************************/
-->
<typesystem package="PySide2.QtOpenGL">
- <load-typesystem name="typesystem_widgets.xml" generate="no" />
+ <load-typesystem name="QtWidgets/typesystem_widgets.xml" generate="no" />
<primitive-type name="GLbitfield"/>
<primitive-type name="GLboolean"/>
diff --git a/sources/pyside2/PySide2/QtPrintSupport/CMakeLists.txt b/sources/pyside2/PySide2/QtPrintSupport/CMakeLists.txt
index 023a5ac74..201dd6d69 100644
--- a/sources/pyside2/PySide2/QtPrintSupport/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtPrintSupport/CMakeLists.txt
@@ -13,10 +13,6 @@ ${QtPrintSupport_GEN_DIR}/qprintpreviewwidget_wrapper.cpp
${QtPrintSupport_GEN_DIR}/qtprintsupport_module_wrapper.cpp
)
-make_path(QtPrintSupport_typesystem_path ${QtCore_SOURCE_DIR} ${QtGui_SOURCE_DIR} ${QtWidgets_SOURCE_DIR}
- ${QtCore_BINARY_DIR} ${QtGui_BINARY_DIR} ${QtWidgets_BINARY_DIR}
- ${QtPrintSupport_SOURCE_DIR})
-
set(QtPrintSupport_include_dirs ${QtPrintSupport_SOURCE_DIR}
${QtPrintSupport_BINARY_DIR}
${Qt5Core_INCLUDE_DIRS}
@@ -43,6 +39,6 @@ create_pyside_module(QtPrintSupport
QtPrintSupport_include_dirs
QtPrintSupport_libraries
QtPrintSupport_deps
- QtPrintSupport_typesystem_path
+ QtPrintSupport_SOURCE_DIR
QtPrintSupport_SRC
"")
diff --git a/sources/pyside2/PySide2/QtPrintSupport/typesystem_printsupport.xml b/sources/pyside2/PySide2/QtPrintSupport/typesystem_printsupport.xml
index 09f151af5..24f0de1d8 100644
--- a/sources/pyside2/PySide2/QtPrintSupport/typesystem_printsupport.xml
+++ b/sources/pyside2/PySide2/QtPrintSupport/typesystem_printsupport.xml
@@ -40,7 +40,7 @@
****************************************************************************/
-->
<typesystem package="PySide2.QtPrintSupport">
- <load-typesystem name="typesystem_widgets.xml" generate="no" />
+ <load-typesystem name="QtWidgets/typesystem_widgets.xml" generate="no" />
<object-type name="QPageSetupDialog">
<modify-function signature="exec()" rename="exec_" allow-thread="yes"/>
diff --git a/sources/pyside2/PySide2/QtQml/CMakeLists.txt b/sources/pyside2/PySide2/QtQml/CMakeLists.txt
index 0607e905f..fb09443c1 100644
--- a/sources/pyside2/PySide2/QtQml/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtQml/CMakeLists.txt
@@ -34,10 +34,6 @@ ${QtQml_GEN_DIR}/qqmlnetworkaccessmanagerfactory_wrapper.cpp
${QtQml_GEN_DIR}/qtqml_module_wrapper.cpp
)
-make_path(QtQml_typesystem_path ${QtCore_SOURCE_DIR} ${QtGui_SOURCE_DIR} ${QtNetwork_SOURCE_DIR}
- ${QtCore_BINARY_DIR} ${QtGui_BINARY_DIR} ${QtNetwork_BINARY_DIR}
- ${QtQml_SOURCE_DIR})
-
set(QtQml_include_dirs ${QtQml_SOURCE_DIR}
${Qt5Core_INCLUDE_DIRS}
${Qt5Gui_INCLUDE_DIRS}
@@ -64,6 +60,6 @@ create_pyside_module(QtQml
QtQml_include_dirs
QtQml_libraries
QtQml_deps
- QtQml_typesystem_path
+ QtQml_SOURCE_DIR
QtQml_SRC
QtQml_registerType)
diff --git a/sources/pyside2/PySide2/QtQml/typesystem_qml.xml b/sources/pyside2/PySide2/QtQml/typesystem_qml.xml
index 427b82d90..54431a3af 100644
--- a/sources/pyside2/PySide2/QtQml/typesystem_qml.xml
+++ b/sources/pyside2/PySide2/QtQml/typesystem_qml.xml
@@ -40,9 +40,9 @@
****************************************************************************/
-->
<typesystem package="PySide2.QtQml">
- <load-typesystem name="typesystem_core.xml" generate="no"/>
- <load-typesystem name="typesystem_network.xml" generate="no"/>
- <load-typesystem name="typesystem_gui.xml" generate="no"/>
+ <load-typesystem name="QtCore/typesystem_core.xml" generate="no"/>
+ <load-typesystem name="QtNetwork/typesystem_network.xml" generate="no"/>
+ <load-typesystem name="QtGui/typesystem_gui.xml" generate="no"/>
<!-- This is to inform the generator that the VolatileBool python type exists -->
<custom-type name="VolatileBool" />
diff --git a/sources/pyside2/PySide2/QtQuick/CMakeLists.txt b/sources/pyside2/PySide2/QtQuick/CMakeLists.txt
index 491fc9d9e..01e369e7a 100644
--- a/sources/pyside2/PySide2/QtQuick/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtQuick/CMakeLists.txt
@@ -58,13 +58,6 @@ if (Qt5Quick_VERSION VERSION_GREATER 5.5.1)
)
endif()
-
-make_path(QtQuick_typesystem_path ${QtCore_SOURCE_DIR} ${QtCore_BINARY_DIR}
- ${QtGui_SOURCE_DIR} ${QtGui_BINARY_DIR}
- ${QtNetwork_SOURCE_DIR} ${QtNetwork_BINARY_DIR}
- ${QtQml_SOURCE_DIR} ${QtQml_BINARY_DIR}
- ${QtQuick_SOURCE_DIR})
-
set(QtQuick_include_dirs ${QtQuick_SOURCE_DIR}
${QtQml_SOURCE_DIR}
${Qt5Core_INCLUDE_DIRS}
@@ -95,6 +88,6 @@ create_pyside_module(QtQuick
QtQuick_include_dirs
QtQuick_libraries
QtQuick_deps
- QtQuick_typesystem_path
+ QtQuick_SOURCE_DIR
QtQuick_SRC
QtQuick_registerType)
diff --git a/sources/pyside2/PySide2/QtQuick/typesystem_quick.xml b/sources/pyside2/PySide2/QtQuick/typesystem_quick.xml
index 439c0bba7..5183ec798 100644
--- a/sources/pyside2/PySide2/QtQuick/typesystem_quick.xml
+++ b/sources/pyside2/PySide2/QtQuick/typesystem_quick.xml
@@ -40,10 +40,10 @@
****************************************************************************/
-->
<typesystem package="PySide2.QtQuick">
- <load-typesystem name="typesystem_core.xml" generate="no"/>
- <load-typesystem name="typesystem_network.xml" generate="no"/>
- <load-typesystem name="typesystem_gui.xml" generate="no"/>
- <load-typesystem name="typesystem_qml.xml" generate="no"/>
+ <load-typesystem name="QtCore/typesystem_core.xml" generate="no"/>
+ <load-typesystem name="QtNetwork/typesystem_network.xml" generate="no"/>
+ <load-typesystem name="QtGui/typesystem_gui.xml" generate="no"/>
+ <load-typesystem name="QtQml/typesystem_qml.xml" generate="no"/>
<smart-pointer-type name="QSharedPointer" type="shared" getter="data" />
diff --git a/sources/pyside2/PySide2/QtQuickWidgets/CMakeLists.txt b/sources/pyside2/PySide2/QtQuickWidgets/CMakeLists.txt
index 1519d1cfd..86991208a 100644
--- a/sources/pyside2/PySide2/QtQuickWidgets/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtQuickWidgets/CMakeLists.txt
@@ -6,12 +6,6 @@ ${QtQuickWidgets_GEN_DIR}/qquickwidget_wrapper.cpp
${QtQuickWidgets_GEN_DIR}/qtquickwidgets_module_wrapper.cpp
)
-make_path(QtQuickWidgets_typesystem_path ${QtCore_SOURCE_DIR} ${QtGui_SOURCE_DIR} ${QtWidgets_SOURCE_DIR}
- ${QtCore_BINARY_DIR} ${QtGui_BINARY_DIR} ${QtWidgets_BINARY_DIR}
- ${QtNetwork_SOURCE_DIR} ${QtNetwork_BINARY_DIR} ${QtQuick_SOURCE_DIR}
- ${QtQuick_BINARY_DIR} ${QtQml_SOURCE_DIR} ${QtQml_BINARY_DIR}
- ${QtQuickWidgets_SOURCE_DIR})
-
set(QtQuickWidgets_include_dirs ${QtQuickWidgets_SOURCE_DIR}
${QtQml_SOURCE_DIR}
${Qt5Core_INCLUDE_DIRS}
@@ -48,6 +42,6 @@ create_pyside_module(QtQuickWidgets
QtQuickWidgets_include_dirs
QtQuickWidgets_libraries
QtQuickWidgets_deps
- QtQuickWidgets_typesystem_path
+ QtQuickWidgets_SOURCE_DIR
QtQuickWidgets_SRC
"")
diff --git a/sources/pyside2/PySide2/QtQuickWidgets/typesystem_quickwidgets.xml b/sources/pyside2/PySide2/QtQuickWidgets/typesystem_quickwidgets.xml
index 10a269067..782ca0360 100644
--- a/sources/pyside2/PySide2/QtQuickWidgets/typesystem_quickwidgets.xml
+++ b/sources/pyside2/PySide2/QtQuickWidgets/typesystem_quickwidgets.xml
@@ -40,15 +40,15 @@
****************************************************************************/
-->
<typesystem package="PySide2.QtQuickWidgets">
- <load-typesystem name="typesystem_core.xml" generate="no"/>
- <load-typesystem name="typesystem_gui.xml" generate="no"/>
- <load-typesystem name="typesystem_quick.xml" generate="no"/>
- <load-typesystem name="typesystem_qml.xml" generate="no"/>
- <load-typesystem name="typesystem_widgets.xml" generate="no"/>
+ <load-typesystem name="QtCore/typesystem_core.xml" generate="no"/>
+ <load-typesystem name="QtGui/typesystem_gui.xml" generate="no"/>
+ <load-typesystem name="QtQuick/typesystem_quick.xml" generate="no"/>
+ <load-typesystem name="QtQml/typesystem_qml.xml" generate="no"/>
+ <load-typesystem name="QtWidgets/typesystem_widgets.xml" generate="no"/>
<object-type name="QQuickWidget">
<enum-type name="ResizeMode" />
<enum-type name="Status" />
</object-type>
-</typesystem> \ No newline at end of file
+</typesystem>
diff --git a/sources/pyside2/PySide2/QtScript/CMakeLists.txt b/sources/pyside2/PySide2/QtScript/CMakeLists.txt
index 5b5d08070..1e06c4644 100644
--- a/sources/pyside2/PySide2/QtScript/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtScript/CMakeLists.txt
@@ -18,8 +18,6 @@ ${QtScript_GEN_DIR}/qscriptvalueiterator_wrapper.cpp
${QtScript_GEN_DIR}/qtscript_module_wrapper.cpp
)
-make_path(QtScript_typesystem_path ${QtCore_SOURCE_DIR} ${QtCore_BINARY_DIR})
-
set(QtScript_include_dirs ${QtScript_SOURCE_DIR}
${QtScript_BINARY_DIR}
${Qt5Core_INCLUDE_DIRS}
@@ -39,6 +37,6 @@ create_pyside_module(QtScript
QtScript_include_dirs
QtScript_libraries
QtScript_deps
- QtScript_typesystem_path
+ QtScript_SOURCE_DIR
QtScript_SRC
"")
diff --git a/sources/pyside2/PySide2/QtScript/qscript_value_iterator_glue.cpp b/sources/pyside2/PySide2/QtScript/qscript_value_iterator_glue.cpp
new file mode 100644
index 000000000..fd9cd84a3
--- /dev/null
+++ b/sources/pyside2/PySide2/QtScript/qscript_value_iterator_glue.cpp
@@ -0,0 +1,3 @@
+%PYARG_0 = Shiboken::Object::newObject(
+ reinterpret_cast<SbkObjectType*>(Shiboken::SbkType< ::QScriptValueIterator >()),
+ new QScriptValueIterator(*%CPPSELF), true, true);
diff --git a/sources/pyside2/PySide2/QtScript/typesystem_script.xml b/sources/pyside2/PySide2/QtScript/typesystem_script.xml
index 9dbd107a1..4467f1de9 100644
--- a/sources/pyside2/PySide2/QtScript/typesystem_script.xml
+++ b/sources/pyside2/PySide2/QtScript/typesystem_script.xml
@@ -40,7 +40,7 @@
****************************************************************************/
-->
<typesystem package="PySide2.QtScript">
- <load-typesystem name="typesystem_core.xml" generate="no" />
+ <load-typesystem name="QtCore/typesystem_core.xml" generate="no" />
<object-type name="QScriptable"/>
<object-type name="QScriptClass">
@@ -106,9 +106,7 @@
</inject-code>
</add-function>
<add-function signature="__iter__()" return-type="PyObject*">
- <inject-code>
- %PYARG_0 = Shiboken::createWrapper(new QScriptValueIterator(*%CPPSELF), true, true);
- </inject-code>
+ <inject-code file="qscript_value_iterator_glue.cpp" />
</add-function>
</value-type>
<object-type name="QScriptValueIterator">
diff --git a/sources/pyside2/PySide2/QtScriptTools/CMakeLists.txt b/sources/pyside2/PySide2/QtScriptTools/CMakeLists.txt
index 436522070..92bf1a545 100644
--- a/sources/pyside2/PySide2/QtScriptTools/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtScriptTools/CMakeLists.txt
@@ -6,11 +6,6 @@ ${QtScriptTools_GEN_DIR}/qscriptenginedebugger_wrapper.cpp
${QtScriptTools_GEN_DIR}/qtscripttools_module_wrapper.cpp
)
-make_path(QtScriptTools_typesystem_path ${QtCore_SOURCE_DIR} ${QtGui_SOURCE_DIR} ${QtScript_SOURCE_DIR}
- ${QtCore_BINARY_DIR} ${QtGui_BINARY_DIR} ${QtScript_BINARY_DIR}
- ${QtWidgets_SOURCE_DIR} ${QtWidgets_BINARY_DIR}
- ${QtScriptTools_SOURCE_DIR})
-
set(QtScriptTools_include_dirs ${QtScriptTools_SOURCE_DIR}
${QtScriptTools_BINARY_DIR}
${Qt5Core_INCLUDE_DIRS}
@@ -41,6 +36,6 @@ create_pyside_module(QtScriptTools
QtScriptTools_include_dirs
QtScriptTools_libraries
QtScriptTools_deps
- QtScriptTools_typesystem_path
+ QtScriptTools_SOURCE_DIR
QtScriptTools_SRC
"")
diff --git a/sources/pyside2/PySide2/QtScriptTools/typesystem_scripttools.xml b/sources/pyside2/PySide2/QtScriptTools/typesystem_scripttools.xml
index 15bda4059..023e03ba1 100644
--- a/sources/pyside2/PySide2/QtScriptTools/typesystem_scripttools.xml
+++ b/sources/pyside2/PySide2/QtScriptTools/typesystem_scripttools.xml
@@ -40,9 +40,9 @@
****************************************************************************/
-->
<typesystem package="PySide2.QtScriptTools">
- <load-typesystem name="typesystem_script.xml" generate="no" />
- <load-typesystem name="typesystem_gui.xml" generate="no" />
- <load-typesystem name="typesystem_widgets.xml" generate="no" />
+ <load-typesystem name="QtScript/typesystem_script.xml" generate="no" />
+ <load-typesystem name="QtGui/typesystem_gui.xml" generate="no" />
+ <load-typesystem name="QtWidgets/typesystem_widgets.xml" generate="no" />
<object-type name="QScriptEngineDebugger">
<enum-type name="DebuggerAction"/>
diff --git a/sources/pyside2/PySide2/QtSql/CMakeLists.txt b/sources/pyside2/PySide2/QtSql/CMakeLists.txt
index fe05d4679..dd78c2388 100644
--- a/sources/pyside2/PySide2/QtSql/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtSql/CMakeLists.txt
@@ -20,10 +20,6 @@ ${QtSql_GEN_DIR}/qsqltablemodel_wrapper.cpp
${QtSql_GEN_DIR}/qtsql_module_wrapper.cpp
)
-make_path(QtSql_typesystem_path ${QtCore_SOURCE_DIR} ${QtGui_SOURCE_DIR} ${QtWidgets_SOURCE_DIR}
- ${QtCore_BINARY_DIR} ${QtGui_BINARY_DIR} ${QtWidgets_BINARY_DIR}
- ${QtSql_SOURCE_DIR})
-
set(QtSql_include_dirs ${QtSql_SOURCE_DIR}
${QtSql_BINARY_DIR}
${Qt5Core_INCLUDE_DIRS}
@@ -50,6 +46,6 @@ create_pyside_module(QtSql
QtSql_include_dirs
QtSql_libraries
QtSql_deps
- QtSql_typesystem_path
+ QtSql_SOURCE_DIR
QtSql_SRC
"")
diff --git a/sources/pyside2/PySide2/QtSql/typesystem_sql.xml b/sources/pyside2/PySide2/QtSql/typesystem_sql.xml
index b3d4f2837..46836ef96 100644
--- a/sources/pyside2/PySide2/QtSql/typesystem_sql.xml
+++ b/sources/pyside2/PySide2/QtSql/typesystem_sql.xml
@@ -40,7 +40,7 @@
****************************************************************************/
-->
<typesystem package="PySide2.QtSql">
- <load-typesystem name="typesystem_widgets.xml" generate="no"/>
+ <load-typesystem name="QtWidgets/typesystem_widgets.xml" generate="no"/>
<rejection class="QSqlDriverCreator"/>
<rejection class="QSqlDriverPlugin"/>
diff --git a/sources/pyside2/PySide2/QtSvg/CMakeLists.txt b/sources/pyside2/PySide2/QtSvg/CMakeLists.txt
index 62db9e4ce..72914b188 100644
--- a/sources/pyside2/PySide2/QtSvg/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtSvg/CMakeLists.txt
@@ -9,10 +9,6 @@ ${QtSvg_GEN_DIR}/qsvgwidget_wrapper.cpp
${QtSvg_GEN_DIR}/qtsvg_module_wrapper.cpp
)
-make_path(QtSvg_typesystem_path ${QtCore_SOURCE_DIR} ${QtGui_SOURCE_DIR} ${QtWidgets_SOURCE_DIR}
- ${QtCore_BINARY_DIR} ${QtGui_BINARY_DIR} ${QtWidgets_BINARY_DIR}
- ${QtSvg_SOURCE_DIR})
-
set(QtSvg_include_dirs ${QtSvg_SOURCE_DIR}
${QtSvg_BINARY_DIR}
${Qt5Core_INCLUDE_DIRS}
@@ -40,6 +36,6 @@ create_pyside_module(QtSvg
QtSvg_include_dirs
QtSvg_libraries
QtSvg_deps
- QtSvg_typesystem_path
+ QtSvg_SOURCE_DIR
QtSvg_SRC
"")
diff --git a/sources/pyside2/PySide2/QtSvg/typesystem_svg.xml b/sources/pyside2/PySide2/QtSvg/typesystem_svg.xml
index 603fe7897..059abb891 100644
--- a/sources/pyside2/PySide2/QtSvg/typesystem_svg.xml
+++ b/sources/pyside2/PySide2/QtSvg/typesystem_svg.xml
@@ -40,7 +40,7 @@
****************************************************************************/
-->
<typesystem package="PySide2.QtSvg">
- <load-typesystem name="typesystem_widgets.xml" generate="no"/>
+ <load-typesystem name="QtWidgets/typesystem_widgets.xml" generate="no"/>
<object-type name="QSvgRenderer" />
<object-type name="QSvgWidget" />
diff --git a/sources/pyside2/PySide2/QtTest/CMakeLists.txt b/sources/pyside2/PySide2/QtTest/CMakeLists.txt
index 118f803ea..5893de7ba 100644
--- a/sources/pyside2/PySide2/QtTest/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtTest/CMakeLists.txt
@@ -7,10 +7,6 @@ ${QtTest_GEN_DIR}/qtest_wrapper.cpp
${QtTest_GEN_DIR}/qttest_module_wrapper.cpp
)
-make_path(QtTest_typesystem_path ${QtCore_SOURCE_DIR} ${QtGui_SOURCE_DIR} ${QtWidgets_SOURCE_DIR}
- ${QtCore_BINARY_DIR} ${QtGui_BINARY_DIR} ${QtWidgets_BINARY_DIR}
- ${QtTest_SOURCE_DIR})
-
set(QtTest_include_dirs ${QtTest_SOURCE_DIR}
${QtTest_BINARY_DIR}
${Qt5Core_INCLUDE_DIRS}
@@ -38,6 +34,6 @@ create_pyside_module(QtTest
QtTest_include_dirs
QtTest_libraries
QtTest_deps
- QtTest_typesystem_path
+ QtTest_SOURCE_DIR
QtTest_SRC
"")
diff --git a/sources/pyside2/PySide2/QtTest/typesystem_test.xml b/sources/pyside2/PySide2/QtTest/typesystem_test.xml
index b30a6b5da..da26370a1 100644
--- a/sources/pyside2/PySide2/QtTest/typesystem_test.xml
+++ b/sources/pyside2/PySide2/QtTest/typesystem_test.xml
@@ -40,9 +40,9 @@
****************************************************************************/
-->
<typesystem package="PySide2.QtTest">
- <load-typesystem name="typesystem_core.xml" generate="no"/>
- <load-typesystem name="typesystem_gui.xml" generate="no"/>
- <load-typesystem name="typesystem_widgets.xml" generate="no"/>
+ <load-typesystem name="QtCore/typesystem_core.xml" generate="no"/>
+ <load-typesystem name="QtGui/typesystem_gui.xml" generate="no"/>
+ <load-typesystem name="QtWidgets/typesystem_widgets.xml" generate="no"/>
<rejection class="QTest" function-name="qCompare&lt;char&gt;"/>
<rejection class="QTest" function-name="qCompare&lt;char*&gt;"/>
diff --git a/sources/pyside2/PySide2/QtTextToSpeech/CMakeLists.txt b/sources/pyside2/PySide2/QtTextToSpeech/CMakeLists.txt
index c616e1234..63b5a3669 100644
--- a/sources/pyside2/PySide2/QtTextToSpeech/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtTextToSpeech/CMakeLists.txt
@@ -8,11 +8,6 @@ ${QtTextToSpeech_GEN_DIR}/qvoice_wrapper.cpp
${QtTextToSpeech_GEN_DIR}/qttexttospeech_module_wrapper.cpp
)
-make_path(QtTextToSpeech_typesystem_path
- ${QtCore_SOURCE_DIR}
- ${QtCore_BINARY_DIR}
- ${QtTextToSpeech_SOURCE_DIR})
-
set(QtTextToSpeech_include_dirs ${QtTextToSpeech_SOURCE_DIR}
${QtTextToSpeech_BINARY_DIR}
${Qt5Core_INCLUDE_DIRS}
@@ -35,6 +30,6 @@ create_pyside_module(QtTextToSpeech
QtTextToSpeech_include_dirs
QtTextToSpeech_libraries
QtTextToSpeech_deps
- QtTextToSpeech_typesystem_path
+ QtTextToSpeech_SOURCE_DIR
QtTextToSpeech_SRC
"")
diff --git a/sources/pyside2/PySide2/QtTextToSpeech/typesystem_texttospeech.xml b/sources/pyside2/PySide2/QtTextToSpeech/typesystem_texttospeech.xml
index ebe73a0b4..d5006de6f 100644
--- a/sources/pyside2/PySide2/QtTextToSpeech/typesystem_texttospeech.xml
+++ b/sources/pyside2/PySide2/QtTextToSpeech/typesystem_texttospeech.xml
@@ -40,7 +40,7 @@
****************************************************************************/
-->
<typesystem package="PySide2.QtTextToSpeech">
- <load-typesystem name="typesystem_core.xml" generate="no" />
+ <load-typesystem name="QtCore/typesystem_core.xml" generate="no" />
<object-type name="QTextToSpeech">
<enum-type name="State"/>
diff --git a/sources/pyside2/PySide2/QtUiTools/CMakeLists.txt b/sources/pyside2/PySide2/QtUiTools/CMakeLists.txt
index b7ae6974d..e4de03f49 100644
--- a/sources/pyside2/PySide2/QtUiTools/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtUiTools/CMakeLists.txt
@@ -6,11 +6,6 @@ ${QtUiTools_GEN_DIR}/quiloader_wrapper.cpp
${QtUiTools_GEN_DIR}/qtuitools_module_wrapper.cpp
)
-make_path(QtUiTools_typesystem_path
- ${QtCore_SOURCE_DIR} ${QtGui_SOURCE_DIR} ${QtWidgets_SOURCE_DIR} ${QtXml_SOURCE_DIR}
- ${QtCore_BINARY_DIR} ${QtGui_BINARY_DIR} ${QtWidgets_BINARY_DIR} ${QtXml_BINARY_DIR}
- ${QtUiTools_SOURCE_DIR})
-
set(QtUiTools_include_dirs ${QtUiTools_SOURCE_DIR}
${QtUiTools_BINARY_DIR}
${Qt5Core_INCLUDE_DIRS}
@@ -41,6 +36,6 @@ create_pyside_module(QtUiTools
QtUiTools_include_dirs
QtUiTools_libraries
QtUiTools_deps
- QtUiTools_typesystem_path
+ QtUiTools_SOURCE_DIR
QtUiTools_SRC
"")
diff --git a/sources/pyside2/PySide2/QtUiTools/typesystem_uitools.xml b/sources/pyside2/PySide2/QtUiTools/typesystem_uitools.xml
index a74af0076..f6dd0333b 100644
--- a/sources/pyside2/PySide2/QtUiTools/typesystem_uitools.xml
+++ b/sources/pyside2/PySide2/QtUiTools/typesystem_uitools.xml
@@ -41,8 +41,8 @@
-->
<typesystem package="PySide2.QtUiTools">
- <load-typesystem name="typesystem_widgets.xml" generate="no" />
- <load-typesystem name="typesystem_xml.xml" generate="no" />
+ <load-typesystem name="QtWidgets/typesystem_widgets.xml" generate="no" />
+ <load-typesystem name="QtXml/typesystem_xml.xml" generate="no" />
<object-type name="QUiLoader">
<extra-includes>
diff --git a/sources/pyside2/PySide2/QtWebChannel/CMakeLists.txt b/sources/pyside2/PySide2/QtWebChannel/CMakeLists.txt
index ae292844f..b7fee0d17 100644
--- a/sources/pyside2/PySide2/QtWebChannel/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtWebChannel/CMakeLists.txt
@@ -7,8 +7,6 @@ ${QtWebChannel_GEN_DIR}/qwebchannelabstracttransport_wrapper.cpp
${QtWebChannel_GEN_DIR}/qtwebchannel_module_wrapper.cpp
)
-make_path(QtWebChannel_typesystem_path ${QtCore_SOURCE_DIR} ${QtCore_BINARY_DIR} ${QtWebChannel_SOURCE_DIR})
-
set(QtWebChannel_include_dirs ${QtWebChannel_SOURCE_DIR}
${QtWebChannel_BINARY_DIR}
${Qt5Core_INCLUDE_DIRS}
@@ -30,6 +28,6 @@ create_pyside_module(QtWebChannel
QtWebChannel_include_dirs
QtWebChannel_libraries
QtWebChannel_deps
- QtWebChannel_typesystem_path
+ QtWebChannel_SOURCE_DIR
QtWebChannel_SRC
"")
diff --git a/sources/pyside2/PySide2/QtWebChannel/typesystem_webchannel.xml b/sources/pyside2/PySide2/QtWebChannel/typesystem_webchannel.xml
index c25d3f30a..153a4da83 100644
--- a/sources/pyside2/PySide2/QtWebChannel/typesystem_webchannel.xml
+++ b/sources/pyside2/PySide2/QtWebChannel/typesystem_webchannel.xml
@@ -40,7 +40,7 @@
****************************************************************************/
-->
<typesystem package="PySide2.QtWebChannel">
- <load-typesystem name="typesystem_core.xml" generate="no"/>
+ <load-typesystem name="QtCore/typesystem_core.xml" generate="no"/>
<object-type name="QWebChannel" />
<object-type name="QWebChannelAbstractTransport">
diff --git a/sources/pyside2/PySide2/QtWebEngineWidgets/CMakeLists.txt b/sources/pyside2/PySide2/QtWebEngineWidgets/CMakeLists.txt
index 1e82819f7..32d0643c8 100644
--- a/sources/pyside2/PySide2/QtWebEngineWidgets/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtWebEngineWidgets/CMakeLists.txt
@@ -15,13 +15,6 @@ ${QtWebEngineWidgets_GEN_DIR}/qwebengineview_wrapper.cpp
${QtWebEngineWidgets_GEN_DIR}/qtwebenginewidgets_module_wrapper.cpp
)
-make_path(QtWebEngineWidgets_typesystem_path
- ${QtCore_SOURCE_DIR} ${QtGui_SOURCE_DIR} ${QtWidgets_SOURCE_DIR}
- ${QtCore_BINARY_DIR} ${QtGui_BINARY_DIR} ${QtWidgets_BINARY_DIR}
- ${QtNetwork_SOURCE_DIR} ${QtNetwork_BINARY_DIR}
- ${QtWebChannel_SOURCE_DIR} ${QtWebChannel_BINARY_DIR}
- ${QtWebEngineWidgets_SOURCE_DIR})
-
set(QtWebEngineWidgets_include_dirs
${QtWebEngineWidgets_SOURCE_DIR}
${QtWebEngineWidgets_BINARY_DIR}
@@ -56,7 +49,7 @@ create_pyside_module(QtWebEngineWidgets
QtWebEngineWidgets_include_dirs
QtWebEngineWidgets_libraries
QtWebEngineWidgets_deps
- QtWebEngineWidgets_typesystem_path
+ QtWebEngineWidgets_SOURCE_DIR
QtWebEngineWidgets_SRC
"")
diff --git a/sources/pyside2/PySide2/QtWebEngineWidgets/typesystem_webenginewidgets.xml b/sources/pyside2/PySide2/QtWebEngineWidgets/typesystem_webenginewidgets.xml
index ad33de4c8..9462c3e41 100644
--- a/sources/pyside2/PySide2/QtWebEngineWidgets/typesystem_webenginewidgets.xml
+++ b/sources/pyside2/PySide2/QtWebEngineWidgets/typesystem_webenginewidgets.xml
@@ -40,11 +40,11 @@
****************************************************************************/
-->
<typesystem package="PySide2.QtWebEngineWidgets">
- <load-typesystem name="typesystem_core.xml" generate="no"/>
- <load-typesystem name="typesystem_gui.xml" generate="no"/>
- <load-typesystem name="typesystem_widgets.xml" generate="no"/>
- <load-typesystem name="typesystem_network.xml" generate="no"/>
- <load-typesystem name="typesystem_webchannel.xml" generate="no"/>
+ <load-typesystem name="QtCore/typesystem_core.xml" generate="no"/>
+ <load-typesystem name="QtGui/typesystem_gui.xml" generate="no"/>
+ <load-typesystem name="QtWidgets/typesystem_widgets.xml" generate="no"/>
+ <load-typesystem name="QtNetwork/typesystem_network.xml" generate="no"/>
+ <load-typesystem name="QtWebChannel/typesystem_webchannel.xml" generate="no"/>
<object-type name="QWebEngineCertificateError">
diff --git a/sources/pyside2/PySide2/QtWebKit/CMakeLists.txt b/sources/pyside2/PySide2/QtWebKit/CMakeLists.txt
index 6bbcbfd43..78f865cac 100644
--- a/sources/pyside2/PySide2/QtWebKit/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtWebKit/CMakeLists.txt
@@ -6,10 +6,6 @@ ${QtWebKit_GEN_DIR}/webcore_wrapper.cpp
${QtWebKit_GEN_DIR}/qtwebkit_module_wrapper.cpp
)
-make_path(QtWebKit_typesystem_path ${QtCore_SOURCE_DIR} ${QtGui_SOURCE_DIR} ${QtNetwork_SOURCE_DIR}
- ${QtCore_BINARY_DIR} ${QtGui_BINARY_DIR} ${QtNetwork_BINARY_DIR}
- ${QtWebKit_SOURCE_DIR})
-
set(QtWebKit_include_dirs ${QtWebKit_SOURCE_DIR}
${QtWebKit_BINARY_DIR}
${Qt5Core_INCLUDE_DIRS}
@@ -37,7 +33,7 @@ create_pyside_module(QtWebKit
QtWebKit_include_dirs
QtWebKit_libraries
QtWebKit_deps
- QtWebKit_typesystem_path
+ QtWebKit_SOURCE_DIR
QtWebKit_SRC
"")
diff --git a/sources/pyside2/PySide2/QtWebKit/typesystem_webkit.xml b/sources/pyside2/PySide2/QtWebKit/typesystem_webkit.xml
index c559c7c02..09b3917e3 100644
--- a/sources/pyside2/PySide2/QtWebKit/typesystem_webkit.xml
+++ b/sources/pyside2/PySide2/QtWebKit/typesystem_webkit.xml
@@ -40,9 +40,9 @@
****************************************************************************/
-->
<typesystem package="PySide2.QtWebKit">
- <load-typesystem name="typesystem_core.xml" generate="no"/>
- <load-typesystem name="typesystem_gui.xml" generate="no"/>
- <load-typesystem name="typesystem_network.xml" generate="no"/>
+ <load-typesystem name="QtCore/typesystem_core.xml" generate="no"/>
+ <load-typesystem name="QtGui/typesystem_gui.xml" generate="no"/>
+ <load-typesystem name="QtNetwork/typesystem_network.xml" generate="no"/>
<namespace-type name="WebCore"/>
diff --git a/sources/pyside2/PySide2/QtWebKitWidgets/CMakeLists.txt b/sources/pyside2/PySide2/QtWebKitWidgets/CMakeLists.txt
index fa57c8694..cd7aa32dd 100644
--- a/sources/pyside2/PySide2/QtWebKitWidgets/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtWebKitWidgets/CMakeLists.txt
@@ -29,13 +29,6 @@ ${QtWebKitWidgets_GEN_DIR}/qwebview_wrapper.cpp
${QtWebKitWidgets_GEN_DIR}/qtwebkitwidgets_module_wrapper.cpp
)
-make_path(QtWebKitWidgets_typesystem_path
- ${QtCore_SOURCE_DIR} ${QtGui_SOURCE_DIR} ${QtWidgets_SOURCE_DIR}
- ${QtCore_BINARY_DIR} ${QtGui_BINARY_DIR} ${QtWidgets_BINARY_DIR}
- ${QtWebKit_SOURCE_DIR} ${QtPrintSupport_SOURCE_DIR} ${QtNetwork_SOURCE_DIR}
- ${QtWebKit_BINARY_DIR} ${QtPrintSupport_BINARY_DIR} ${QtNetwork_BINARY_DIR}
- ${QtWebKitWidgets_SOURCE_DIR})
-
set(QtWebKitWidgets_include_dirs
${QtWebKitWidgets_SOURCE_DIR}
${QtWebKitWidgets_BINARY_DIR}
@@ -71,7 +64,7 @@ create_pyside_module(QtWebKitWidgets
QtWebKitWidgets_include_dirs
QtWebKitWidgets_libraries
QtWebKitWidgets_deps
- QtWebKitWidgets_typesystem_path
+ QtWebKitWidgets_SOURCE_DIR
QtWebKitWidgets_SRC
"")
diff --git a/sources/pyside2/PySide2/QtWebKitWidgets/typesystem_webkitwidgets.xml b/sources/pyside2/PySide2/QtWebKitWidgets/typesystem_webkitwidgets.xml
index 05061fa6c..945f8ebe0 100644
--- a/sources/pyside2/PySide2/QtWebKitWidgets/typesystem_webkitwidgets.xml
+++ b/sources/pyside2/PySide2/QtWebKitWidgets/typesystem_webkitwidgets.xml
@@ -40,11 +40,11 @@
****************************************************************************/
-->
<typesystem package="PySide2.QtWebKitWidgets">
- <load-typesystem name="typesystem_core.xml" generate="no"/>
- <load-typesystem name="typesystem_gui.xml" generate="no"/>
- <load-typesystem name="typesystem_widgets.xml" generate="no"/>
- <load-typesystem name="typesystem_webkit.xml" generate="no"/>
- <load-typesystem name="typesystem_network.xml" generate="no"/>
+ <load-typesystem name="QtCore/typesystem_core.xml" generate="no"/>
+ <load-typesystem name="QtGui/typesystem_gui.xml" generate="no"/>
+ <load-typesystem name="QtWidgets/typesystem_widgets.xml" generate="no"/>
+ <load-typesystem name="QtWebKit/typesystem_webkit.xml" generate="no"/>
+ <load-typesystem name="QtNetwork/typesystem_network.xml" generate="no"/>
<load-typesystem name="typesystem_printsupport.xml" generate="no"/>
<value-type name="QWebDatabase"/>
diff --git a/sources/pyside2/PySide2/QtWebSockets/CMakeLists.txt b/sources/pyside2/PySide2/QtWebSockets/CMakeLists.txt
index 9eb402644..495fd4e7b 100644
--- a/sources/pyside2/PySide2/QtWebSockets/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtWebSockets/CMakeLists.txt
@@ -10,9 +10,6 @@ ${QtWebSockets_GEN_DIR}/qwebsocketserver_wrapper.cpp
${QtWebSockets_GEN_DIR}/qtwebsockets_module_wrapper.cpp
)
-make_path(QtWebSockets_typesystem_path ${QtCore_SOURCE_DIR} ${QtCore_BINARY_DIR} ${QtNetwork_SOURCE_DIR}
- ${QtNetwork_BINARY_DIR} ${QtWebSockets_SOURCE_DIR})
-
set(QtWebSockets_include_dirs ${QtWebSockets_SOURCE_DIR}
${QtWebSockets_BINARY_DIR}
${Qt5Core_INCLUDE_DIRS}
@@ -39,6 +36,6 @@ create_pyside_module(QtWebSockets
QtWebSockets_include_dirs
QtWebSockets_libraries
QtWebSockets_deps
- QtWebSockets_typesystem_path
+ QtWebSockets_SOURCE_DIR
QtWebSockets_SRC
"")
diff --git a/sources/pyside2/PySide2/QtWebSockets/typesystem_websockets.xml b/sources/pyside2/PySide2/QtWebSockets/typesystem_websockets.xml
index 8671795c0..f528850e2 100644
--- a/sources/pyside2/PySide2/QtWebSockets/typesystem_websockets.xml
+++ b/sources/pyside2/PySide2/QtWebSockets/typesystem_websockets.xml
@@ -40,8 +40,8 @@
****************************************************************************/
-->
<typesystem package="PySide2.QtWebSockets">
- <load-typesystem name="typesystem_core.xml" generate="no"/>
- <load-typesystem name="typesystem_network.xml" generate="no"/>
+ <load-typesystem name="QtCore/typesystem_core.xml" generate="no"/>
+ <load-typesystem name="QtNetwork/typesystem_network.xml" generate="no"/>
<object-type name="QMaskGenerator" />
diff --git a/sources/pyside2/PySide2/QtWidgets/CMakeLists.txt b/sources/pyside2/PySide2/QtWidgets/CMakeLists.txt
index e401db47c..a1bcdb023 100644
--- a/sources/pyside2/PySide2/QtWidgets/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtWidgets/CMakeLists.txt
@@ -212,10 +212,6 @@ ${QtWidgets_GEN_DIR}/qtwidgets_module_wrapper.cpp
configure_file("${QtWidgets_SOURCE_DIR}/typesystem_widgets.xml.in"
"${QtWidgets_BINARY_DIR}/typesystem_widgets.xml" @ONLY)
-make_path(QtWidgets_typesystem_path ${QtCore_SOURCE_DIR} ${QtGui_SOURCE_DIR}
- ${QtCore_BINARY_DIR} ${QtGui_BINARY_DIR}
- ${QtWidgets_SOURCE_DIR})
-
set(QtWidgets_include_dirs ${QtWidgets_SOURCE_DIR}
${QtWidgets_BINARY_DIR}
${pyside2_SOURCE_DIR}
@@ -241,7 +237,7 @@ create_pyside_module(QtWidgets
QtWidgets_include_dirs
QtWidgets_libraries
QtWidgets_deps
- QtWidgets_typesystem_path
+ QtWidgets_SOURCE_DIR
QtWidgets_SRC
""
${QtWidgets_BINARY_DIR}/typesystem_widgets.xml)
diff --git a/sources/pyside2/PySide2/QtWidgets/typesystem_widgets.xml.in b/sources/pyside2/PySide2/QtWidgets/typesystem_widgets.xml.in
index e6952c2fe..bad39516c 100644
--- a/sources/pyside2/PySide2/QtWidgets/typesystem_widgets.xml.in
+++ b/sources/pyside2/PySide2/QtWidgets/typesystem_widgets.xml.in
@@ -40,7 +40,7 @@
****************************************************************************/
-->
<typesystem package="PySide2.QtWidgets">
- <load-typesystem name="typesystem_gui.xml" generate="no"/>
- <load-typesystem name="typesystem_widgets_@AUTO_OS@.xml" generate="yes"/>
- <load-typesystem name="typesystem_widgets_common.xml" generate="yes"/>
+ <load-typesystem name="QtGui/typesystem_gui.xml" generate="no"/>
+ <load-typesystem name="QtWidgets/typesystem_widgets_@AUTO_OS@.xml" generate="yes"/>
+ <load-typesystem name="QtWidgets/typesystem_widgets_common.xml" generate="yes"/>
</typesystem>
diff --git a/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml b/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml
index 624ef591a..d42547cd1 100644
--- a/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml
+++ b/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml
@@ -40,7 +40,7 @@
****************************************************************************/
-->
<typesystem package="PySide2.QtWidgets">
- <load-typesystem name="typesystem_gui.xml" generate="no"/>
+ <load-typesystem name="QtGui/typesystem_gui.xml" generate="no"/>
diff --git a/sources/pyside2/PySide2/QtWinExtras/CMakeLists.txt b/sources/pyside2/PySide2/QtWinExtras/CMakeLists.txt
index 4de437012..5932792e9 100644
--- a/sources/pyside2/PySide2/QtWinExtras/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtWinExtras/CMakeLists.txt
@@ -17,12 +17,6 @@ ${QtWinExtras_GEN_DIR}/qwinthumbnailtoolbutton_wrapper.cpp
${QtWinExtras_GEN_DIR}/qtwinextras_module_wrapper.cpp
)
-make_path(QtWinExtras_typesystem_path ${QtWinExtras_SOURCE_DIR}
- ${QtCore_SOURCE_DIR}
- ${QtCore_BINARY_DIR}
- ${QtGui_SOURCE_DIR}
- ${QtGui_BINARY_DIR})
-
set(QtWinExtras_include_dirs ${QtWinExtras_SOURCE_DIR}
${QtWinExtras_BINARY_DIR}
${Qt5WinExtras_INCLUDE_DIRS}
@@ -46,6 +40,6 @@ create_pyside_module(QtWinExtras
QtWinExtras_include_dirs
QtWinExtras_libraries
QtWinExtras_deps
- QtWinExtras_typesystem_path
+ QtWinExtras_SOURCE_DIR
QtWinExtras_SRC
"")
diff --git a/sources/pyside2/PySide2/QtWinExtras/typesystem_winextras.xml b/sources/pyside2/PySide2/QtWinExtras/typesystem_winextras.xml
index d7d400be9..3aa375ea9 100644
--- a/sources/pyside2/PySide2/QtWinExtras/typesystem_winextras.xml
+++ b/sources/pyside2/PySide2/QtWinExtras/typesystem_winextras.xml
@@ -40,8 +40,8 @@
****************************************************************************/
-->
<typesystem package="PySide2.QtWinExtras">
- <load-typesystem name="typesystem_core.xml" generate="no"/>
- <load-typesystem name="typesystem_gui.xml" generate="no"/>
+ <load-typesystem name="QtCore/typesystem_core.xml" generate="no"/>
+ <load-typesystem name="QtGui/typesystem_gui.xml" generate="no"/>
<object-type name="QWinEvent" since="5.2"/>
<object-type name="QWinColorizationChangeEvent" since="5.2"/>
diff --git a/sources/pyside2/PySide2/QtX11Extras/CMakeLists.txt b/sources/pyside2/PySide2/QtX11Extras/CMakeLists.txt
index 0af059ffe..f15f77375 100644
--- a/sources/pyside2/PySide2/QtX11Extras/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtX11Extras/CMakeLists.txt
@@ -6,12 +6,6 @@ ${QtX11Extras_GEN_DIR}/qx11info_wrapper.cpp
${QtX11Extras_GEN_DIR}/qtx11extras_module_wrapper.cpp
)
-make_path(QtX11Extras_typesystem_path ${QtX11Extras_SOURCE_DIR}
- ${QtCore_SOURCE_DIR}
- ${QtCore_BINARY_DIR}
- ${QtGui_SOURCE_DIR}
- ${QtGui_BINARY_DIR})
-
set(QtX11Extras_include_dirs ${QtX11Extras_SOURCE_DIR}
${QtX11Extras_BINARY_DIR}
${Qt5X11Extras_INCLUDE_DIRS}
@@ -35,6 +29,6 @@ create_pyside_module(QtX11Extras
QtX11Extras_include_dirs
QtX11Extras_libraries
QtX11Extras_deps
- QtX11Extras_typesystem_path
+ QtX11Extras_SOURCE_DIR
QtX11Extras_SRC
"")
diff --git a/sources/pyside2/PySide2/QtX11Extras/typesystem_x11extras.xml b/sources/pyside2/PySide2/QtX11Extras/typesystem_x11extras.xml
index 9aa527951..23d578ca6 100644
--- a/sources/pyside2/PySide2/QtX11Extras/typesystem_x11extras.xml
+++ b/sources/pyside2/PySide2/QtX11Extras/typesystem_x11extras.xml
@@ -41,7 +41,7 @@
****************************************************************************/
-->
<typesystem package="PySide2.QtX11Extras">
- <load-typesystem name="typesystem_core.xml" generate="no"/>
+ <load-typesystem name="QtCore/typesystem_core.xml" generate="no"/>
<object-type name="QX11Info" />
</typesystem>
diff --git a/sources/pyside2/PySide2/QtXml/CMakeLists.txt b/sources/pyside2/PySide2/QtXml/CMakeLists.txt
index 8dd06cc46..9c724cffb 100644
--- a/sources/pyside2/PySide2/QtXml/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtXml/CMakeLists.txt
@@ -36,9 +36,6 @@ ${QtXml_GEN_DIR}/qxmlsimplereader_wrapper.cpp
${QtXml_GEN_DIR}/qtxml_module_wrapper.cpp
)
-make_path(QtXml_typesystem_path ${QtCore_SOURCE_DIR} ${QtCore_BINARY_DIR}
- ${QtXml_SOURCE_DIR})
-
set(QtXml_include_dirs ${QtXml_SOURCE_DIR}
${QtXml_BINARY_DIR}
${CMAKE_SOURCE_DIR}
@@ -59,6 +56,6 @@ create_pyside_module(QtXml
QtXml_include_dirs
QtXml_libraries
QtXml_deps
- QtXml_typesystem_path
+ QtXml_SOURCE_DIR
QtXml_SRC
"")
diff --git a/sources/pyside2/PySide2/QtXml/typesystem_xml.xml b/sources/pyside2/PySide2/QtXml/typesystem_xml.xml
index ba0248342..d78a1d77c 100644
--- a/sources/pyside2/PySide2/QtXml/typesystem_xml.xml
+++ b/sources/pyside2/PySide2/QtXml/typesystem_xml.xml
@@ -41,7 +41,7 @@
-->
<typesystem package="PySide2.QtXml">
<load-typesystem name="typesystem_templates.xml" generate="no" />
- <load-typesystem name="typesystem_core.xml" generate="no" />
+ <load-typesystem name="QtCore/typesystem_core.xml" generate="no" />
<rejection class="QXmlAttributes::Attribute"/>
<rejection class="QDomNode" field-name="impl"/>
diff --git a/sources/pyside2/PySide2/QtXmlPatterns/CMakeLists.txt b/sources/pyside2/PySide2/QtXmlPatterns/CMakeLists.txt
index a10d40bf0..d279f43ae 100644
--- a/sources/pyside2/PySide2/QtXmlPatterns/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtXmlPatterns/CMakeLists.txt
@@ -20,9 +20,6 @@ ${QtXmlPatterns_GEN_DIR}/qxmlserializer_wrapper.cpp
${QtXmlPatterns_GEN_DIR}/qtxmlpatterns_module_wrapper.cpp
)
-make_path(QtXmlPatterns_typesystem_path ${QtCore_SOURCE_DIR} ${QtCore_BINARY_DIR}
- ${QtXmlPatterns_SOURCE_DIR})
-
set(QtXmlPatterns_include_dirs ${QtXmlPatterns_SOURCE_DIR}
${QtXmlPatterns_BINARY_DIR}
${Qt5Core_INCLUDE_DIRS}
@@ -42,7 +39,7 @@ create_pyside_module(QtXmlPatterns
QtXmlPatterns_include_dirs
QtXmlPatterns_libraries
QtXmlPatterns_deps
- QtXmlPatterns_typesystem_path
+ QtXmlPatterns_SOURCE_DIR
QtXmlPatterns_SRC
"")
diff --git a/sources/pyside2/PySide2/QtXmlPatterns/typesystem_xmlpatterns.xml b/sources/pyside2/PySide2/QtXmlPatterns/typesystem_xmlpatterns.xml
index 96970366f..888595ccc 100644
--- a/sources/pyside2/PySide2/QtXmlPatterns/typesystem_xmlpatterns.xml
+++ b/sources/pyside2/PySide2/QtXmlPatterns/typesystem_xmlpatterns.xml
@@ -40,7 +40,7 @@
****************************************************************************/
-->
<typesystem package="PySide2.QtXmlPatterns">
- <load-typesystem name="typesystem_core.xml" generate="no"/>
+ <load-typesystem name="QtCore/typesystem_core.xml" generate="no"/>
<object-type name="QXmlSchema" since="4.6" /> <!-- Qt scoped pointer does not allow declare this as value type -->
<object-type name="QXmlSchemaValidator" since="4.6">
diff --git a/sources/pyside2/PySide2/support/__init__.py b/sources/pyside2/PySide2/support/__init__.py
index b2085d892..6a6d267b6 100644
--- a/sources/pyside2/PySide2/support/__init__.py
+++ b/sources/pyside2/PySide2/support/__init__.py
@@ -37,4 +37,12 @@
##
#############################################################################
-# This file has intentionally no content.
+# Import VoidPtr type to expose it under PySide2.support.VoidPtr
+try:
+ # The normal import statement when PySide2 is installed.
+ from PySide2.shiboken2 import VoidPtr
+except ImportError:
+ # When running make test in shiboken build dir, or when running testrunner.py,
+ # shiboken2 is not part of the PySide2 module, so it needs to be imported as a standalone
+ # module.
+ from shiboken2 import VoidPtr
diff --git a/sources/pyside2/cmake/Macros/PySideModules.cmake b/sources/pyside2/cmake/Macros/PySideModules.cmake
index c4177a8d7..9c39980cb 100644
--- a/sources/pyside2/cmake/Macros/PySideModules.cmake
+++ b/sources/pyside2/cmake/Macros/PySideModules.cmake
@@ -54,15 +54,14 @@ macro(create_pyside_module
# First add the main file.
set(total_type_system_files ${typesystem_path})
- # Transform the path separator list back into a cmake list (so from a:b:c to a;b;c)
- unmake_path(list_of_paths ${${module_typesystem_path}})
+ get_filename_component(typesystem_root "${CMAKE_CURRENT_SOURCE_DIR}" DIRECTORY)
- # Collect all XML files, in each given path, and append them to the final total list.
- foreach(type_system_files_path ${list_of_paths})
- set(glob_expression "${type_system_files_path}/*.xml")
+ set(deps ${module_name} ${${module_deps}})
+ foreach(dep ${deps})
+ set(glob_expression "${typesystem_root}/${dep}/*.xml")
file(GLOB type_system_files ${glob_expression})
set(total_type_system_files ${total_type_system_files} ${type_system_files})
- endforeach(type_system_files_path)
+ endforeach(dep)
# Remove any possible duplicates.
list(REMOVE_DUPLICATES total_type_system_files)
@@ -81,12 +80,14 @@ macro(create_pyside_module
# Transform the path separators into something shiboken understands.
make_path(shiboken_include_dirs ${shiboken_include_dirs})
+ get_filename_component(pyside_binary_dir ${CMAKE_CURRENT_BINARY_DIR} DIRECTORY)
+
add_custom_command(OUTPUT ${${module_sources}}
COMMAND "${SHIBOKEN_BINARY}" ${GENERATOR_EXTRA_FLAGS}
- ${pyside2_BINARY_DIR}/pyside2_global.h
+ "${pyside2_BINARY_DIR}/${module_name}_global.h"
--include-paths=${shiboken_include_dirs}
${shiboken_framework_include_dirs_option}
- --typesystem-paths=${pyside2_SOURCE_DIR}${PATH_SEP}${${module_typesystem_path}}
+ --typesystem-paths=${pyside_binary_dir}${PATH_SEP}${pyside2_SOURCE_DIR}${PATH_SEP}${${module_typesystem_path}}
--output-directory=${CMAKE_CURRENT_BINARY_DIR}
--license-file=${CMAKE_CURRENT_SOURCE_DIR}/../licensecomment.txt
${typesystem_path}
diff --git a/sources/pyside2/libpyside/CMakeLists.txt b/sources/pyside2/libpyside/CMakeLists.txt
index 05e383307..1cddebc07 100644
--- a/sources/pyside2/libpyside/CMakeLists.txt
+++ b/sources/pyside2/libpyside/CMakeLists.txt
@@ -120,7 +120,6 @@ set(libpyside_HEADERS
dynamicqmetaobject.h
globalreceiver.h
pysideclassinfo.h
- pysideconversions.h
pysidemacros.h
signalmanager.h
pyside.h
diff --git a/sources/pyside2/libpyside/globalreceiver.cpp b/sources/pyside2/libpyside/globalreceiver.cpp
index e183e09ba..5e0aa0d66 100644
--- a/sources/pyside2/libpyside/globalreceiver.cpp
+++ b/sources/pyside2/libpyside/globalreceiver.cpp
@@ -49,7 +49,6 @@
#include <sbkconverter.h>
#include <gilstate.h>
-#include "typeresolver.h"
#include "signalmanager.h"
#define RECEIVER_DESTROYED_SLOT_NAME "__receiverDestroyed__(QObject*)"
diff --git a/sources/pyside2/libpyside/globalreceiverv2.cpp b/sources/pyside2/libpyside/globalreceiverv2.cpp
index a79d43c20..9e9bccbaf 100644
--- a/sources/pyside2/libpyside/globalreceiverv2.cpp
+++ b/sources/pyside2/libpyside/globalreceiverv2.cpp
@@ -48,7 +48,6 @@
#include <autodecref.h>
#include <gilstate.h>
-#include "typeresolver.h"
#include "signalmanager.h"
#define RECEIVER_DESTROYED_SLOT_NAME "__receiverDestroyed__(QObject*)"
diff --git a/sources/pyside2/libpyside/pyside.cpp b/sources/pyside2/libpyside/pyside.cpp
index d4e867c61..17366ce6e 100644
--- a/sources/pyside2/libpyside/pyside.cpp
+++ b/sources/pyside2/libpyside/pyside.cpp
@@ -50,14 +50,15 @@
#include "dynamicqmetaobject.h"
#include "destroylistener.h"
+#include <autodecref.h>
#include <qapp_macro.h>
#include <basewrapper.h>
-#include <conversions.h>
#include <sbkconverter.h>
+#include <sbkstring.h>
#include <gilstate.h>
-#include <typeresolver.h>
#include <bindingmanager.h>
#include <algorithm>
+#include <typeinfo>
#include <cstring>
#include <cctype>
#include <QStack>
diff --git a/sources/pyside2/libpyside/pysideconversions.h b/sources/pyside2/libpyside/pysideconversions.h
deleted file mode 100644
index ed8002fae..000000000
--- a/sources/pyside2/libpyside/pysideconversions.h
+++ /dev/null
@@ -1,275 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of PySide2.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef PYSIDECONVERSIONS_H
-#define PYSIDECONVERSIONS_H
-
-#include <sbkpython.h>
-#include <QFlag>
-#include <conversions.h>
-#include <pysideqflags.h>
-
-template <typename QtDict>
-struct QtDictConverter
-{
- static inline bool checkType(PyObject* pyObj)
- {
- return isConvertible(pyObj);
- }
-
- static inline bool isConvertible(PyObject* pyObj)
- {
- if (PyObject_TypeCheck(pyObj, Shiboken::SbkType<QtDict>()))
- return true;
-
- if ((Shiboken::SbkType<QtDict>() && Shiboken::Object::checkType(pyObj)) || !PyDict_Check(pyObj))
- return false;
-
- PyObject* key;
- PyObject* value;
- Py_ssize_t pos = 0;
-
- while (PyDict_Next(pyObj, &pos, &key, &value)) {
- if (!Shiboken::Converter<typename QtDict::key_type>::isConvertible(key)
- && !Shiboken::Converter<typename QtDict::mapped_type>::isConvertible(value)) {
- return false;
- }
- }
- return true;
- }
-
- static inline PyObject* toPython(void* cppObj) { return toPython(*reinterpret_cast<QtDict*>(cppObj)); }
- static inline PyObject* toPython(const QtDict& cppobj)
- {
- PyObject* result = PyDict_New();
- typename QtDict::const_iterator it = cppobj.begin();
-
- for (; it != cppobj.end(); ++it) {
- Shiboken::AutoDecRef keyObj(Shiboken::Converter<typename QtDict::key_type>::toPython(it.key()));
- Shiboken::AutoDecRef valueObj(Shiboken::Converter<typename QtDict::mapped_type>::toPython(it.value()));
- PyDict_SetItem(result, keyObj, valueObj);
- }
-
- return result;
- }
- static inline QtDict toCpp(PyObject* pyobj)
- {
- if (PyObject_TypeCheck(pyobj, Shiboken::SbkType<QtDict>()))
- return *reinterpret_cast<QtDict *>(Shiboken::Object::cppPointer(reinterpret_cast<SbkObject *>(pyobj), Shiboken::SbkType<QtDict>()));
-
- QtDict result;
-
- PyObject* key;
- PyObject* value;
- Py_ssize_t pos = 0;
-
- while (PyDict_Next(pyobj, &pos, &key, &value))
- result[Shiboken::Converter<typename QtDict::key_type>::toCpp(key)] = Shiboken::Converter<typename QtDict::mapped_type>::toCpp(value);
- return result;
- }
-};
-
-template <typename MultiMap>
-struct QtMultiMapConverter
-{
- static inline bool checkType(PyObject* pyObj)
- {
- return isConvertible(pyObj);
- }
-
- static inline bool isConvertible(PyObject* pyObj)
- {
- if (PyObject_TypeCheck(pyObj, Shiboken::SbkType<MultiMap>()))
- return true;
-
- if ((Shiboken::SbkType<MultiMap>() && Shiboken::Object::checkType(pyObj)) || !PyDict_Check(pyObj))
- return false;
-
- PyObject* key;
- PyObject* value;
- Py_ssize_t pos = 0;
-
- while (PyDict_Next(pyObj, &pos, &key, &value)) {
- if (!Shiboken::Converter<typename MultiMap::key_type>::isConvertible(key)) {
- if (PySequence_Check(value)) {
- for (int i = 0, max = PySequence_Length(value); i < max; ++i) {
- Shiboken::AutoDecRef item(PySequence_GetItem(value, i));
- if (!Shiboken::Converter<typename MultiMap::mapped_type>::isConvertible(value))
- return false;
- }
- } else if (!Shiboken::Converter<typename MultiMap::mapped_type>::isConvertible(value)) {
- return false;
- }
- }
- }
- return true;
- }
-
- static inline PyObject* toPython(void* cppObj) { return toPython(*reinterpret_cast<MultiMap*>(cppObj)); }
- static inline PyObject* toPython(const MultiMap& cppObj)
- {
- PyObject* result = PyDict_New();
- typename MultiMap::const_iterator it = cppObj.begin();
-
- for (; it != cppObj.end(); ++it) {
- Shiboken::AutoDecRef key(Shiboken::Converter<typename MultiMap::key_type>::toPython(it.key()));
- Shiboken::AutoDecRef value(Shiboken::Converter<typename MultiMap::mapped_type>::toPython(it.value()));
-
- PyObject* values = PyDict_GetItem(result, key);
- bool decRefValues = !values;
- if (!values)
- values = PyList_New(0);
- PyList_Append(values, value);
- PyDict_SetItem(result, key, values);
- if (decRefValues) {
- Py_DECREF(values);
- }
- }
-
- return result;
- }
-
- static inline MultiMap toCpp(PyObject* pyObj)
- {
- if (PyObject_TypeCheck(pyObj, Shiboken::SbkType<MultiMap>()))
- return *reinterpret_cast<MultiMap *>(Shiboken::Object::cppPointer(reinterpret_cast<SbkObject *>(pyObj), Shiboken::SbkType<MultiMap>()));
-
- MultiMap result;
-
- PyObject* key;
- PyObject* value;
- Py_ssize_t pos = 0;
-
- while (PyDict_Next(pyObj, &pos, &key, &value))
- result[Shiboken::Converter<typename MultiMap::key_type>::toCpp(key)] = Shiboken::Converter<typename MultiMap::mapped_type>::toCpp(value);
- return result;
- }
-};
-
-template <typename T>
-struct QSequenceConverter
-{
- static inline bool checkType(PyObject* pyObj)
- {
- return isConvertible(pyObj);
- }
-
- static inline bool isConvertible(PyObject* pyObj)
- {
- if (PyObject_TypeCheck(pyObj, Shiboken::SbkType<T>()))
- return true;
- if ((Shiboken::SbkType<T>() && Shiboken::Object::checkType(pyObj)) || !PySequence_Check(pyObj))
- return false;
- for (int i = 0, max = PySequence_Length(pyObj); i < max; ++i) {
- Shiboken::AutoDecRef item(PySequence_GetItem(pyObj, i));
- if (!Shiboken::Converter<typename T::value_type>::isConvertible(item))
- return false;
- }
- return true;
- }
- static inline PyObject* toPython(void* cppObj) { return toPython(*reinterpret_cast<T*>(cppObj)); }
- static PyObject* toPython(const T& cppobj)
- {
- PyObject* result = PyList_New((int) cppobj.size());
- typename T::const_iterator it = cppobj.begin();
- for (int idx = 0; it != cppobj.end(); ++it, ++idx) {
- typename T::value_type vh(*it);
- PyList_SET_ITEM(result, idx, Shiboken::Converter<typename T::value_type>::toPython(vh));
- }
- return result;
- }
- static T toCpp(PyObject* pyobj)
- {
- if (PyObject_TypeCheck(pyobj, Shiboken::SbkType<T>()))
- return *reinterpret_cast<T *>(Shiboken::Object::cppPointer(reinterpret_cast<SbkObject *>(pyobj), Shiboken::SbkType<T>()));
-
- Shiboken::AutoDecRef fastSequence(PySequence_Fast(pyobj, "Invalid sequence object"));
- T result;
- for (int i = 0; i < PySequence_Size(pyobj); i++) {
- PyObject* pyItem = PySequence_Fast_GET_ITEM(fastSequence.object(), i);
- result << Shiboken::Converter<typename T::value_type>::toCpp(pyItem);
- }
- return result;
- }
-};
-
-
-template <typename T>
-struct QFlagsConverter
-{
- static inline bool checkType(PyObject* pyObj)
- {
- return PyObject_TypeCheck(pyObj, Shiboken::SbkType<T>());
- }
-
- static inline bool isConvertible(PyObject* pyObj)
- {
- return PyObject_TypeCheck(pyObj, Shiboken::SbkType<T>())
- || PyObject_TypeCheck(pyObj, Shiboken::SbkType<typename T::enum_type>());
- }
-
- static inline PyObject* toPython(void* cppObj)
- {
- return toPython(*reinterpret_cast<T*>(cppObj));
- }
-
- static inline PyObject* toPython(const T& cppObj)
- {
- return reinterpret_cast<PyObject*>(PySide::QFlags::newObject(cppObj, Shiboken::SbkType<T>()));
- }
-
- static inline T toCpp(PyObject* pyObj)
- {
- /* this was long. Needed int in Qt5 */
- int val = 0;
- if (Shiboken::Enum::check(pyObj)) {
- val = Shiboken::Enum::getValue(pyObj);
- } else if (PyObject_TypeCheck(pyObj, Shiboken::SbkType<T>())) {
- val = PySide::QFlags::getValue(reinterpret_cast<PySideQFlagsObject*>(pyObj));
- } else if (PyNumber_Check(pyObj)) {
- Shiboken::AutoDecRef pyLong(PyNumber_Long(pyObj));
- val = PyLong_AsLong(pyLong.object());
- } else {
- PyErr_BadArgument();
- }
- return T(QFlag(val));
- }
-};
-
-#endif
diff --git a/sources/pyside2/libpyside/signalmanager.cpp.in b/sources/pyside2/libpyside/signalmanager.cpp.in
index 473057cbc..8ede09610 100644
--- a/sources/pyside2/libpyside/signalmanager.cpp.in
+++ b/sources/pyside2/libpyside/signalmanager.cpp.in
@@ -55,10 +55,10 @@
#include <QDebug>
#include <limits>
#include <algorithm>
-#include <typeresolver.h>
#include <basewrapper.h>
+#include <bindingmanager.h>
#include <sbkconverter.h>
-#include <conversions.h>
+#include <sbkstring.h>
// These private headers are needed to throw JavaScript exceptions
#if @QML_PRIVATE_API_SUPPORT@
@@ -214,30 +214,6 @@ QDataStream &operator>>(QDataStream& in, PyObjectWrapper& myObj)
};
-namespace Shiboken {
-
-template<>
-struct Converter<PySide::PyObjectWrapper>
-{
- static PySide::PyObjectWrapper toCpp(PyObject* obj)
- {
- return PySide::PyObjectWrapper(obj);
- }
-
- static PyObject* toPython(void* obj)
- {
- return toPython(*reinterpret_cast<PySide::PyObjectWrapper*>(obj));
- }
-
- static PyObject* toPython(const PySide::PyObjectWrapper& obj)
- {
- Py_INCREF((PyObject*)obj);
- return obj;
- }
-};
-
-};
-
using namespace PySide;
struct SignalManager::SignalManagerPrivate
diff --git a/sources/pyside2/tests/QtXml/qxmlsimplereader_test.py b/sources/pyside2/tests/QtXml/qxmlsimplereader_test.py
index d5df57953..108fc9b86 100644
--- a/sources/pyside2/tests/QtXml/qxmlsimplereader_test.py
+++ b/sources/pyside2/tests/QtXml/qxmlsimplereader_test.py
@@ -57,7 +57,6 @@ class QXmlSimpleReaderTest(unittest.TestCase):
reader = QXmlSimpleReader()
prop, ok = reader.property('foo')
self.assertEqual((prop, ok), (None, False))
- reader.setProperty('foo', 'Something')
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside2/tests/pysidetest/CMakeLists.txt b/sources/pyside2/tests/pysidetest/CMakeLists.txt
index 16380e490..0a367e8a5 100644
--- a/sources/pyside2/tests/pysidetest/CMakeLists.txt
+++ b/sources/pyside2/tests/pysidetest/CMakeLists.txt
@@ -66,11 +66,8 @@ make_path(testbinding_include_dirs ${pyside2_BINARY_DIR}
${Qt5Widgets_DIRECT_INCLUDE_DIR}
)
-make_path(testbinding_typesystem_path ${CMAKE_CURRENT_SOURCE_DIR}
- ${pyside2_SOURCE_DIR}
- ${QtCore_SOURCE_DIR} ${QtGui_SOURCE_DIR} ${QtWidgets_SOURCE_DIR}
- ${QtCore_BINARY_DIR} ${QtGui_BINARY_DIR} ${QtWidgets_BINARY_DIR}
- )
+make_path(testbinding_typesystem_path ${pyside2_SOURCE_DIR}
+ ${pyside2_BINARY_DIR})
add_custom_command(OUTPUT ${testbinding_SRC}
COMMAND ${SHIBOKEN_BINARY} ${GENERATOR_EXTRA_FLAGS}
diff --git a/sources/pyside2/tests/pysidetest/typesystem_pysidetest.xml b/sources/pyside2/tests/pysidetest/typesystem_pysidetest.xml
index 7895e7147..bf9c29386 100644
--- a/sources/pyside2/tests/pysidetest/typesystem_pysidetest.xml
+++ b/sources/pyside2/tests/pysidetest/typesystem_pysidetest.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<typesystem package="testbinding">
- <load-typesystem name="typesystem_widgets.xml" generate="no"/>
+ <load-typesystem name="QtWidgets/typesystem_widgets.xml" generate="no"/>
<value-type name="IntValue"/>
<primitive-type name="TypedefValue">
<!--
diff --git a/sources/shiboken2/ApiExtractor/typedatabase.cpp b/sources/shiboken2/ApiExtractor/typedatabase.cpp
index 4a96240c4..0ed016d3d 100644
--- a/sources/shiboken2/ApiExtractor/typedatabase.cpp
+++ b/sources/shiboken2/ApiExtractor/typedatabase.cpp
@@ -451,16 +451,20 @@ bool TypeDatabase::isSuppressedWarning(const QString& s) const
return false;
}
-QString TypeDatabase::modifiedTypesystemFilepath(const QString& tsFile, bool stripPath) const
+QString TypeDatabase::modifiedTypesystemFilepath(const QString& tsFile, const QString &currentPath) const
{
const QFileInfo tsFi(tsFile);
if (tsFi.isAbsolute()) // No point in further lookups
return tsFi.absoluteFilePath();
if (tsFi.isFile()) // Make path absolute
return tsFi.absoluteFilePath();
- const QString fileName = stripPath ? tsFi.fileName() : tsFile;
+ if (!currentPath.isEmpty()) {
+ const QFileInfo fi(currentPath + QLatin1Char('/') + tsFile);
+ if (fi.isFile())
+ return fi.absoluteFilePath();
+ }
for (const QString &path : m_typesystemPaths) {
- const QFileInfo fi(path + QLatin1Char('/') + fileName);
+ const QFileInfo fi(path + QLatin1Char('/') + tsFile);
if (fi.isFile())
return fi.absoluteFilePath();
}
@@ -469,7 +473,13 @@ QString TypeDatabase::modifiedTypesystemFilepath(const QString& tsFile, bool str
bool TypeDatabase::parseFile(const QString &filename, bool generate)
{
- QString filepath = modifiedTypesystemFilepath(filename);
+ return parseFile(filename, QString(), generate);
+}
+
+bool TypeDatabase::parseFile(const QString &filename, const QString &currentPath, bool generate)
+{
+
+ QString filepath = modifiedTypesystemFilepath(filename, currentPath);
if (m_parsedTypesystemFiles.contains(filepath))
return m_parsedTypesystemFiles[filepath];
@@ -478,8 +488,11 @@ bool TypeDatabase::parseFile(const QString &filename, bool generate)
QFile file(filepath);
if (!file.exists()) {
m_parsedTypesystemFiles[filepath] = false;
- qCWarning(lcShiboken).noquote().nospace()
- << "Can't find " << filename << ", typesystem paths: " << m_typesystemPaths.join(QLatin1String(", "));
+ QString message = QLatin1String("Can't find ") + filename;
+ if (!currentPath.isEmpty())
+ message += QLatin1String(", current path: ") + currentPath;
+ message += QLatin1String(", typesystem paths: ") + m_typesystemPaths.join(QLatin1String(", "));
+ qCWarning(lcShiboken).noquote().nospace() << message;
return false;
}
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
diff --git a/sources/shiboken2/ApiExtractor/typedatabase.h b/sources/shiboken2/ApiExtractor/typedatabase.h
index 63f4cc73d..dfddfc300 100644
--- a/sources/shiboken2/ApiExtractor/typedatabase.h
+++ b/sources/shiboken2/ApiExtractor/typedatabase.h
@@ -142,6 +142,8 @@ public:
static QString globalNamespaceClassName(const TypeEntry *te);
bool parseFile(const QString &filename, bool generate = true);
+ bool parseFile(const QString &filename, const QString &currentPath, bool generate);
+
bool parseFile(QIODevice* device, bool generate = true);
bool setApiVersion(const QString& package, const QString& version);
@@ -154,7 +156,7 @@ public:
void setDropTypeEntries(QStringList dropTypeEntries);
- QString modifiedTypesystemFilepath(const QString &tsFile, bool stripPath = true) const;
+ QString modifiedTypesystemFilepath(const QString &tsFile, const QString &currentPath = QString()) const;
#ifndef QT_NO_DEBUG_STREAM
void formatDebug(QDebug &d) const;
diff --git a/sources/shiboken2/ApiExtractor/typesystem.cpp b/sources/shiboken2/ApiExtractor/typesystem.cpp
index 9c80a6c0b..c20b06750 100644
--- a/sources/shiboken2/ApiExtractor/typesystem.cpp
+++ b/sources/shiboken2/ApiExtractor/typesystem.cpp
@@ -32,6 +32,7 @@
#include "reporthandler.h"
#include <QtCore/QDir>
#include <QtCore/QFile>
+#include <QtCore/QFileInfo>
#include <QtCore/QRegularExpression>
#include <QtCore/QSet>
#include <QtCore/QXmlStreamAttributes>
@@ -183,13 +184,20 @@ Handler::Handler(TypeDatabase* database, bool generate)
tagNames.insert(QLatin1String("add-function"), StackElement::AddFunction);
}
+static QString readerFileName(const QXmlStreamReader &reader)
+{
+ const QFile *file = qobject_cast<const QFile *>(reader.device());
+ return file != nullptr ? file->fileName() : QString();
+}
+
static QString msgReaderError(const QXmlStreamReader &reader, const QString &what)
{
QString message;
QTextStream str(&message);
str << "Error: ";
- if (const QFile *file = qobject_cast<const QFile *>(reader.device()))
- str << "file=" << QDir::toNativeSeparators(file->fileName()) << ", ";
+ const QString fileName = readerFileName(reader);
+ if (!fileName.isEmpty())
+ str << "file=" << QDir::toNativeSeparators(fileName) << ", ";
str << "line=" << reader.lineNumber() << ", column=" << reader.columnNumber()
<< ", message=" << what;
return message;
@@ -203,6 +211,11 @@ static QString msgReaderError(const QXmlStreamReader &reader)
bool Handler::parse(QXmlStreamReader &reader)
{
m_error.clear();
+ m_currentPath.clear();
+ const QString fileName = readerFileName(reader);
+ if (!fileName.isEmpty())
+ m_currentPath = QFileInfo(fileName).absolutePath();
+
while (!reader.atEnd()) {
switch (reader.readNext()) {
case QXmlStreamReader::NoToken:
@@ -1325,7 +1338,7 @@ bool Handler::startElement(const QStringRef &n, const QXmlStreamAttributes &atts
return false;
}
bool generateChild = (convertBoolean(attributes[QLatin1String("generate")], QLatin1String("generate"), true) && (m_generate == TypeEntry::GenerateAll));
- if (!m_database->parseFile(name, generateChild)) {
+ if (!m_database->parseFile(name, m_currentPath, generateChild)) {
m_error = QStringLiteral("Failed to parse: '%1'").arg(name);
return false;
}
@@ -1947,7 +1960,7 @@ bool Handler::startElement(const QStringRef &n, const QXmlStreamAttributes &atts
if (m_generate != TypeEntry::GenerateForSubclass &&
m_generate != TypeEntry::GenerateNothing &&
!file_name.isEmpty()) {
- const QString resolved = m_database->modifiedTypesystemFilepath(file_name, false);
+ const QString resolved = m_database->modifiedTypesystemFilepath(file_name, m_currentPath);
if (QFile::exists(resolved)) {
QFile codeFile(resolved);
if (codeFile.open(QIODevice::Text | QIODevice::ReadOnly)) {
diff --git a/sources/shiboken2/ApiExtractor/typesystem_p.h b/sources/shiboken2/ApiExtractor/typesystem_p.h
index d485aad42..fd67ef49b 100644
--- a/sources/shiboken2/ApiExtractor/typesystem_p.h
+++ b/sources/shiboken2/ApiExtractor/typesystem_p.h
@@ -172,6 +172,7 @@ private:
QHash<QString, StackElement::ElementType> tagNames;
QString m_currentSignature;
+ QString m_currentPath;
};
#endif
diff --git a/sources/shiboken2/CMakeLists.txt b/sources/shiboken2/CMakeLists.txt
index 06b951767..288de8117 100644
--- a/sources/shiboken2/CMakeLists.txt
+++ b/sources/shiboken2/CMakeLists.txt
@@ -42,6 +42,22 @@ if (NOT PYTHON_ARCH)
get_python_arch()
endif()
+macro(get_llvm_config)
+ execute_process(
+ COMMAND ${PYTHON_EXECUTABLE} -c "if True:
+ import os
+ import sys
+ sys.path.append(os.path.realpath(os.path.join('${CMAKE_CURRENT_LIST_DIR}', '..', '..')))
+ from utils import findLlvmConfig
+ llvmConfig = findLlvmConfig()
+ if llvmConfig:
+ print(llvmConfig)
+ "
+ OUTPUT_VARIABLE LLVM_CONFIG
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ message("LLMV_CONFIG: " ${LLVM_CONFIG})
+endmacro()
+
set(CLANG_DIR "")
set(CLANG_DIR_SOURCE "")
@@ -54,12 +70,15 @@ elseif (DEFINED ENV{CLANG_INSTALL_DIR})
string(REPLACE "_ARCH_" "${PYTHON_ARCH}" CLANG_DIR "${CLANG_DIR}")
set(CLANG_DIR_SOURCE "CLANG_INSTALL_DIR")
else ()
- EXEC_PROGRAM("llvm-config" ARGS "--prefix" OUTPUT_VARIABLE CLANG_DIR)
- set(CLANG_DIR_SOURCE "llvm-config")
+ if (NOT LLVM_CONFIG)
+ get_llvm_config()
+ endif()
+ set(CLANG_DIR_SOURCE "${LLVM_CONFIG}")
+ EXEC_PROGRAM("${LLVM_CONFIG}" ARGS "--prefix" OUTPUT_VARIABLE CLANG_DIR)
if (NOT "${CLANG_DIR}" STREQUAL "")
- EXEC_PROGRAM("llvm-config" ARGS "--version" OUTPUT_VARIABLE CLANG_VERSION)
+ EXEC_PROGRAM("${LLVM_CONFIG}" ARGS "--version" OUTPUT_VARIABLE CLANG_VERSION)
if (CLANG_VERSION VERSION_LESS 3.9)
- message(FATAL_ERROR "LLVM version 3.9 is required (llvm-config detected ${CLANG_VERSION} at ${CLANG_DIR}).")
+ message(FATAL_ERROR "LLVM version 3.9 is required (${LLVM_CONFIG} detected ${CLANG_VERSION} at ${CLANG_DIR}).")
endif()
endif()
endif()
diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
index 98b5ad357..74861e3d4 100644
--- a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
@@ -248,7 +248,6 @@ void CppGenerator::generateClass(QTextStream &s, GeneratorContext &classContext)
s << "#include <qapp_macro.h>" << endl;
}
- s << "#include <typeresolver.h>" << endl;
s << "#include <typeinfo>" << endl;
if (usePySideExtensions() && metaClass->isQObject()) {
s << "#include <signalmanager.h>" << endl;
@@ -3565,7 +3564,6 @@ void CppGenerator::writeEnumConverterInitialization(QTextStream& s, const TypeEn
}
s << INDENT << "Shiboken::Enum::setTypeConverter(" << enumPythonType << ", converter);" << endl;
- s << INDENT << "Shiboken::Enum::setTypeConverter(" << enumPythonType << ", converter);" << endl;
QStringList cppSignature = enumType->qualifiedCppName().split(QLatin1String("::"), QString::SkipEmptyParts);
while (!cppSignature.isEmpty()) {
QString signature = cppSignature.join(QLatin1String("::"));
@@ -5593,27 +5591,6 @@ bool CppGenerator::finishGeneration()
cppSignature.removeFirst();
}
}
- // Register type resolver for all containers found in signals.
- QSet<QByteArray> typeResolvers;
-
- for (AbstractMetaClass *metaClass : classList) {
- if (!metaClass->isQObject() || !metaClass->typeEntry()->generateCode())
- continue;
- const AbstractMetaFunctionList &functions = metaClass->functions();
- for (AbstractMetaFunction *func : functions) {
- if (func->isSignal()) {
- const AbstractMetaArgumentList &arguments = func->arguments();
- for (AbstractMetaArgument *arg : arguments) {
- if (arg->type()->isContainer()) {
- QString value = translateType(arg->type(), metaClass, ExcludeConst | ExcludeReference);
- if (value.startsWith(QLatin1String("::")))
- value.remove(0, 2);
- typeResolvers << QMetaObject::normalizedType(value.toUtf8().constData());
- }
- }
- }
- }
- }
s << endl;
if (maxTypeIndex)
diff --git a/sources/shiboken2/generator/shiboken2/headergenerator.cpp b/sources/shiboken2/generator/shiboken2/headergenerator.cpp
index 9fde98d91..a41139381 100644
--- a/sources/shiboken2/generator/shiboken2/headergenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/headergenerator.cpp
@@ -474,7 +474,7 @@ bool HeaderGenerator::finishGeneration()
}
s << "#include <sbkpython.h>" << endl;
- s << "#include <conversions.h>" << endl;
+ s << "#include <sbkconverter.h>" << endl;
s << "#include <sbkenum.h>" << endl;
s << "#include <basewrapper.h>" << endl;
s << "#include <bindingmanager.h>" << endl;
diff --git a/sources/shiboken2/libshiboken/CMakeLists.txt b/sources/shiboken2/libshiboken/CMakeLists.txt
index ac59e80cd..90b44aa76 100644
--- a/sources/shiboken2/libshiboken/CMakeLists.txt
+++ b/sources/shiboken2/libshiboken/CMakeLists.txt
@@ -45,10 +45,10 @@ sbkmodule.cpp
sbkstring.cpp
bindingmanager.cpp
threadstatesaver.cpp
-typeresolver.cpp
shibokenbuffer.cpp
signature.cpp
qapp_macro.cpp
+voidptr.cpp
)
get_numpy_location()
@@ -75,7 +75,6 @@ install(FILES
autodecref.h
basewrapper.h
bindingmanager.h
- conversions.h
gilstate.h
helper.h
sbkarrayconverter.h
@@ -88,11 +87,11 @@ install(FILES
shiboken.h
shibokenmacros.h
threadstatesaver.h
- typeresolver.h
shibokenbuffer.h
sbkpython.h
signature.h
qapp_macro.h
+ voidptr.h
"${CMAKE_CURRENT_BINARY_DIR}/sbkversion.h"
DESTINATION include/shiboken2${shiboken2_SUFFIX})
install(TARGETS libshiboken EXPORT shiboken2
diff --git a/sources/shiboken2/libshiboken/basewrapper.cpp b/sources/shiboken2/libshiboken/basewrapper.cpp
index d90904dec..fc208e520 100644
--- a/sources/shiboken2/libshiboken/basewrapper.cpp
+++ b/sources/shiboken2/libshiboken/basewrapper.cpp
@@ -39,10 +39,11 @@
#include "basewrapper.h"
#include "basewrapper_p.h"
+#include "bindingmanager.h"
#include "sbkconverter.h"
#include "sbkenum.h"
+#include "sbkstring.h"
#include "autodecref.h"
-#include "typeresolver.h"
#include "gilstate.h"
#include <string>
#include <cstring>
@@ -53,6 +54,7 @@
#include "threadstatesaver.h"
#include "signature.h"
#include "qapp_macro.h"
+#include "voidptr.h"
namespace {
void _destroyParentInfo(SbkObject* obj, bool keepReference);
@@ -550,7 +552,6 @@ void init()
Conversions::init();
- initTypeResolver();
PyEval_InitThreads();
//Init private data
@@ -565,6 +566,8 @@ void init()
if (PyType_Ready(reinterpret_cast<PyTypeObject *>(&SbkObject_Type)) < 0)
Py_FatalError("[libshiboken] Failed to initialise Shiboken.BaseWrapper type.");
+ VoidPtr::init();
+
shibokenAlreadInitialised = true;
}
diff --git a/sources/shiboken2/libshiboken/conversions.h b/sources/shiboken2/libshiboken/conversions.h
deleted file mode 100644
index a21fa0c2b..000000000
--- a/sources/shiboken2/libshiboken/conversions.h
+++ /dev/null
@@ -1,731 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of PySide2.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CONVERSIONS_H
-#define CONVERSIONS_H
-
-#include "sbkpython.h"
-#include <limits>
-#include <typeinfo>
-
-#include "sbkstring.h"
-#include "sbkenum.h"
-#include "basewrapper.h"
-#include "bindingmanager.h"
-#include "sbkdbg.h"
-
-// When the user adds a function with an argument unknown for the typesystem, the generator writes type checks as
-// TYPENAME_Check, so this macro allows users to add PyObject arguments to their added functions.
-#define PyObject_Check(X) true
-#define SbkChar_Check(X) (SbkNumber_Check(X) || Shiboken::String::checkChar(X))
-#include "autodecref.h"
-
-namespace Shiboken
-{
-/**
-* This function template is used to get the PyTypeObject of a C++ type T.
-* All implementations should be provided by template specializations generated by the generator when
-* T isn't a C++ primitive type.
-* \see SpecialCastFunction
-*/
-template<typename T>
-PyTypeObject* SbkType()
-{
- return 0;
-}
-
-template<> inline PyTypeObject* SbkType<int>() { return &PyInt_Type; }
-template<> inline PyTypeObject* SbkType<unsigned int>() { return &PyLong_Type; }
-template<> inline PyTypeObject* SbkType<short>() { return &PyInt_Type; }
-template<> inline PyTypeObject* SbkType<unsigned short>() { return &PyInt_Type; }
-template<> inline PyTypeObject* SbkType<long>() { return &PyLong_Type; }
-template<> inline PyTypeObject* SbkType<unsigned long>() { return &PyLong_Type; }
-template<> inline PyTypeObject* SbkType<PY_LONG_LONG>() { return &PyLong_Type; }
-template<> inline PyTypeObject* SbkType<unsigned PY_LONG_LONG>() { return &PyLong_Type; }
-template<> inline PyTypeObject* SbkType<bool>() { return &PyBool_Type; }
-template<> inline PyTypeObject* SbkType<float>() { return &PyFloat_Type; }
-template<> inline PyTypeObject* SbkType<double>() { return &PyFloat_Type; }
-template<> inline PyTypeObject* SbkType<char>() { return &PyInt_Type; }
-template<> inline PyTypeObject* SbkType<signed char>() { return &PyInt_Type; }
-template<> inline PyTypeObject* SbkType<unsigned char>() { return &PyInt_Type; }
-
-/**
- * Convenience template to create wrappers using the proper Python type for a given C++ class instance.
- */
-template<typename T>
-inline PyObject* createWrapper(const T* cppobj, bool hasOwnership = false, bool isExactType = false)
-{
- const char* typeName = 0;
- if (!isExactType)
- typeName = typeid(*const_cast<T*>(cppobj)).name();
- return Object::newObject(reinterpret_cast<SbkObjectType*>(SbkType<T>()),
- const_cast<T*>(cppobj), hasOwnership, isExactType, typeName);
-}
-
-// Base Conversions ----------------------------------------------------------
-// The basic converter must be empty to avoid object types being converted by value.
-template <typename T> struct Converter {};
-
-// Pointer conversion specialization for value types.
-template <typename T>
-struct Converter<T*>
-{
- static inline bool checkType(PyObject* pyObj)
- {
- return Converter<T>::checkType(pyObj);
- }
-
- static inline bool isConvertible(PyObject* pyObj)
- {
- return pyObj == Py_None || PyObject_TypeCheck(pyObj, SbkType<T>());
- }
-
- static PyObject* toPython(const T* cppobj)
- {
- if (!cppobj)
- Py_RETURN_NONE;
- PyObject* pyobj = reinterpret_cast<PyObject*>(BindingManager::instance().retrieveWrapper(cppobj));
- if (pyobj)
- Py_INCREF(pyobj);
- else
- pyobj = createWrapper<T>(cppobj);
- return pyobj;
- }
-
- static T* toCpp(PyObject* pyobj)
- {
- if (PyObject_TypeCheck(pyobj, SbkType<T>()))
- return reinterpret_cast<T *>(Object::cppPointer(reinterpret_cast<SbkObject *>(pyobj), SbkType<T>()));
- else if (Converter<T>::isConvertible(pyobj))
- return new T(Converter<T>::toCpp(pyobj));
- else if (pyobj == Py_None)
- return 0;
-
- assert(false);
- return 0;
- }
-};
-template <typename T> struct Converter<const T*> : Converter<T*> {};
-
-// Specialization for reference conversions.
-template <typename T>
-struct Converter<T&>
-{
- static inline bool checkType(PyObject* pyObj) { return Converter<T>::checkType(pyObj); }
- static inline bool isConvertible(PyObject* pyObj) { return Converter<T>::isConvertible(pyObj); }
- static inline PyObject* toPython(const T& cppobj) { return Converter<T*>::toPython(&cppobj); }
- static inline T& toCpp(PyObject* pyobj) { return *Converter<T*>::toCpp(pyobj); }
-};
-
-// Void pointer conversions.
-template<>
-struct Converter<void*>
-{
- static inline bool checkType(PyObject *) { return false; }
- static inline bool isConvertible(PyObject *) { return true; }
- static PyObject* toPython(void* cppobj)
- {
- if (!cppobj)
- Py_RETURN_NONE;
- PyObject *result = reinterpret_cast<PyObject *>(cppobj);
- Py_INCREF(result);
- return result;
- }
- static void* toCpp(PyObject* pyobj) { return pyobj; }
-};
-
-// Base converter meant to be inherited by converters for classes that could be
-// passed by value.
-// Example: "struct Converter<ValueTypeClass> : ValueTypeConverter<ValueTypeClass>"
-template <typename T>
-struct ValueTypeConverter
-{
- static inline bool checkType(PyObject* pyObj) { return PyObject_TypeCheck(pyObj, SbkType<T>()); }
-
- // The basic version of this method also tries to use the extended 'isConvertible' method.
- static inline bool isConvertible(PyObject* pyobj)
- {
- if (PyObject_TypeCheck(pyobj, SbkType<T>()))
- return true;
- SbkObjectType* shiboType = reinterpret_cast<SbkObjectType*>(SbkType<T>());
- return ObjectType::isExternalConvertible(shiboType, pyobj);
- }
- static inline PyObject* toPython(void* cppobj) { return toPython(*reinterpret_cast<T*>(cppobj)); }
- static inline PyObject* toPython(const T& cppobj)
- {
- PyObject* obj = createWrapper<T>(new T(cppobj), true, true);
-// SbkBaseWrapper_setContainsCppWrapper(obj, SbkTypeInfo<T>::isCppWrapper);
- return obj;
- }
- // Classes with implicit conversions are expected to reimplement 'toCpp' to build T from
- // its various implicit constructors. Even classes without implicit conversions could
- // get some of those via other modules defining conversion operator for them, thus
- // the basic Converter for value types checks for extended conversion and tries to
- // use them if it is the case.
- static inline T toCpp(PyObject* pyobj)
- {
- if (!PyObject_TypeCheck(pyobj, SbkType<T>())) {
- SbkObjectType* shiboType = reinterpret_cast<SbkObjectType*>(SbkType<T>());
- if (ObjectType::hasExternalCppConversions(shiboType) && isConvertible(pyobj)) {
- T* cptr = reinterpret_cast<T*>(ObjectType::callExternalCppConversion(shiboType, pyobj));
- const T result = *cptr;
- delete cptr;
- return result;
- }
- assert(false);
- }
- return *reinterpret_cast<T*>(Object::cppPointer(reinterpret_cast<SbkObject*>(pyobj), SbkType<T>()));
- }
-};
-
-// Base converter meant to be inherited by converters for abstract classes and object types
-// (i.e. classes with private copy constructors and = operators).
-// Example: "struct Converter<AbstractClass*> : ObjectTypeConverter<AbstractClass>"
-template <typename T>
-struct ObjectTypeConverter
-{
- static inline bool checkType(PyObject* pyObj) { return pyObj == Py_None || PyObject_TypeCheck(pyObj, SbkType<T>()); }
- /// Py_None objects are the only objects convertible to an object type (in the form of a NULL pointer).
- static inline bool isConvertible(PyObject* pyObj) { return pyObj == Py_None || PyObject_TypeCheck(pyObj, SbkType<T>()); }
- /// Convenience overload that calls "toPython(const T*)" method.
- static inline PyObject* toPython(void* cppobj) { return toPython(reinterpret_cast<T*>(cppobj)); }
- /// Returns a new Python wrapper for the C++ object or an existing one with its reference counter incremented.
- static PyObject* toPython(const T* cppobj)
- {
- if (!cppobj)
- Py_RETURN_NONE;
- PyObject* pyobj = reinterpret_cast<PyObject*>(BindingManager::instance().retrieveWrapper(cppobj));
- if (pyobj)
- Py_INCREF(pyobj);
- else
- pyobj = createWrapper<T>(cppobj);
- return pyobj;
- }
- /// Returns the wrapped C++ pointer casted properly, or a NULL pointer if the argument is a Py_None.
- static T* toCpp(PyObject* pyobj)
- {
- if (pyobj == Py_None)
- return 0;
- SbkObject *sbkObj = reinterpret_cast<SbkObject *>(pyobj);
- SbkObjectType* shiboType = reinterpret_cast<SbkObjectType*>(pyobj->ob_type);
- if (ObjectType::hasCast(shiboType))
- return reinterpret_cast<T*>(ObjectType::cast(shiboType, sbkObj, SbkType<T>()));
- return reinterpret_cast<T *>(Object::cppPointer(sbkObj, SbkType<T>()));
- }
-};
-
-template <typename T>
-struct ObjectTypeReferenceConverter : ObjectTypeConverter<T>
-{
- static inline bool checkType(PyObject* pyObj) { return PyObject_TypeCheck(pyObj, SbkType<T>()); }
- static inline bool isConvertible(PyObject* pyObj) { return PyObject_TypeCheck(pyObj, SbkType<T>()); }
- static inline PyObject* toPython(const T& cppobj) { return Converter<T*>::toPython(&cppobj); }
- static inline T& toCpp(PyObject* pyobj)
- {
- T* t = Converter<T*>::toCpp(pyobj);
- assert(t);
- return *t;
- }
-};
-
-// PyObject* specialization to avoid converting what doesn't need to be converted.
-template<>
-struct Converter<PyObject*> : ObjectTypeConverter<PyObject*>
-{
- static inline PyObject* toCpp(PyObject* pyobj) { return pyobj; }
-};
-
-// Primitive Conversions ------------------------------------------------------
-template <>
-struct Converter<bool>
-{
- static inline bool checkType(PyObject* pyobj) { return PyBool_Check(pyobj); }
- static inline bool isConvertible(PyObject* pyobj) { return PyInt_Check(pyobj); }
- static inline PyObject* toPython(void* cppobj) { return toPython(*reinterpret_cast<bool*>(cppobj)); }
- static inline PyObject* toPython(bool cppobj) { return PyBool_FromLong(cppobj); }
- static inline bool toCpp(PyObject* pyobj) { return PyInt_AS_LONG(pyobj) != 0; }
-};
-
-/**
- * Helper template for checking if a value overflows when casted to type T
- */
-template<typename T, bool isSigned = std::numeric_limits<T>::is_signed >
-struct OverFlowChecker;
-
-template<typename T>
-struct OverFlowChecker<T, true>
-{
- static bool check(const PY_LONG_LONG& value)
- {
- return value < std::numeric_limits<T>::min() || value > std::numeric_limits<T>::max();
- }
-};
-
-template<typename T>
-struct OverFlowChecker<T, false>
-{
- static bool check(const PY_LONG_LONG& value)
- {
- return value < 0 || static_cast<unsigned long long>(value) > std::numeric_limits<T>::max();
- }
-};
-
-template<>
-struct OverFlowChecker<PY_LONG_LONG, true>
-{
- static bool check(const PY_LONG_LONG &)
- {
- return false;
- }
-};
-
-template<>
-struct OverFlowChecker<double, true>
-{
- static bool check(const double &)
- {
- return false;
- }
-};
-
-template<>
-struct OverFlowChecker<float, true>
-{
- static bool check(const double& value)
- {
- return value < std::numeric_limits<float>::min() || value > std::numeric_limits<float>::max();
- }
-};
-
-template <typename PyIntEquiv>
-struct Converter_PyInt
-{
- static inline bool checkType(PyObject* pyobj) { return PyInt_Check(pyobj); }
- static inline bool isConvertible(PyObject* pyobj) { return SbkNumber_Check(pyobj); }
- static inline PyObject* toPython(void* cppobj) { return toPython(*reinterpret_cast<PyIntEquiv*>(cppobj)); }
- static inline PyObject* toPython(const PyIntEquiv& cppobj) { return PyInt_FromLong((long) cppobj); }
- static PyIntEquiv toCpp(PyObject* pyobj)
- {
- if (PyFloat_Check(pyobj)) {
- double d_result = PyFloat_AS_DOUBLE(pyobj);
- // If cast to long directly it could overflow silently
- if (OverFlowChecker<PyIntEquiv>::check(d_result))
- PyErr_SetObject(PyExc_OverflowError, 0);
- return static_cast<PyIntEquiv>(d_result);
- } else {
- PY_LONG_LONG result = PyLong_AsLongLong(pyobj);
- if (OverFlowChecker<PyIntEquiv>::check(result))
- PyErr_SetObject(PyExc_OverflowError, 0);
- return static_cast<PyIntEquiv>(result);
- }
- }
-};
-
-template <typename T>
-struct Converter_PyULongInt : Converter_PyInt<T>
-{
- static inline PyObject* toPython(void* cppobj) { return toPython(*reinterpret_cast<T*>(cppobj)); }
- static inline PyObject* toPython(const T& cppobj) { return PyLong_FromUnsignedLong(cppobj); }
-};
-
-/// Specialization to convert char and unsigned char, it accepts Python numbers and strings with just one character.
-template <typename CharType>
-struct CharConverter
-{
- static inline bool checkType(PyObject* pyobj) { return SbkChar_Check(pyobj); }
- static inline bool isConvertible(PyObject* pyobj) { return SbkChar_Check(pyobj); }
- static inline PyObject* toPython(void* cppobj) { return toPython(*reinterpret_cast<CharType*>(cppobj)); }
- static inline PyObject* toPython(const CharType& cppobj) { return PyInt_FromLong(cppobj); }
- static CharType toCpp(PyObject* pyobj)
- {
- if (PyBytes_Check(pyobj)) {
- assert(PyBytes_GET_SIZE(pyobj) == 1); // This check is made on SbkChar_Check
- return PyBytes_AS_STRING(pyobj)[0];
- } else if (PyInt_Check(pyobj)) {
- PY_LONG_LONG result = PyInt_AsUnsignedLongLongMask(pyobj);
- if (OverFlowChecker<CharType>::check(result))
- PyErr_SetObject(PyExc_OverflowError, 0);
- return result;
- } else if (Shiboken::String::check(pyobj)) {
- return Shiboken::String::toCString(pyobj)[0];
- } else {
- return 0;
- }
- }
-};
-
-template <> struct Converter<unsigned long> : Converter_PyULongInt<unsigned long> {};
-template <> struct Converter<unsigned int> : Converter_PyULongInt<unsigned int> {};
-template <> struct Converter<char> : CharConverter<char>
-{
- // Should we really return a string?
- using CharConverter<char>::toPython;
- using CharConverter<char>::isConvertible;
- using CharConverter<char>::toCpp;
-
-
- static inline bool isConvertible(PyObject* pyobj) {
- return SbkChar_Check(pyobj);
- }
-
- static inline PyObject* toPython(const char& cppObj) {
- return Shiboken::String::fromFormat("%c", cppObj);
- }
-
- static char toCpp(PyObject* pyobj)
- {
- if (PyBytes_Check(pyobj)) {
- assert(PyBytes_GET_SIZE(pyobj) == 1); // This check is made on SbkChar_Check
- return PyBytes_AS_STRING(pyobj)[0];
- } else if (PyInt_Check(pyobj)) {
- PY_LONG_LONG result = PyInt_AsUnsignedLongLongMask(pyobj);
- if (OverFlowChecker<char>::check(result))
- PyErr_SetObject(PyExc_OverflowError, 0);
- return char(result);
- } else if (Shiboken::String::check(pyobj)) {
- return Shiboken::String::toCString(pyobj)[0];
- } else {
- return 0;
- }
- }
-};
-template <> struct Converter<signed char> : CharConverter<signed char> {};
-template <> struct Converter<unsigned char> : CharConverter<unsigned char> {};
-template <> struct Converter<int> : Converter_PyInt<int> {};
-template <> struct Converter<short> : Converter_PyInt<short> {};
-template <> struct Converter<unsigned short> : Converter_PyInt<unsigned short> {};
-template <> struct Converter<long> : Converter_PyInt<long> {};
-
-template <>
-struct Converter<PY_LONG_LONG>
-{
- static inline PyObject* toPython(void* cppobj) { return toPython(*reinterpret_cast<PY_LONG_LONG*>(cppobj)); }
- static inline PyObject* toPython(PY_LONG_LONG cppobj) { return PyLong_FromLongLong(cppobj); }
- static inline PY_LONG_LONG toCpp(PyObject* pyobj) { return (PY_LONG_LONG) PyLong_AsLongLong(pyobj); }
-};
-
-template <>
-struct Converter<unsigned PY_LONG_LONG>
-{
- static inline PyObject* toPython(void* cppobj)
- {
- return toPython(*reinterpret_cast<unsigned PY_LONG_LONG*>(cppobj));
- }
- static inline PyObject* toPython(unsigned PY_LONG_LONG cppobj)
- {
- return PyLong_FromUnsignedLongLong(cppobj);
- }
- static inline unsigned PY_LONG_LONG toCpp(PyObject* pyobj)
- {
-#if PY_MAJOR_VERSION >= 3
- if (!PyLong_Check(pyobj)) {
- PyErr_SetString(PyExc_TypeError, "Invalid type for unsigned long long conversion");
- return 0;
- }
-
- return PyLong_AsUnsignedLongLong(pyobj);
-#else
- if (PyInt_Check(pyobj)) {
- long result = (unsigned PY_LONG_LONG) PyInt_AsLong(pyobj);
- if (result < 0) {
- PyErr_SetObject(PyExc_OverflowError, 0);
- return 0;
- } else
- return (unsigned PY_LONG_LONG) result;
- } else if (PyLong_Check(pyobj)) {
- return (unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLong(pyobj);
- } else {
- PyErr_SetString(PyExc_TypeError, "Invalid type for unsigned long long conversion");
- return 0;
- }
-#endif // Python 2
- }
-};
-
-template <typename PyFloatEquiv>
-struct Converter_PyFloat
-{
- static inline bool checkType(PyObject* obj) { return PyFloat_Check(obj); }
- static inline bool isConvertible(PyObject* obj) { return SbkNumber_Check(obj); }
- static inline PyObject* toPython(void* cppobj) { return toPython(*reinterpret_cast<PyFloatEquiv*>(cppobj)); }
- static inline PyObject* toPython(PyFloatEquiv cppobj) { return PyFloat_FromDouble((double) cppobj); }
- static inline PyFloatEquiv toCpp(PyObject* pyobj)
- {
- if (PyInt_Check(pyobj) || PyLong_Check(pyobj))
- return (PyFloatEquiv) PyLong_AsLong(pyobj);
- return (PyFloatEquiv) PyFloat_AsDouble(pyobj);
- }
-};
-
-template <> struct Converter<float> : Converter_PyFloat<float> {};
-template <> struct Converter<double> : Converter_PyFloat<double> {};
-
-// PyEnum Conversions ---------------------------------------------------------
-template <typename CppEnum>
-struct EnumConverter
-{
- static inline bool checkType(PyObject* pyObj) { return PyObject_TypeCheck(pyObj, SbkType<CppEnum>()); }
- static inline bool isConvertible(PyObject* pyObj) { return PyObject_TypeCheck(pyObj, SbkType<CppEnum>()); }
- static inline PyObject* toPython(void* cppobj) { return toPython(*reinterpret_cast<CppEnum*>(cppobj)); }
- static inline PyObject* toPython(CppEnum cppenum)
- {
- return Shiboken::Enum::newItem(Shiboken::SbkType<CppEnum>(), (long) cppenum);
- }
- static inline CppEnum toCpp(PyObject* pyObj)
- {
- return (CppEnum) Shiboken::Enum::getValue(pyObj);;
- }
-};
-
-// C Sting Types --------------------------------------------------------------
-template <typename CString>
-struct Converter_CString
-{
- // Note: 0 is also a const char* in C++, so None is accepted in checkType
- static inline bool checkType(PyObject* pyObj) {
- return Shiboken::String::check(pyObj);
- }
- static inline bool isConvertible(PyObject* pyObj) {
- return Shiboken::String::isConvertible(pyObj);
- }
- static inline PyObject* toPython(void* cppobj) { return toPython(reinterpret_cast<CString>(cppobj)); }
- static inline PyObject* toPython(CString cppobj)
- {
- if (!cppobj)
- Py_RETURN_NONE;
- return Shiboken::String::fromCString(cppobj);
- }
- static inline CString toCpp(PyObject* pyobj) {
- if (pyobj == Py_None)
- return 0;
- return Shiboken::String::toCString(pyobj);
- }
-};
-
-template <> struct Converter<const char*> : Converter_CString<const char*> {};
-
-template <> struct Converter<std::string> : Converter_CString<std::string>
-{
- static inline PyObject* toPython(void* cppobj) { return toPython(*reinterpret_cast<std::string*>(cppobj)); }
- static inline PyObject* toPython(std::string cppObj)
- {
- return Shiboken::String::fromCString(cppObj.c_str());
- }
-
- static inline std::string toCpp(PyObject* pyobj)
- {
- if (pyobj == Py_None)
- return 0;
- return std::string(Shiboken::String::toCString(pyobj));
- }
-};
-
-// C++ containers -------------------------------------------------------------
-// The following container converters are meant to be used for pairs, lists and maps
-// that are similar to the STL containers of the same name.
-
-// For example to create a converter for a std::list the following code is enough:
-// template<typename T> struct Converter<std::list<T> > : StdListConverter<std::list<T> > {};
-
-// And this for a std::map:
-// template<typename KT, typename VT>
-// struct Converter<std::map<KT, VT> > : StdMapConverter<std::map<KT, VT> > {};
-
-template <typename StdList>
-struct StdListConverter
-{
- static inline bool checkType(PyObject* pyObj)
- {
- return isConvertible(pyObj);
- }
-
- static inline bool isConvertible(PyObject* pyObj)
- {
- if (PyObject_TypeCheck(pyObj, SbkType<StdList>()))
- return true;
- // Sequence conversion are made ONLY for python sequences, not for
- // binded types implementing sequence protocol, otherwise this will
- // cause a mess like QBitArray being accepted by someone expecting a
- // QStringList.
- if ((SbkType<StdList>() && Object::checkType(pyObj)) || !PySequence_Check(pyObj))
- return false;
- for (int i = 0, max = PySequence_Length(pyObj); i < max; ++i) {
- AutoDecRef item(PySequence_GetItem(pyObj, i));
- if (!Converter<typename StdList::value_type>::isConvertible(item))
- return false;
- }
- return true;
- }
- static PyObject* toPython(void* cppObj) { return toPython(*reinterpret_cast<StdList*>(cppObj)); }
- static PyObject* toPython(const StdList& cppobj)
- {
- PyObject* result = PyList_New((int) cppobj.size());
- typename StdList::const_iterator it = cppobj.begin();
- for (int idx = 0; it != cppobj.end(); ++it, ++idx) {
- typename StdList::value_type vh(*it);
- PyList_SET_ITEM(result, idx, Converter<typename StdList::value_type>::toPython(vh));
- }
- return result;
- }
- static StdList toCpp(PyObject* pyobj)
- {
- if (PyObject_TypeCheck(pyobj, SbkType<StdList>()))
- return *reinterpret_cast<StdList*>(Object::cppPointer(reinterpret_cast<SbkObject*>(pyobj), SbkType<StdList>()));
-
- StdList result;
- for (int i = 0; i < PySequence_Size(pyobj); i++) {
- AutoDecRef pyItem(PySequence_GetItem(pyobj, i));
- result.push_back(Converter<typename StdList::value_type>::toCpp(pyItem));
- }
- return result;
- }
-};
-
-template <typename StdPair>
-struct StdPairConverter
-{
- static inline bool checkType(PyObject* pyObj)
- {
- return isConvertible(pyObj);
- }
-
- static inline bool isConvertible(PyObject* pyObj)
- {
- if (PyObject_TypeCheck(pyObj, SbkType<StdPair>()))
- return true;
- if ((SbkType<StdPair>() && Object::checkType(pyObj)) || !PySequence_Check(pyObj) || PySequence_Length(pyObj) != 2)
- return false;
-
- AutoDecRef item1(PySequence_GetItem(pyObj, 0));
- AutoDecRef item2(PySequence_GetItem(pyObj, 1));
-
- if (!Converter<typename StdPair::first_type>::isConvertible(item1)
- && !Converter<typename StdPair::second_type>::isConvertible(item2)) {
- return false;
- }
- return true;
- }
- static PyObject* toPython(void* cppObj) { return toPython(*reinterpret_cast<StdPair*>(cppObj)); }
- static PyObject* toPython(const StdPair& cppobj)
- {
- typename StdPair::first_type first(cppobj.first);
- typename StdPair::second_type second(cppobj.second);
- PyObject* tuple = PyTuple_New(2);
- PyTuple_SET_ITEM(tuple, 0, Converter<typename StdPair::first_type>::toPython(first));
- PyTuple_SET_ITEM(tuple, 1, Converter<typename StdPair::second_type>::toPython(second));
- return tuple;
- }
- static StdPair toCpp(PyObject* pyobj)
- {
- StdPair result;
- AutoDecRef pyFirst(PySequence_GetItem(pyobj, 0));
- AutoDecRef pySecond(PySequence_GetItem(pyobj, 1));
- result.first = Converter<typename StdPair::first_type>::toCpp(pyFirst);
- result.second = Converter<typename StdPair::second_type>::toCpp(pySecond);
- return result;
- }
-};
-
-template <typename StdMap>
-struct StdMapConverter
-{
- static inline bool checkType(PyObject* pyObj)
- {
- return isConvertible(pyObj);
- }
-
- static inline bool isConvertible(PyObject* pyObj)
- {
- if (PyObject_TypeCheck(pyObj, SbkType<StdMap>()))
- return true;
- if ((SbkType<StdMap>() && Object::checkType(pyObj)) || !PyDict_Check(pyObj))
- return false;
-
- PyObject* key;
- PyObject* value;
- Py_ssize_t pos = 0;
-
- while (PyDict_Next(pyObj, &pos, &key, &value)) {
- if (!Converter<typename StdMap::key_type>::isConvertible(key)
- || !Converter<typename StdMap::mapped_type>::isConvertible(value)) {
- return false;
- }
- }
- return true;
- }
-
- static PyObject* toPython(void* cppObj) { return toPython(*reinterpret_cast<StdMap*>(cppObj)); }
- static PyObject* toPython(const StdMap& cppobj)
- {
- PyObject* result = PyDict_New();
- typename StdMap::const_iterator it = cppobj.begin();
-
- for (; it != cppobj.end(); ++it) {
- PyDict_SetItem(result,
- Converter<typename StdMap::key_type>::toPython(it->first),
- Converter<typename StdMap::mapped_type>::toPython(it->second));
- }
-
- return result;
- }
- static StdMap toCpp(PyObject* pyobj)
- {
- StdMap result;
-
- PyObject* key;
- PyObject* value;
- Py_ssize_t pos = 0;
-
- while (PyDict_Next(pyobj, &pos, &key, &value)) {
- result.insert(typename StdMap::value_type(
- Converter<typename StdMap::key_type>::toCpp(key),
- Converter<typename StdMap::mapped_type>::toCpp(value)));
- }
- return result;
- }
-};
-
-
-// class used to translate python objects to another type
-template <typename T> struct PythonConverter {};
-
-} // namespace Shiboken
-
-#endif // CONVERSIONS_H
-
diff --git a/sources/shiboken2/libshiboken/helper.cpp b/sources/shiboken2/libshiboken/helper.cpp
index 5792db5be..3ef68502b 100644
--- a/sources/shiboken2/libshiboken/helper.cpp
+++ b/sources/shiboken2/libshiboken/helper.cpp
@@ -38,6 +38,7 @@
****************************************************************************/
#include "helper.h"
+#include "sbkstring.h"
#include <stdarg.h>
namespace Shiboken
diff --git a/sources/shiboken2/libshiboken/helper.h b/sources/shiboken2/libshiboken/helper.h
index 33d97c62c..f3b50a7ea 100644
--- a/sources/shiboken2/libshiboken/helper.h
+++ b/sources/shiboken2/libshiboken/helper.h
@@ -42,7 +42,6 @@
#include "sbkpython.h"
#include "shibokenmacros.h"
-#include "conversions.h"
#include "autodecref.h"
#define SBK_UNUSED(x) (void)x;
@@ -50,46 +49,6 @@
namespace Shiboken
{
-template<typename A>
-inline PyObject* makeTuple(const A& a)
-{
- return PyTuple_Pack(1, AutoDecRef(Converter<A>::toPython(a)).object());
-}
-
-template<typename A, typename B>
-inline PyObject* makeTuple(const A& a, const B& b)
-{
- return PyTuple_Pack(2, AutoDecRef(Converter<A>::toPython(a)).object(),
- AutoDecRef(Converter<B>::toPython(b)).object());
-}
-
-template<typename A, typename B, typename C>
-inline PyObject* makeTuple(const A& a, const B& b, const C& c)
-{
- return PyTuple_Pack(3, AutoDecRef(Converter<A>::toPython(a)).object(),
- AutoDecRef(Converter<B>::toPython(b)).object(),
- AutoDecRef(Converter<C>::toPython(c)).object());
-}
-
-template<typename A, typename B, typename C, typename D>
-inline PyObject* makeTuple(const A& a, const B& b, const C& c, const D& d)
-{
- return PyTuple_Pack(4, AutoDecRef(Converter<A>::toPython(a)).object(),
- AutoDecRef(Converter<B>::toPython(b)).object(),
- AutoDecRef(Converter<C>::toPython(c)).object(),
- AutoDecRef(Converter<D>::toPython(d)).object());
-}
-
-template<typename A, typename B, typename C, typename D, typename E>
-inline PyObject* makeTuple(const A& a, const B& b, const C& c, const D& d, const E& e)
-{
- return PyTuple_Pack(5, AutoDecRef(Converter<A>::toPython(a)).object(),
- AutoDecRef(Converter<B>::toPython(b)).object(),
- AutoDecRef(Converter<C>::toPython(c)).object(),
- AutoDecRef(Converter<D>::toPython(d)).object(),
- AutoDecRef(Converter<E>::toPython(e)).object());
-}
-
/**
* It transforms a python sequence into two C variables, argc and argv.
* This function tries to find the application (script) name and put it into argv[0], if
diff --git a/sources/shiboken2/libshiboken/sbkconverter.cpp b/sources/shiboken2/libshiboken/sbkconverter.cpp
index b86e09fa2..0e154da39 100644
--- a/sources/shiboken2/libshiboken/sbkconverter.cpp
+++ b/sources/shiboken2/libshiboken/sbkconverter.cpp
@@ -41,9 +41,11 @@
#include "sbkconverter_p.h"
#include "sbkarrayconverter_p.h"
#include "basewrapper_p.h"
+#include "bindingmanager.h"
#include "autodecref.h"
#include "sbkdbg.h"
#include "helper.h"
+#include "voidptr.h"
#include <unordered_map>
@@ -76,7 +78,7 @@ void init()
Primitive<unsigned int>::createConverter(),
Primitive<unsigned long>::createConverter(),
Primitive<unsigned short>::createConverter(),
- Primitive<void*>::createConverter()
+ VoidPtr::createConverter()
};
PrimitiveTypeConverters = primitiveTypeConverters;
diff --git a/sources/shiboken2/libshiboken/sbkconverter.h b/sources/shiboken2/libshiboken/sbkconverter.h
index 18b6bbcf3..6d40f85cc 100644
--- a/sources/shiboken2/libshiboken/sbkconverter.h
+++ b/sources/shiboken2/libshiboken/sbkconverter.h
@@ -361,7 +361,38 @@ template<> inline SbkConverter* PrimitiveTypeConverter<unsigned long>() { return
template<> inline SbkConverter* PrimitiveTypeConverter<unsigned short>() { return primitiveTypeConverter(SBK_UNSIGNEDSHORT_IDX); }
template<> inline SbkConverter* PrimitiveTypeConverter<void*>() { return primitiveTypeConverter(SBK_VOIDPTR_IDX); }
-} } // namespace Shiboken::Conversions
+} // namespace Shiboken::Conversions
+
+/**
+* This function template is used to get the PyTypeObject of a C++ type T.
+* All implementations should be provided by template specializations generated by the generator when
+* T isn't a C++ primitive type.
+* \see SpecialCastFunction
+*/
+template<typename T> PyTypeObject* SbkType() { return 0; }
+
+// Below are the template specializations for C++ primitive types.
+template<> inline PyTypeObject* SbkType<PY_LONG_LONG>() { return &PyLong_Type; }
+template<> inline PyTypeObject* SbkType<bool>() { return &PyBool_Type; }
+template<> inline PyTypeObject* SbkType<char>() { return &PyInt_Type; }
+template<> inline PyTypeObject* SbkType<double>() { return &PyFloat_Type; }
+template<> inline PyTypeObject* SbkType<float>() { return &PyFloat_Type; }
+template<> inline PyTypeObject* SbkType<int>() { return &PyInt_Type; }
+template<> inline PyTypeObject* SbkType<long>() { return &PyLong_Type; }
+template<> inline PyTypeObject* SbkType<short>() { return &PyInt_Type; }
+template<> inline PyTypeObject* SbkType<signed char>() { return &PyInt_Type; }
+template<> inline PyTypeObject* SbkType<unsigned PY_LONG_LONG>() { return &PyLong_Type; }
+template<> inline PyTypeObject* SbkType<unsigned char>() { return &PyInt_Type; }
+template<> inline PyTypeObject* SbkType<unsigned int>() { return &PyLong_Type; }
+template<> inline PyTypeObject* SbkType<unsigned long>() { return &PyLong_Type; }
+template<> inline PyTypeObject* SbkType<unsigned short>() { return &PyInt_Type; }
+
+} // namespace Shiboken
+
+// When the user adds a function with an argument unknown for the typesystem, the generator writes type checks as
+// TYPENAME_Check, so this macro allows users to add PyObject arguments to their added functions.
+#define PyObject_Check(X) true
+#define SbkChar_Check(X) (SbkNumber_Check(X) || Shiboken::String::checkChar(X))
struct _SbkGenericType { PyHeapTypeObject super; SbkConverter** converter; };
#define SBK_CONVERTER(pyType) (*reinterpret_cast<_SbkGenericType*>(pyType)->converter)
diff --git a/sources/shiboken2/libshiboken/sbkconverter_p.h b/sources/shiboken2/libshiboken/sbkconverter_p.h
index fd1f7b6b2..cfe3d7e98 100644
--- a/sources/shiboken2/libshiboken/sbkconverter_p.h
+++ b/sources/shiboken2/libshiboken/sbkconverter_p.h
@@ -215,22 +215,6 @@ struct OverFlowChecker<float, PY_LONG_LONG, true> :
};
// Basic primitive type converters ---------------------------------------------------------
-template<typename T> PyTypeObject* SbkType() { return 0; }
-template<> inline PyTypeObject* SbkType<PY_LONG_LONG>() { return &PyLong_Type; }
-template<> inline PyTypeObject* SbkType<bool>() { return &PyBool_Type; }
-template<> inline PyTypeObject* SbkType<char>() { return &PyInt_Type; }
-template<> inline PyTypeObject* SbkType<const char*>() { return &PyString_Type; }
-template<> inline PyTypeObject* SbkType<double>() { return &PyFloat_Type; }
-template<> inline PyTypeObject* SbkType<float>() { return &PyFloat_Type; }
-template<> inline PyTypeObject* SbkType<int>() { return &PyInt_Type; }
-template<> inline PyTypeObject* SbkType<long>() { return &PyLong_Type; }
-template<> inline PyTypeObject* SbkType<short>() { return &PyInt_Type; }
-template<> inline PyTypeObject* SbkType<signed char>() { return &PyInt_Type; }
-template<> inline PyTypeObject* SbkType<unsigned PY_LONG_LONG>() { return &PyLong_Type; }
-template<> inline PyTypeObject* SbkType<unsigned char>() { return &PyInt_Type; }
-template<> inline PyTypeObject* SbkType<unsigned int>() { return &PyLong_Type; }
-template<> inline PyTypeObject* SbkType<unsigned long>() { return &PyLong_Type; }
-template<> inline PyTypeObject* SbkType<unsigned short>() { return &PyInt_Type; }
template <typename T> struct Primitive {};
@@ -242,8 +226,11 @@ struct OnePrimitive
static void toCpp(PyObject*, void*) {}
static SbkConverter* createConverter()
{
- SbkConverter* converter = Shiboken::Conversions::createConverter(SbkType<T>(), Primitive<T>::toPython);
- Shiboken::Conversions::addPythonToCppValueConversion(converter, Primitive<T>::toCpp, Primitive<T>::isConvertible);
+ SbkConverter* converter = Shiboken::Conversions::createConverter(Shiboken::SbkType<T>(),
+ Primitive<T>::toPython);
+ Shiboken::Conversions::addPythonToCppValueConversion(converter,
+ Primitive<T>::toCpp,
+ Primitive<T>::isConvertible);
return converter;
}
};
@@ -546,31 +533,6 @@ struct Primitive<std::string> : TwoPrimitive<std::string>
}
};
-// Void pointer ----------------------------------------------------------------------------
-
-template <>
-struct Primitive<void*> : OnePrimitive<void*>
-{
- static PyObject* toPython(const void* cppIn)
- {
- SbkDbg() << cppIn;
- if (!cppIn)
- Py_RETURN_NONE;
- PyObject *result = reinterpret_cast<PyObject *>(const_cast<void *>(cppIn));
- Py_INCREF(result);
- return result;
- }
- static void toCpp(PyObject* pyIn, void* cppOut)
- {
- SbkDbg() << pyIn;
- *reinterpret_cast<void **>(cppOut) = pyIn;
- }
- static PythonToCppFunc isConvertible(PyObject *)
- {
- return toCpp;
- }
-};
-
namespace Shiboken {
namespace Conversions {
SbkConverter *createConverterObject(PyTypeObject *type,
@@ -580,5 +542,4 @@ SbkConverter *createConverterObject(PyTypeObject *type,
CppToPythonFunc copyToPythonFunc);
} // namespace Conversions
} // namespace Shiboken
-
#endif // SBK_CONVERTER_P_H
diff --git a/sources/shiboken2/libshiboken/sbkenum.cpp b/sources/shiboken2/libshiboken/sbkenum.cpp
index 009d9ab2f..a62448aa6 100644
--- a/sources/shiboken2/libshiboken/sbkenum.cpp
+++ b/sources/shiboken2/libshiboken/sbkenum.cpp
@@ -43,7 +43,6 @@
#include "basewrapper.h"
#include "sbkdbg.h"
#include "autodecref.h"
-#include "typeresolver.h"
#include "sbkpython.h"
#include <string.h>
@@ -444,17 +443,12 @@ static PyTypeObject* createEnum(const char* fullName, const char* cppName, const
enumType->tp_as_number = flagsType->tp_as_number;
if (PyType_Ready(enumType) < 0)
return 0;
- Shiboken::TypeResolver::createValueTypeResolver<int>(cppName);
- if (shortName)
- Shiboken::TypeResolver::createValueTypeResolver<int>(shortName);
return enumType;
}
PyTypeObject* createGlobalEnum(PyObject* module, const char* name, const char* fullName, const char* cppName, PyTypeObject* flagsType)
{
PyTypeObject* enumType = createEnum(fullName, cppName, name, flagsType);
- Shiboken::TypeResolver::createValueTypeResolver<int>("Qt::WindowType");
- Shiboken::TypeResolver::createValueTypeResolver<int>("WindowType");
if (enumType && PyModule_AddObject(module, name, reinterpret_cast<PyObject *>(enumType)) < 0)
return 0;
if (flagsType && PyModule_AddObject(module, flagsType->tp_name, reinterpret_cast<PyObject *>(flagsType)) < 0)
diff --git a/sources/shiboken2/libshiboken/shiboken.h b/sources/shiboken2/libshiboken/shiboken.h
index 5bdef1b86..6cdfe65bd 100644
--- a/sources/shiboken2/libshiboken/shiboken.h
+++ b/sources/shiboken2/libshiboken/shiboken.h
@@ -44,7 +44,6 @@
#include "autodecref.h"
#include "basewrapper.h"
#include "bindingmanager.h"
-#include "conversions.h"
#include "gilstate.h"
#include "threadstatesaver.h"
#include "helper.h"
@@ -54,7 +53,6 @@
#include "sbkmodule.h"
#include "sbkstring.h"
#include "shibokenmacros.h"
-#include "typeresolver.h"
#include "shibokenbuffer.h"
#endif // SHIBOKEN_H
diff --git a/sources/shiboken2/libshiboken/typeresolver.cpp b/sources/shiboken2/libshiboken/typeresolver.cpp
deleted file mode 100644
index b23eb6371..000000000
--- a/sources/shiboken2/libshiboken/typeresolver.cpp
+++ /dev/null
@@ -1,160 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of PySide2.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "typeresolver.h"
-#include "sbkdbg.h"
-#include <cstdlib>
-#include <string>
-#include <unordered_map>
-#include "basewrapper_p.h"
-
-using namespace Shiboken;
-
-typedef std::unordered_map<std::string, TypeResolver *> TypeResolverMap;
-static TypeResolverMap typeResolverMap;
-
-struct TypeResolver::TypeResolverPrivate
-{
- CppToPythonFunc cppToPython;
- PythonToCppFunc pythonToCpp;
- PyTypeObject* pyType;
-};
-
-static void deinitTypeResolver()
-{
- for (TypeResolverMap::const_iterator it = typeResolverMap.begin(); it != typeResolverMap.end(); ++it)
- delete it->second;
- typeResolverMap.clear();
-}
-
-void Shiboken::initTypeResolver()
-{
- assert(typeResolverMap.empty());
- std::atexit(deinitTypeResolver);
-}
-
-TypeResolver::TypeResolver() : m_d(new TypeResolverPrivate)
-{
-}
-
-TypeResolver* TypeResolver::createTypeResolver(const char* typeName,
- CppToPythonFunc cppToPy,
- PythonToCppFunc pyToCpp,
- PyTypeObject* pyType)
-{
- TypeResolver*& tr = typeResolverMap[typeName];
- if (!tr) {
- tr = new TypeResolver;
- tr->m_d->cppToPython = cppToPy;
- tr->m_d->pythonToCpp = pyToCpp;
- tr->m_d->pyType = pyType;
-
- /*
- * Note:
- *
- * Value types are also registered as object types, but the generator *always* first register the value
- * type version in the TypeResolver and it *must* always do it! otherwise this code wont work.
- */
- if (pyType && PyType_IsSubtype(pyType, reinterpret_cast<PyTypeObject*>(&SbkObject_Type))) {
- SbkObjectType* sbkType = reinterpret_cast<SbkObjectType*>(pyType);
- // TODO-CONVERTERS: to be deprecated
- if (!sbkType->d->type_behaviour) {
- const size_t len = strlen(typeName);
- sbkType->d->type_behaviour = typeName[len -1] == '*' ? BEHAVIOUR_OBJECTTYPE : BEHAVIOUR_VALUETYPE;
- }
- }
- }
- return tr;
-}
-
-TypeResolver::~TypeResolver()
-{
- delete m_d;
-}
-
-TypeResolver* TypeResolver::get(const char* typeName)
-{
- TypeResolverMap::const_iterator it = typeResolverMap.find(typeName);
- if (it != typeResolverMap.end()) {
- return it->second;
- } else {
- if (Py_VerboseFlag > 0)
- SbkDbg() << "Can't find type resolver for " << typeName;
- return 0;
- }
-}
-
-void TypeResolver::toCpp(PyObject* pyObj, void** place)
-{
- m_d->pythonToCpp(pyObj, place);
-}
-
-PyObject* TypeResolver::toPython(void* cppObj)
-{
- return m_d->cppToPython(cppObj);
-}
-
-PyTypeObject* TypeResolver::pythonType()
-{
- return m_d->pyType;
-}
-
-TypeResolver::Type TypeResolver::getType(const char* name)
-{
- const size_t len = strlen(name);
- bool isObjTypeName = name[len - 1] == '*';
- if (TypeResolver::get(name)) {
- // great, we found the type in our first attempt!
- return isObjTypeName ? ObjectType : ValueType;
- } else {
- // Type not found... let's copy the string.
- std::string typeName(name);
- if (isObjTypeName)
- typeName.erase(len - 1, 1);
- else
- typeName += '*';
- isObjTypeName = !isObjTypeName;
-
- if (TypeResolver::get(typeName.c_str()))
- return isObjTypeName ? ObjectType : ValueType;
- else
- return UnknownType;
- }
-}
-
diff --git a/sources/shiboken2/libshiboken/typeresolver.h b/sources/shiboken2/libshiboken/typeresolver.h
deleted file mode 100644
index bc56522fe..000000000
--- a/sources/shiboken2/libshiboken/typeresolver.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of PySide2.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef TYPERESOLVER_H
-#define TYPERESOLVER_H
-
-#include "shibokenmacros.h"
-#include "conversions.h"
-
-namespace Shiboken
-{
-
-/* To C++ convertion functions. */
-template <typename T>
-inline void pythonToValueType(PyObject* pyobj, void** data)
-{
- *reinterpret_cast<T*>(*data) = Shiboken::Converter<T>::toCpp(pyobj);
-}
-
-template <typename T>
-inline void pythonToObjectType(PyObject* pyobj, void** data)
-{
- *reinterpret_cast<T**>(*data) = Shiboken::Converter<T*>::toCpp(pyobj);
-}
-
-template <typename T>
-inline PyObject* objectTypeToPython(void* cptr)
-{
- return Shiboken::Converter<T*>::toPython(*reinterpret_cast<T**>(cptr));
-}
-
-template <typename T>
-inline PyObject* referenceTypeToPython(void* cptr)
-{
- // cptr comes the same way it come when we have a value type, but
- // we deliver a Python object of a reference
- return Shiboken::Converter<T&>::toPython(*reinterpret_cast<T*>(cptr));
-}
-
-/**
-* \internal This function is not part of the public API.
-* Initialize the TypeResource internal cache.
-*/
-void initTypeResolver();
-
-class LIBSHIBOKEN_API TypeResolver
-{
-public:
- enum Type
- {
- ObjectType,
- ValueType,
- UnknownType
- };
-
- typedef PyObject* (*CppToPythonFunc)(void*);
- typedef void (*PythonToCppFunc)(PyObject*, void**);
-
- ~TypeResolver();
-
- template<typename T>
- static TypeResolver* createValueTypeResolver(const char* typeName)
- {
- return createTypeResolver(typeName, &Shiboken::Converter<T>::toPython, &pythonToValueType<T>, SbkType<T>());
- }
-
- template<typename T>
- static TypeResolver* createObjectTypeResolver(const char* typeName)
- {
- return createTypeResolver(typeName, &objectTypeToPython<T>, &pythonToObjectType<T>, SbkType<T>());
- }
-
- /**
- * This kind of type resolver is used only when we have a signal with a reference in their arguments
- * like on QSqlTableModel::primeInsert.
- */
- template<typename T>
- static TypeResolver* createReferenceTypeResolver(const char* typeName)
- {
- return createTypeResolver(typeName, &referenceTypeToPython<T>, &pythonToValueType<T>, SbkType<T>());
- }
-
- static Type getType(const char* name);
- static TypeResolver* get(const char* typeName);
-
- PyObject* toPython(void* cppObj);
- void toCpp(PyObject* pyObj, void** place);
- PyTypeObject* pythonType();
-
-private:
- struct TypeResolverPrivate;
- TypeResolverPrivate* m_d;
-
- TypeResolver();
- // disable object copy
- TypeResolver(const TypeResolver&);
- TypeResolver& operator=(const TypeResolver&);
-
- static TypeResolver* createTypeResolver(const char* typeName, CppToPythonFunc cppToPy, PythonToCppFunc pyToCpp, PyTypeObject* pyType);
-};
-}
-
-#endif
diff --git a/sources/shiboken2/libshiboken/voidptr.cpp b/sources/shiboken2/libshiboken/voidptr.cpp
new file mode 100644
index 000000000..ad2a57358
--- /dev/null
+++ b/sources/shiboken2/libshiboken/voidptr.cpp
@@ -0,0 +1,452 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of PySide2.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "voidptr.h"
+#include "sbkconverter.h"
+#include "basewrapper.h"
+#include "basewrapper_p.h"
+
+extern "C"
+{
+
+// Void pointer object definition.
+typedef struct {
+ PyObject_HEAD
+ void *cptr;
+ Py_ssize_t size;
+ bool isWritable;
+} SbkVoidPtrObject;
+
+PyObject *SbkVoidPtrObject_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+ SbkVoidPtrObject *self = reinterpret_cast<SbkVoidPtrObject *>(type->tp_alloc(type, 0));
+
+ if (self != 0) {
+ self->cptr = 0;
+ self->size = -1;
+ self->isWritable = false;
+ }
+
+ return reinterpret_cast<PyObject *>(self);
+}
+
+#define SbkVoidPtr_Check(op) (Py_TYPE(op) == &SbkVoidPtrType)
+
+
+int SbkVoidPtrObject_init(PyObject *self, PyObject *args, PyObject *kwds)
+{
+ PyObject *addressObject;
+ Py_ssize_t size = -1;
+ int isWritable = 0;
+ SbkVoidPtrObject *sbkSelf = reinterpret_cast<SbkVoidPtrObject *>(self);
+
+ static const char *kwlist[] = {"address", "size", "writeable", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|ni", const_cast<char **>(kwlist),
+ &addressObject, &size, &isWritable))
+ return -1;
+
+ // Void pointer.
+ if (SbkVoidPtr_Check(addressObject)) {
+ SbkVoidPtrObject *sbkOther = reinterpret_cast<SbkVoidPtrObject *>(addressObject);
+ sbkSelf->cptr = sbkOther->cptr;
+ sbkSelf->size = sbkOther->size;
+ sbkSelf->isWritable = sbkOther->isWritable > 0 ? true : false;
+ }
+ // Shiboken::Object wrapper.
+ else if (Shiboken::Object::checkType(addressObject)) {
+ SbkObject *sbkOther = reinterpret_cast<SbkObject *>(addressObject);
+ sbkSelf->cptr = sbkOther->d->cptr[0];
+ sbkSelf->size = size;
+ sbkSelf->isWritable = isWritable > 0 ? true : false;
+ }
+ // Python buffer interface.
+ else if (PyObject_CheckBuffer(addressObject)) {
+ Py_buffer bufferView;
+
+ // Bail out if the object can't provide a simple contiguous buffer.
+ if (PyObject_GetBuffer(addressObject, &bufferView, PyBUF_SIMPLE) < 0)
+ return 0;
+
+ sbkSelf->cptr = bufferView.buf;
+ sbkSelf->size = bufferView.len;
+ sbkSelf->isWritable = bufferView.readonly > 0 ? false : true;
+
+ // Release the buffer.
+ PyBuffer_Release(&bufferView);
+ }
+ // An integer representing an address.
+ else {
+ void *cptr = PyLong_AsVoidPtr(addressObject);
+ if (PyErr_Occurred()) {
+ PyErr_SetString(PyExc_TypeError,
+ "Creating a VoidPtr object requires an address of a C++ object, "
+ "a wrapped Shiboken Object type, "
+ "an object implementing the Python Buffer interface, "
+ "or another VoidPtr object.");
+ return -1;
+ }
+ sbkSelf->cptr = cptr;
+ sbkSelf->size = size;
+ sbkSelf->isWritable = isWritable > 0 ? true : false;
+ }
+
+ return 0;
+}
+
+PyObject *SbkVoidPtrObject_richcmp(PyObject *obj1, PyObject *obj2, int op)
+{
+ PyObject *result = Py_False;
+ void *cptr1 = 0;
+ void *cptr2 = 0;
+ bool validObjects = true;
+
+ if (SbkVoidPtr_Check(obj1))
+ cptr1 = reinterpret_cast<SbkVoidPtrObject *>(obj1)->cptr;
+ else
+ validObjects = false;
+
+ if (SbkVoidPtr_Check(obj2))
+ cptr2 = reinterpret_cast<SbkVoidPtrObject *>(obj2)->cptr;
+ else
+ validObjects = false;
+
+ if (validObjects) {
+ switch (op) {
+ case Py_EQ: if (cptr1 == cptr2) result = Py_True; break;
+ case Py_NE: if (cptr1 != cptr2) result = Py_True; break;
+ case Py_LT: break;
+ case Py_LE: break;
+ case Py_GT: break;
+ case Py_GE: break;
+ }
+ }
+
+ Py_INCREF(result);
+ return result;
+}
+
+PyObject *SbkVoidPtrObject_int(PyObject *v)
+{
+ SbkVoidPtrObject *sbkObject = reinterpret_cast<SbkVoidPtrObject *>(v);
+ return PyLong_FromVoidPtr(sbkObject->cptr);
+}
+
+static PyNumberMethods SbkVoidPtrObjectAsNumber = {
+ /* nb_add */ 0,
+ /* nb_subtract */ 0,
+ /* nb_multiply */ 0,
+#ifndef IS_PY3K
+ /* nb_divide */ 0,
+#endif
+ /* nb_remainder */ 0,
+ /* nb_divmod */ 0,
+ /* nb_power */ 0,
+ /* nb_negative */ 0,
+ /* nb_positive */ 0,
+ /* nb_absolute */ 0,
+ /* nb_bool/nb_nonzero */ 0,
+ /* nb_invert */ 0,
+ /* nb_lshift */ 0,
+ /* nb_rshift */ 0,
+ /* nb_and */ 0,
+ /* nb_xor */ 0,
+ /* nb_or */ 0,
+#ifndef IS_PY3K
+ /* nb_coerce */ 0,
+#endif
+ /* nb_int */ SbkVoidPtrObject_int,
+#ifdef IS_PY3K
+ /* nb_reserved */ 0,
+ /* nb_float */ 0,
+#else
+ /* nb_long */ 0,
+ /* nb_float */ 0,
+ /* nb_oct */ 0,
+ /* nb_hex */ 0,
+#endif
+
+ /* nb_inplace_add */ 0,
+ /* nb_inplace_subtract */ 0,
+ /* nb_inplace_multiply */ 0,
+#ifndef IS_PY3K
+ /* nb_inplace_div */ 0,
+#endif
+ /* nb_inplace_remainder */ 0,
+ /* nb_inplace_power */ 0,
+ /* nb_inplace_lshift */ 0,
+ /* nb_inplace_rshift */ 0,
+ /* nb_inplace_and */ 0,
+ /* nb_inplace_xor */ 0,
+ /* nb_inplace_or */ 0,
+
+ /* nb_floor_divide */ 0,
+ /* nb_true_divide */ 0,
+ /* nb_inplace_floor_divide */ 0,
+ /* nb_inplace_true_divide */ 0,
+
+ /* nb_index */ 0
+};
+
+static Py_ssize_t SbkVoidPtrObject_length(PyObject *v)
+{
+ SbkVoidPtrObject *sbkObject = reinterpret_cast<SbkVoidPtrObject *>(v);
+ if (sbkObject->size < 0) {
+ PyErr_SetString(PyExc_IndexError, "VoidPtr does not have a size set.");
+ return -1;
+ }
+
+ return sbkObject->size;
+}
+
+static PySequenceMethods SbkVoidPtrObjectAsSequence = {
+ /* sq_length */ SbkVoidPtrObject_length,
+ /* sq_concat */ 0,
+ /* sq_repeat */ 0,
+ /* sq_item */ 0,
+ /* sq_slice */ 0,
+ /* sq_ass_item */ 0,
+ /* sq_ass_slice */ 0,
+ /* sq_contains */ 0,
+ /* sq_inplace_concat */ 0,
+ /* sq_inplace_repeat */ 0
+};
+
+static const char trueString[] = "True" ;
+static const char falseString[] = "False" ;
+
+PyObject *SbkVoidPtrObject_repr(PyObject *v)
+{
+
+
+ SbkVoidPtrObject *sbkObject = reinterpret_cast<SbkVoidPtrObject *>(v);
+ PyObject *s = PyBytes_FromFormat("%s(%p, %zd, %s)",
+ Py_TYPE(sbkObject)->tp_name,
+ sbkObject->cptr,
+ sbkObject->size,
+ sbkObject->isWritable ? trueString : falseString);
+ Py_XINCREF(s);
+ return s;
+}
+
+PyObject *SbkVoidPtrObject_str(PyObject *v)
+{
+ SbkVoidPtrObject *sbkObject = reinterpret_cast<SbkVoidPtrObject *>(v);
+ PyObject *s = PyBytes_FromFormat("%s(Address %p, Size %zd, isWritable %s)",
+ Py_TYPE(sbkObject)->tp_name,
+ sbkObject->cptr,
+ sbkObject->size,
+ sbkObject->isWritable ? trueString : falseString);
+ Py_XINCREF(s);
+ return s;
+}
+
+
+// Void pointer type definition.
+PyTypeObject SbkVoidPtrType = {
+ PyVarObject_HEAD_INIT(&PyType_Type, 0) /*ob_size*/
+ "VoidPtr", /*tp_name*/
+ sizeof(SbkVoidPtrObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ 0, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ SbkVoidPtrObject_repr, /*tp_repr*/
+ &SbkVoidPtrObjectAsNumber, /*tp_as_number*/
+ &SbkVoidPtrObjectAsSequence, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+ 0, /*tp_call*/
+ SbkVoidPtrObject_str, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT, /*tp_flags*/
+ "Void pointer wrapper", /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ SbkVoidPtrObject_richcmp, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ 0, /*tp_methods*/
+ 0, /*tp_members*/
+ 0, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ SbkVoidPtrObject_init, /*tp_init*/
+ 0, /*tp_alloc*/
+ SbkVoidPtrObject_new, /*tp_new*/
+ 0, /*tp_free*/
+ 0, /*tp_is_gc*/
+ 0, /*tp_bases*/
+ 0, /*tp_mro*/
+ 0, /*tp_cache*/
+ 0, /*tp_subclasses*/
+ 0, /*tp_weaklist*/
+ 0, /*tp_del*/
+ 0, /*tp_version_tag*/
+#if PY_MAJOR_VERSION > 3 || PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 4
+ 0 /*tp_finalize*/
+#endif
+};
+
+}
+
+
+namespace VoidPtr {
+
+static int voidPointerInitialized = false;
+
+void init()
+{
+ if (PyType_Ready(reinterpret_cast<PyTypeObject *>(&SbkVoidPtrType)) < 0)
+ Py_FatalError("[libshiboken] Failed to initialize Shiboken.VoidPtr type.");
+ else
+ voidPointerInitialized = true;
+}
+
+void addVoidPtrToModule(PyObject *module)
+{
+ if (voidPointerInitialized) {
+ Py_INCREF(&SbkVoidPtrType);
+ PyModule_AddObject(module, SbkVoidPtrType.tp_name,
+ reinterpret_cast<PyObject *>(&SbkVoidPtrType));
+ }
+}
+
+static PyObject *createVoidPtr(void *cppIn, Py_ssize_t size = 0, bool isWritable = false)
+{
+ if (!cppIn)
+ Py_RETURN_NONE;
+
+ SbkVoidPtrObject *result = PyObject_NEW(SbkVoidPtrObject, &SbkVoidPtrType);
+ if (!result)
+ Py_RETURN_NONE;
+
+ result->cptr = cppIn;
+ result->size = size;
+ result->isWritable = isWritable;
+
+ return reinterpret_cast<PyObject *>(result);
+}
+
+static PyObject *toPython(const void *cppIn)
+{
+ return createVoidPtr(const_cast<void *>(cppIn));
+}
+
+static void VoidPtrToCpp(PyObject *pyIn, void *cppOut)
+{
+ SbkVoidPtrObject *sbkIn = reinterpret_cast<SbkVoidPtrObject *>(pyIn);
+ *reinterpret_cast<void **>(cppOut) = sbkIn->cptr;
+}
+
+static PythonToCppFunc VoidPtrToCppIsConvertible(PyObject *pyIn)
+{
+ return SbkVoidPtr_Check(pyIn) ? VoidPtrToCpp : 0;
+}
+
+static void SbkObjectToCpp(PyObject *pyIn, void *cppOut)
+{
+ SbkObject *sbkIn = reinterpret_cast<SbkObject *>(pyIn);
+ *reinterpret_cast<void **>(cppOut) = sbkIn->d->cptr[0];
+}
+
+static PythonToCppFunc SbkObjectToCppIsConvertible(PyObject *pyIn)
+{
+ return Shiboken::Object::checkType(pyIn) ? SbkObjectToCpp : 0;
+}
+
+static void PythonBufferToCpp(PyObject *pyIn, void *cppOut)
+{
+ if (PyObject_CheckBuffer(pyIn)) {
+ Py_buffer bufferView;
+
+ // Bail out if the object can't provide a simple contiguous buffer.
+ if (PyObject_GetBuffer(pyIn, &bufferView, PyBUF_SIMPLE) < 0)
+ return;
+
+ *reinterpret_cast<void **>(cppOut) = bufferView.buf;
+
+ // Release the buffer.
+ PyBuffer_Release(&bufferView);
+ }
+}
+
+static PythonToCppFunc PythonBufferToCppIsConvertible(PyObject *pyIn)
+{
+ if (PyObject_CheckBuffer(pyIn)) {
+ Py_buffer bufferView;
+
+ // Bail out if the object can't provide a simple contiguous buffer.
+ if (PyObject_GetBuffer(pyIn, &bufferView, PyBUF_SIMPLE) < 0)
+ return 0;
+
+ // Release the buffer.
+ PyBuffer_Release(&bufferView);
+
+ return PythonBufferToCpp;
+ }
+ return 0;
+}
+
+SbkConverter *createConverter()
+{
+ SbkConverter *converter = Shiboken::Conversions::createConverter(&SbkVoidPtrType, toPython);
+ Shiboken::Conversions::addPythonToCppValueConversion(converter,
+ VoidPtrToCpp,
+ VoidPtrToCppIsConvertible);
+ Shiboken::Conversions::addPythonToCppValueConversion(converter,
+ SbkObjectToCpp,
+ SbkObjectToCppIsConvertible);
+ Shiboken::Conversions::addPythonToCppValueConversion(converter,
+ PythonBufferToCpp,
+ PythonBufferToCppIsConvertible);
+ return converter;
+}
+
+} // namespace VoidPtr
+
+
diff --git a/sources/shiboken2/libshiboken/voidptr.h b/sources/shiboken2/libshiboken/voidptr.h
new file mode 100644
index 000000000..17dd3a008
--- /dev/null
+++ b/sources/shiboken2/libshiboken/voidptr.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of PySide2.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef VOIDPTR_H
+#define VOIDPTR_H
+
+#include <Python.h>
+#include "shibokenmacros.h"
+#include "sbkconverter.h"
+
+extern "C"
+{
+
+// Void pointer type declaration.
+extern LIBSHIBOKEN_API PyTypeObject SbkVoidPtrType;
+
+} // extern "C"
+
+namespace VoidPtr
+{
+
+void init();
+SbkConverter *createConverter();
+LIBSHIBOKEN_API void addVoidPtrToModule(PyObject *module);
+
+}
+
+
+#endif // VOIDPTR_H
diff --git a/sources/shiboken2/shibokenmodule/CMakeLists.txt b/sources/shiboken2/shibokenmodule/CMakeLists.txt
index 31b98132d..f2d7b30f2 100644
--- a/sources/shiboken2/shibokenmodule/CMakeLists.txt
+++ b/sources/shiboken2/shibokenmodule/CMakeLists.txt
@@ -8,11 +8,16 @@ set(sample_SRC
${CMAKE_CURRENT_BINARY_DIR}/shiboken2/shiboken2_module_wrapper.cpp
)
+set(shibokenmodule_TYPESYSTEM
+${CMAKE_CURRENT_SOURCE_DIR}/typesystem_shiboken.xml
+)
+
add_custom_command(OUTPUT ${sample_SRC}
# Note: shiboken2 is an executable target. By not specifying its explicit
# path, CMAKE figures it out, itself!
# This fixes an issue with Visual Studio, see https://github.com/PySide/shiboken2/pull/11
COMMAND shiboken2 --project-file=${CMAKE_CURRENT_BINARY_DIR}/shibokenmodule.txt ${GENERATOR_EXTRA_FLAGS}
+DEPENDS ${shibokenmodule_TYPESYSTEM}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Running generator for 'shiboken2'..."
)
diff --git a/sources/shiboken2/shibokenmodule/typesystem_shiboken.xml b/sources/shiboken2/shibokenmodule/typesystem_shiboken.xml
index 18ab52e80..bdb0c9338 100644
--- a/sources/shiboken2/shibokenmodule/typesystem_shiboken.xml
+++ b/sources/shiboken2/shibokenmodule/typesystem_shiboken.xml
@@ -105,6 +105,7 @@
<extra-includes>
<include file-name="sbkversion.h" location="local"/>
+ <include file-name="voidptr.h" location="local"/>
</extra-includes>
<inject-code position="end">
// Add __version__ and __version_info__ attributes to the module
@@ -116,5 +117,7 @@
PyTuple_SET_ITEM(version, 4, PyInt_FromLong(SHIBOKEN_SERIAL));
PyModule_AddObject(module, "__version_info__", version);
PyModule_AddStringConstant(module, "__version__", SHIBOKEN_VERSION);
+
+ VoidPtr::addVoidPtrToModule(module);
</inject-code>
</typesystem>
diff --git a/sources/shiboken2/tests/libsample/voidholder.h b/sources/shiboken2/tests/libsample/voidholder.h
index 228bbae3f..6453ce2e7 100644
--- a/sources/shiboken2/tests/libsample/voidholder.h
+++ b/sources/shiboken2/tests/libsample/voidholder.h
@@ -42,6 +42,10 @@ public:
static void* pointerToSomething = new VoidHolder();
return pointerToSomething;
}
+ void *takeVoidPointer(void *item)
+ {
+ return item;
+ }
private:
void* m_ptr;
};
diff --git a/sources/shiboken2/tests/samplebinding/typesystem_sample.xml b/sources/shiboken2/tests/samplebinding/typesystem_sample.xml
index e0085abbe..e6ef28f66 100644
--- a/sources/shiboken2/tests/samplebinding/typesystem_sample.xml
+++ b/sources/shiboken2/tests/samplebinding/typesystem_sample.xml
@@ -2245,17 +2245,7 @@
</modify-function>
</value-type>
- <value-type name="VoidHolder">
- <modify-function signature="gimmeMeSomeVoidPointer()">
- <modify-argument index="return">
- <replace-type modified-type="PyObject*"/>
- </modify-argument>
- <inject-code class="target" position="end">
- %RETURN_TYPE %0 = %TYPE::%FUNCTION_NAME();
- %PYARG_0 = Shiboken::Object::newObject(&amp;SbkObject_Type, %0, false, false);
- </inject-code>
- </modify-function>
- </value-type>
+ <value-type name="VoidHolder" />
<object-type name="PrivateCtor" />
<object-type name="PrivateDtor" />
diff --git a/sources/shiboken2/tests/samplebinding/voidholder_test.py b/sources/shiboken2/tests/samplebinding/voidholder_test.py
index cb5cab6e5..6e841684b 100644
--- a/sources/shiboken2/tests/samplebinding/voidholder_test.py
+++ b/sources/shiboken2/tests/samplebinding/voidholder_test.py
@@ -34,21 +34,29 @@
import unittest
from sample import VoidHolder, Point
+import shiboken2 as shiboken
class VoidHolderTest(unittest.TestCase):
'''Test case for void pointer manipulation.'''
def testGetVoidPointerFromCppAndPutsOnVoidHolder(self):
- '''Passes a void pointer created in C++ and to kept by VoidHolder.'''
+ '''Passes a void pointer created in C++ to be kept by VoidHolder.'''
voidptr = VoidHolder.gimmeMeSomeVoidPointer()
voidholder = VoidHolder(voidptr)
self.assertEqual(voidptr, voidholder.voidPointer())
+ def testPassVoidPointerAsArgument(self):
+ '''Passes a void pointer created in C++ as an argument to a function.'''
+ voidptr = VoidHolder.gimmeMeSomeVoidPointer()
+ voidHolder = VoidHolder()
+ returnValue = voidHolder.takeVoidPointer(voidptr)
+ self.assertEqual(returnValue, voidptr)
+
def testPutRandomObjectInsideVoidHolder(self):
'''Passes a C++ pointer for an object created in Python to be kept by VoidHolder.'''
obj = Point(1, 2)
voidholder = VoidHolder(obj)
- self.assertEqual(obj, voidholder.voidPointer())
+ self.assertEqual(shiboken.getCppPointer(obj)[0], int(voidholder.voidPointer()))
def testGetNoneObjectFromVoidHolder(self):
'''A VoidHolder created without parameters returns a NULL pointer
@@ -56,14 +64,6 @@ class VoidHolderTest(unittest.TestCase):
voidholder = VoidHolder()
self.assertEqual(voidholder.voidPointer(), None)
- def testPutPythonObjectInsideVoidHolder(self):
- '''Passes a native Python object to be kept by VoidHolder.'''
- obj = 'Foo'
- voidholder = VoidHolder(obj)
- self.assertEqual(obj, voidholder.voidPointer())
-
-
-
if __name__ == '__main__':
unittest.main()
diff --git a/utils.py b/utils.py
index cbd19c207..75ff2d851 100644
--- a/utils.py
+++ b/utils.py
@@ -46,6 +46,7 @@ import time
import shutil
import subprocess
import fnmatch
+import glob
import itertools
import popenasync
@@ -660,6 +661,37 @@ def osx_localize_libpaths(libpath, local_libs, enc_path=None):
back_tick('install_name_tool -add_rpath {epa} {lipa}'.format(
epa=enc_path, lipa=libpath ))
+# Find an executable specified by a glob pattern ('foo*') in the OS path
+def findGlobInPath(pattern):
+ result = []
+ if sys.platform == 'win32':
+ pattern += '.exe'
+
+ for path in os.environ.get('PATH', '').split(os.pathsep):
+ for match in glob.glob(os.path.join(path, pattern)):
+ result.append(match)
+ return result
+
+# Locate the most recent version of llvmConfig in the path.
+def findLlvmConfig():
+ versionRe = re.compile('(\d+)\.(\d+)\.(\d+)')
+ result = None
+ lastVersionString = '000000'
+ for llvmConfig in findGlobInPath('llvm-config*'):
+ try:
+ output = run_process_output([llvmConfig, '--version'])
+ if output:
+ match = versionRe.match(output[0])
+ if match:
+ versionString = '%02d%02d%02d' % (int(match.group(1)),
+ int(match.group(2)), int(match.group(3)))
+ if (versionString > lastVersionString):
+ result = llvmConfig
+ lastVersionString = versionString
+ except OSError:
+ pass
+ return result
+
# Add Clang to path for Windows for the shiboken ApiExtractor tests.
# Revisit once Clang is bundled with Qt.
def detectClang():
@@ -669,7 +701,7 @@ def detectClang():
source = 'CLANG_INSTALL_DIR'
clangDir = os.environ.get(source, None)
if not clangDir:
- source = 'llvm-config'
+ source = findLlvmConfig()
try:
output = run_process_output([source, '--prefix'])
if output: