aboutsummaryrefslogtreecommitdiffstats
path: root/sources
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2018-05-09 15:13:51 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2018-05-09 15:14:14 +0200
commit5fce76074c01e52a22151133a1e3a2cf71cfe535 (patch)
tree2d391fff868b398c1e2d77bd334f9a05b1d75394 /sources
parent278c05bd61c69afe5ec3d30a56931aeadc17cae8 (diff)
parent9dc1aa57dfbf9c684e5c75451dd028b88099c348 (diff)
Merge remote-tracking branch 'origin/5.9' into 5.11
Diffstat (limited to 'sources')
-rw-r--r--sources/pyside2/PySide2/QtCore/typesystem_core_common.xml5
-rw-r--r--sources/pyside2/PySide2/QtNetwork/CMakeLists.txt18
-rw-r--r--sources/pyside2/PySide2/QtNetwork/typesystem_network.xml33
-rw-r--r--sources/pyside2/doc/index.rst2
-rw-r--r--sources/pyside2/tests/QtNetwork/CMakeLists.txt1
-rw-r--r--sources/pyside2/tests/QtNetwork/dnslookup_test.py59
-rw-r--r--sources/pyside2/tests/registry/exists_darwin_5_9_4_ci.py6
-rw-r--r--sources/pyside2/tests/registry/exists_linux_5_9_4_ci.py6
-rw-r--r--sources/pyside2/tests/registry/exists_win32_5_9_4_ci.py6
-rw-r--r--sources/shiboken2/CMakeLists.txt62
-rw-r--r--sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp162
-rw-r--r--sources/shiboken2/generator/qtdoc/qtdocgenerator.h15
-rw-r--r--sources/shiboken2/libshiboken/sbkpython.h4
13 files changed, 313 insertions, 66 deletions
diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
index 1e239f38b..77d074077 100644
--- a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
+++ b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
@@ -394,8 +394,9 @@
double in = %CONVERTTOCPP[double](%in);
%out = %OUTTYPE(in);
</add-conversion>
- <add-conversion type="PyInt">
- int in = %CONVERTTOCPP[int](%in);
+ <!-- Using PyLong instead of PyInt to support Python2 and 3-->
+ <add-conversion type="PyInt" check="PyInt_CheckExact(%in)">
+ qlonglong in = %CONVERTTOCPP[qlonglong](%in);
%out = %OUTTYPE(in);
</add-conversion>
<add-conversion type="PyLong" check="PyLong_CheckExact(%in)">
diff --git a/sources/pyside2/PySide2/QtNetwork/CMakeLists.txt b/sources/pyside2/PySide2/QtNetwork/CMakeLists.txt
index 68037017d..0267bfae3 100644
--- a/sources/pyside2/PySide2/QtNetwork/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtNetwork/CMakeLists.txt
@@ -4,18 +4,35 @@ set(QtNetwork_OPTIONAL_SRC )
set(QtNetwork_DROPPED_ENTRIES )
check_qt_class(QtNetwork QSslCertificate QtNetwork_OPTIONAL_SRC QtNetwork_DROPPED_ENTRIES)
+check_qt_class(QtNetwork QSslCertificateExtension QtNetwork_OPTIONAL_SRC QtNetwork_DROPPED_ENTRIES)
check_qt_class(QtNetwork QSslCipher QtNetwork_OPTIONAL_SRC QtNetwork_DROPPED_ENTRIES)
check_qt_class(QtNetwork QSslConfiguration QtNetwork_OPTIONAL_SRC QtNetwork_DROPPED_ENTRIES)
+check_qt_class(QtNetwork QSslDiffieHellmanParameters QtNetwork_OPTIONAL_SRC QtNetwork_DROPPED_ENTRIES)
+# Problems with operator==(QSslEllipticCurve,QSslEllipticCurve)
+# check_qt_class(QtNetwork QSslEllipticCurve QtNetwork_OPTIONAL_SRC QtNetwork_DROPPED_ENTRIES)
check_qt_class(QtNetwork QSslError QtNetwork_OPTIONAL_SRC QtNetwork_DROPPED_ENTRIES)
check_qt_class(QtNetwork QSslKey QtNetwork_OPTIONAL_SRC QtNetwork_DROPPED_ENTRIES)
+check_qt_class(QtNetwork QSslPreSharedKeyAuthenticator QtNetwork_OPTIONAL_SRC QtNetwork_DROPPED_ENTRIES)
check_qt_class(QtNetwork QSslSocket QtNetwork_OPTIONAL_SRC QtNetwork_DROPPED_ENTRIES)
+check_qt_class(QtNetwork QSctpServer QtNetwork_OPTIONAL_SRC QtNetwork_DROPPED_ENTRIES)
+check_qt_class(QtNetwork QSctpSocket QtNetwork_OPTIONAL_SRC QtNetwork_DROPPED_ENTRIES)
+
set(QtNetwork_SRC
${QtNetwork_GEN_DIR}/qabstractnetworkcache_wrapper.cpp
${QtNetwork_GEN_DIR}/qabstractsocket_wrapper.cpp
${QtNetwork_GEN_DIR}/qauthenticator_wrapper.cpp
+${QtNetwork_GEN_DIR}/qdnsdomainnamerecord_wrapper.cpp
+${QtNetwork_GEN_DIR}/qdnshostaddressrecord_wrapper.cpp
+${QtNetwork_GEN_DIR}/qdnslookup_wrapper.cpp
+${QtNetwork_GEN_DIR}/qdnsmailexchangerecord_wrapper.cpp
+${QtNetwork_GEN_DIR}/qdnsservicerecord_wrapper.cpp
+${QtNetwork_GEN_DIR}/qdnstextrecord_wrapper.cpp
${QtNetwork_GEN_DIR}/qhostaddress_wrapper.cpp
${QtNetwork_GEN_DIR}/qhostinfo_wrapper.cpp
+${QtNetwork_GEN_DIR}/qhstspolicy_wrapper.cpp
+${QtNetwork_GEN_DIR}/qhttpmultipart_wrapper.cpp
+${QtNetwork_GEN_DIR}/qhttppart_wrapper.cpp
${QtNetwork_GEN_DIR}/qipv6address_wrapper.cpp
${QtNetwork_GEN_DIR}/qlocalserver_wrapper.cpp
${QtNetwork_GEN_DIR}/qlocalsocket_wrapper.cpp
@@ -26,6 +43,7 @@ ${QtNetwork_GEN_DIR}/qnetworkconfiguration_wrapper.cpp
${QtNetwork_GEN_DIR}/qnetworkconfigurationmanager_wrapper.cpp
${QtNetwork_GEN_DIR}/qnetworkcookie_wrapper.cpp
${QtNetwork_GEN_DIR}/qnetworkcookiejar_wrapper.cpp
+${QtNetwork_GEN_DIR}/qnetworkdatagram_wrapper.cpp
${QtNetwork_GEN_DIR}/qnetworkdiskcache_wrapper.cpp
${QtNetwork_GEN_DIR}/qnetworkinterface_wrapper.cpp
${QtNetwork_GEN_DIR}/qnetworkproxy_wrapper.cpp
diff --git a/sources/pyside2/PySide2/QtNetwork/typesystem_network.xml b/sources/pyside2/PySide2/QtNetwork/typesystem_network.xml
index 18c3b28bc..e4235e070 100644
--- a/sources/pyside2/PySide2/QtNetwork/typesystem_network.xml
+++ b/sources/pyside2/PySide2/QtNetwork/typesystem_network.xml
@@ -71,6 +71,22 @@
<modify-function signature="waitForDisconnected(int)" allow-thread="yes" />
</object-type>
+ <value-type name="QDnsDomainNameRecord"/>
+ <value-type name="QDnsHostAddressRecord"/>
+ <object-type name="QDnsLookup">
+ <enum-type name="Error"/>
+ <enum-type name="Type"/>
+ </object-type>
+ <value-type name="QDnsMailExchangeRecord"/>
+ <value-type name="QDnsServiceRecord"/>
+ <value-type name="QDnsTextRecord"/>
+ <value-type name="QHstsPolicy" since="5.9">
+ <enum-type name="PolicyFlag" flags="PolicyFlags"/>
+ </value-type>
+ <object-type name="QHttpMultiPart">
+ <enum-type name="ContentType"/>
+ </object-type>
+ <value-type name="QHttpPart" since="5.9"/>
<object-type name="QTcpServer">
<modify-function signature="waitForNewConnection(int,bool*)" allow-thread="yes">
<!-- FIXME removing default expression means user will always have to pass a value, but he wouldn't have to -->
@@ -172,6 +188,7 @@
</modify-function>
</object-type>
<object-type name="QNetworkCookieJar"/>
+ <value-type name="QNetworkDatagram" since="5.8"/>
<object-type name="QNetworkReply">
<enum-type name="NetworkError"/>
</object-type>
@@ -285,17 +302,30 @@
<object-type name="QNetworkDiskCache"/>
<value-type name="QNetworkCacheMetaData"/>
+ <object-type name="QSctpServer"/>
+ <object-type name="QSctpSocket"/>
+
<!-- The following entries may be present in the system or not. Keep this section organized. -->
<value-type name="QSslCertificate">
<enum-type name="SubjectInfo"/>
</value-type>
+ <value-type name="QSslCertificateExtension"/>
+
<value-type name="QSslCipher"/>
<value-type name="QSslConfiguration">
<enum-type name="NextProtocolNegotiationStatus" />
</value-type>
+ <value-type name="QSslDiffieHellmanParameters" since="5.8">
+ <enum-type name="Error"/>
+ </value-type>
+
+ <!-- Problems with operator==(QSslEllipticCurve,QSslEllipticCurve)
+ <object-type name="QSslEllipticCurve"/>
+ -->
+
<value-type name="QSslError">
<enum-type name="SslError"/>
</value-type>
@@ -307,6 +337,9 @@
<modify-function signature="connectToHostEncrypted(const QString&amp;,quint16,QFlags&lt;QIODevice::OpenModeFlag>,QAbstractSocket::NetworkLayerProtocol)" allow-thread="yes" />
<modify-function signature="waitForEncrypted(int)" allow-thread="yes" />
</object-type>
+
+ <value-type name="QSslPreSharedKeyAuthenticator"/>
+
<!-- The above entries may be present in the system or not. Keep this section organized. -->
</typesystem>
diff --git a/sources/pyside2/doc/index.rst b/sources/pyside2/doc/index.rst
index c8cd2fa79..90c95ade9 100644
--- a/sources/pyside2/doc/index.rst
+++ b/sources/pyside2/doc/index.rst
@@ -23,7 +23,7 @@ Qt Modules
Provides classes for integrating online documentation in applications.
* - `Qt Network <PySide2/QtNetwork/index.html>`_
Offers classes that lets you to write TCP/IP clients and servers.
- - `Qt OpenGL <PySide2/QtCore/index.html>`_
+ - `Qt OpenGL <PySide2/QtOpenGL/index.html>`_
Offers classes that make it easy to use OpenGL in Qt applications.
* - `Qt PrintSupport <PySide2/QtPrintSupport/index.html>`_
Offers classes that make it easy to use OpenGL in Qt applications.
diff --git a/sources/pyside2/tests/QtNetwork/CMakeLists.txt b/sources/pyside2/tests/QtNetwork/CMakeLists.txt
index f93de5c17..c14c19fa9 100644
--- a/sources/pyside2/tests/QtNetwork/CMakeLists.txt
+++ b/sources/pyside2/tests/QtNetwork/CMakeLists.txt
@@ -1,6 +1,7 @@
PYSIDE_TEST(bug_446.py)
PYSIDE_TEST(bug_1084.py)
PYSIDE_TEST(accessManager_test.py)
+PYSIDE_TEST(dnslookup_test.py)
# Qt5: QHttp is gone PYSIDE_TEST(http_test.py)
PYSIDE_TEST(tcpserver_test.py)
PYSIDE_TEST(udpsocket_test.py)
diff --git a/sources/pyside2/tests/QtNetwork/dnslookup_test.py b/sources/pyside2/tests/QtNetwork/dnslookup_test.py
new file mode 100644
index 000000000..b0375b0f5
--- /dev/null
+++ b/sources/pyside2/tests/QtNetwork/dnslookup_test.py
@@ -0,0 +1,59 @@
+#############################################################################
+##
+## Copyright (C) 2018 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of Qt for Python.
+##
+## $QT_BEGIN_LICENSE:GPL-EXCEPT$
+## 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 General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU
+## General Public License version 3 as published by the Free Software
+## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+## 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-3.0.html.
+##
+## $QT_END_LICENSE$
+##
+#############################################################################
+
+'''Test cases for QDnsLookup'''
+
+import unittest
+
+from PySide2.QtCore import QCoreApplication
+from PySide2.QtNetwork import QDnsLookup
+
+class DnsLookupTestCase(unittest.TestCase):
+ '''Test case for QDnsLookup'''
+
+ def setUp(self):
+ self._app = QCoreApplication([])
+ self._lookup = QDnsLookup(QDnsLookup.ANY, 'www.qt.io')
+ self._lookup.finished.connect(self._finished)
+
+ def tearDown(self):
+ del self._lookup
+
+ def _finished(self):
+ if self._lookup.error() == QDnsLookup.NoError:
+ nameRecords = self._lookup.canonicalNameRecords()
+ if nameRecords:
+ print(nameRecords[0].name())
+ self._app.quit()
+
+ def testLookup(self):
+ self._lookup.lookup()
+ self._app.exec_()
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/sources/pyside2/tests/registry/exists_darwin_5_9_4_ci.py b/sources/pyside2/tests/registry/exists_darwin_5_9_4_ci.py
index 787ae0e80..95f3fe237 100644
--- a/sources/pyside2/tests/registry/exists_darwin_5_9_4_ci.py
+++ b/sources/pyside2/tests/registry/exists_darwin_5_9_4_ci.py
@@ -12558,12 +12558,12 @@ if "PySide2.QtNetwork" in sys.modules:
"QNetworkAccessManager.head": ('PySide2.QtNetwork.QNetworkRequest',),
"QNetworkAccessManager.isStrictTransportSecurityEnabled": (),
"QNetworkAccessManager.networkAccessible": (),
- "QNetworkAccessManager.post": [('PySide2.QtNetwork.QNetworkRequest', 'PySide2.QtCore.QByteArray'), ('PySide2.QtNetwork.QNetworkRequest', 'PySide2.QtCore.QIODevice')],
+ "QNetworkAccessManager.post": [('PySide2.QtNetwork.QNetworkRequest', 'PySide2.QtCore.QByteArray'), ('PySide2.QtNetwork.QNetworkRequest', 'PySide2.QtCore.QIODevice'), ('PySide2.QtNetwork.QNetworkRequest', 'PySide2.QtNetwork.QHttpMultiPart')],
"QNetworkAccessManager.proxy": (),
"QNetworkAccessManager.proxyFactory": (),
- "QNetworkAccessManager.put": [('PySide2.QtNetwork.QNetworkRequest', 'PySide2.QtCore.QByteArray'), ('PySide2.QtNetwork.QNetworkRequest', 'PySide2.QtCore.QIODevice')],
+ "QNetworkAccessManager.put": [('PySide2.QtNetwork.QNetworkRequest', 'PySide2.QtCore.QByteArray'), ('PySide2.QtNetwork.QNetworkRequest', 'PySide2.QtCore.QIODevice'), ('PySide2.QtNetwork.QNetworkRequest', 'PySide2.QtNetwork.QHttpMultiPart')],
"QNetworkAccessManager.redirectPolicy": (),
- "QNetworkAccessManager.sendCustomRequest": [('PySide2.QtNetwork.QNetworkRequest', 'PySide2.QtCore.QByteArray', 'PySide2.QtCore.QByteArray'), ('PySide2.QtNetwork.QNetworkRequest', 'PySide2.QtCore.QByteArray', 'PySide2.QtCore.QIODevice')],
+ "QNetworkAccessManager.sendCustomRequest": [('PySide2.QtNetwork.QNetworkRequest', 'PySide2.QtCore.QByteArray', 'PySide2.QtCore.QByteArray'), ('PySide2.QtNetwork.QNetworkRequest', 'PySide2.QtCore.QByteArray', 'PySide2.QtCore.QIODevice'), ('PySide2.QtNetwork.QNetworkRequest', 'PySide2.QtCore.QByteArray', 'PySide2.QtNetwork.QHttpMultiPart')],
"QNetworkAccessManager.setCache": ('PySide2.QtNetwork.QAbstractNetworkCache',),
"QNetworkAccessManager.setConfiguration": ('PySide2.QtNetwork.QNetworkConfiguration',),
"QNetworkAccessManager.setCookieJar": ('PySide2.QtNetwork.QNetworkCookieJar',),
diff --git a/sources/pyside2/tests/registry/exists_linux_5_9_4_ci.py b/sources/pyside2/tests/registry/exists_linux_5_9_4_ci.py
index 77ee0fdfa..79e826258 100644
--- a/sources/pyside2/tests/registry/exists_linux_5_9_4_ci.py
+++ b/sources/pyside2/tests/registry/exists_linux_5_9_4_ci.py
@@ -12555,12 +12555,12 @@ if "PySide2.QtNetwork" in sys.modules:
"QNetworkAccessManager.head": ('PySide2.QtNetwork.QNetworkRequest',),
"QNetworkAccessManager.isStrictTransportSecurityEnabled": (),
"QNetworkAccessManager.networkAccessible": (),
- "QNetworkAccessManager.post": [('PySide2.QtNetwork.QNetworkRequest', 'PySide2.QtCore.QByteArray'), ('PySide2.QtNetwork.QNetworkRequest', 'PySide2.QtCore.QIODevice')],
+ "QNetworkAccessManager.post": [('PySide2.QtNetwork.QNetworkRequest', 'PySide2.QtCore.QByteArray'), ('PySide2.QtNetwork.QNetworkRequest', 'PySide2.QtCore.QIODevice'), ('PySide2.QtNetwork.QNetworkRequest', 'PySide2.QtNetwork.QHttpMultiPart')],
"QNetworkAccessManager.proxy": (),
"QNetworkAccessManager.proxyFactory": (),
- "QNetworkAccessManager.put": [('PySide2.QtNetwork.QNetworkRequest', 'PySide2.QtCore.QByteArray'), ('PySide2.QtNetwork.QNetworkRequest', 'PySide2.QtCore.QIODevice')],
+ "QNetworkAccessManager.put": [('PySide2.QtNetwork.QNetworkRequest', 'PySide2.QtCore.QByteArray'), ('PySide2.QtNetwork.QNetworkRequest', 'PySide2.QtCore.QIODevice'), ('PySide2.QtNetwork.QNetworkRequest', 'PySide2.QtNetwork.QHttpMultiPart')],
"QNetworkAccessManager.redirectPolicy": (),
- "QNetworkAccessManager.sendCustomRequest": [('PySide2.QtNetwork.QNetworkRequest', 'PySide2.QtCore.QByteArray', 'PySide2.QtCore.QByteArray'), ('PySide2.QtNetwork.QNetworkRequest', 'PySide2.QtCore.QByteArray', 'PySide2.QtCore.QIODevice')],
+ "QNetworkAccessManager.sendCustomRequest": [('PySide2.QtNetwork.QNetworkRequest', 'PySide2.QtCore.QByteArray', 'PySide2.QtCore.QByteArray'), ('PySide2.QtNetwork.QNetworkRequest', 'PySide2.QtCore.QByteArray', 'PySide2.QtCore.QIODevice'), ('PySide2.QtNetwork.QNetworkRequest', 'PySide2.QtCore.QByteArray', 'PySide2.QtNetwork.QHttpMultiPart')],
"QNetworkAccessManager.setCache": ('PySide2.QtNetwork.QAbstractNetworkCache',),
"QNetworkAccessManager.setConfiguration": ('PySide2.QtNetwork.QNetworkConfiguration',),
"QNetworkAccessManager.setCookieJar": ('PySide2.QtNetwork.QNetworkCookieJar',),
diff --git a/sources/pyside2/tests/registry/exists_win32_5_9_4_ci.py b/sources/pyside2/tests/registry/exists_win32_5_9_4_ci.py
index 08f7ca897..20c30e1a3 100644
--- a/sources/pyside2/tests/registry/exists_win32_5_9_4_ci.py
+++ b/sources/pyside2/tests/registry/exists_win32_5_9_4_ci.py
@@ -12570,12 +12570,12 @@ if "PySide2.QtNetwork" in sys.modules:
"QNetworkAccessManager.head": ('PySide2.QtNetwork.QNetworkRequest',),
"QNetworkAccessManager.isStrictTransportSecurityEnabled": (),
"QNetworkAccessManager.networkAccessible": (),
- "QNetworkAccessManager.post": [('PySide2.QtNetwork.QNetworkRequest', 'PySide2.QtCore.QByteArray'), ('PySide2.QtNetwork.QNetworkRequest', 'PySide2.QtCore.QIODevice')],
+ "QNetworkAccessManager.post": [('PySide2.QtNetwork.QNetworkRequest', 'PySide2.QtCore.QByteArray'), ('PySide2.QtNetwork.QNetworkRequest', 'PySide2.QtCore.QIODevice'), ('PySide2.QtNetwork.QNetworkRequest', 'PySide2.QtNetwork.QHttpMultiPart')],
"QNetworkAccessManager.proxy": (),
"QNetworkAccessManager.proxyFactory": (),
- "QNetworkAccessManager.put": [('PySide2.QtNetwork.QNetworkRequest', 'PySide2.QtCore.QByteArray'), ('PySide2.QtNetwork.QNetworkRequest', 'PySide2.QtCore.QIODevice')],
+ "QNetworkAccessManager.put": [('PySide2.QtNetwork.QNetworkRequest', 'PySide2.QtCore.QByteArray'), ('PySide2.QtNetwork.QNetworkRequest', 'PySide2.QtCore.QIODevice'), ('PySide2.QtNetwork.QNetworkRequest', 'PySide2.QtNetwork.QHttpMultiPart')],
"QNetworkAccessManager.redirectPolicy": (),
- "QNetworkAccessManager.sendCustomRequest": [('PySide2.QtNetwork.QNetworkRequest', 'PySide2.QtCore.QByteArray', 'PySide2.QtCore.QByteArray'), ('PySide2.QtNetwork.QNetworkRequest', 'PySide2.QtCore.QByteArray', 'PySide2.QtCore.QIODevice')],
+ "QNetworkAccessManager.sendCustomRequest": [('PySide2.QtNetwork.QNetworkRequest', 'PySide2.QtCore.QByteArray', 'PySide2.QtCore.QByteArray'), ('PySide2.QtNetwork.QNetworkRequest', 'PySide2.QtCore.QByteArray', 'PySide2.QtCore.QIODevice'), ('PySide2.QtNetwork.QNetworkRequest', 'PySide2.QtCore.QByteArray', 'PySide2.QtNetwork.QHttpMultiPart')],
"QNetworkAccessManager.setCache": ('PySide2.QtNetwork.QAbstractNetworkCache',),
"QNetworkAccessManager.setConfiguration": ('PySide2.QtNetwork.QNetworkConfiguration',),
"QNetworkAccessManager.setCookieJar": ('PySide2.QtNetwork.QNetworkCookieJar',),
diff --git a/sources/shiboken2/CMakeLists.txt b/sources/shiboken2/CMakeLists.txt
index b65e32974..3efc6fefe 100644
--- a/sources/shiboken2/CMakeLists.txt
+++ b/sources/shiboken2/CMakeLists.txt
@@ -1,5 +1,6 @@
Include(icecc.cmake)
project(shiboken2)
+include(CheckIncludeFileCXX)
cmake_minimum_required(VERSION 3.1)
cmake_policy(VERSION 3.1)
@@ -43,7 +44,7 @@ macro(get_llvm_config)
import os
import sys
sys.path.append(os.path.realpath(os.path.join('${CMAKE_CURRENT_LIST_DIR}', '..', '..')))
- from utils import findLlvmConfig
+ from build_scripts.utils import findLlvmConfig
llvmConfig = findLlvmConfig()
if llvmConfig:
print(llvmConfig)
@@ -80,7 +81,7 @@ else ()
if (NOT "${CLANG_DIR}" STREQUAL "")
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 "libclang version 3.9 or higher is required (${LLVM_CONFIG} detected ${CLANG_VERSION} at ${CLANG_DIR}).")
endif()
endif()
endif()
@@ -91,21 +92,39 @@ elseif (NOT IS_DIRECTORY ${CLANG_DIR})
message(FATAL_ERROR "${CLANG_DIR} detected by ${CLANG_DIR_SOURCE} does not exist.")
endif()
-set(CLANG_LIB_NAME "clang")
+# The non-development Debian / Ubuntu packages (e.g. libclang1-6.0) do not ship a
+# libclang.so symlink, but only libclang-6.0.so.1 and libclang.so.1 (adjusted for version number).
+# Thus searching for libclang would not succeed.
+# The "libclang.so" symlink is shipped as part of the development package (libclang-6.0-dev) which
+# we need anyway because of the headers. Thus we will search for libclang.so.1 also, and complain
+# about the headers not being found in a check further down. This is more friendly to the user,
+# so they don't scratch their head thinking that they have already installed the necessary package.
+set(CLANG_LIB_NAMES clang libclang.so libclang.so.1)
if(MSVC)
- set(CLANG_LIB_NAME "libclang")
+ set(CLANG_LIB_NAMES libclang)
endif()
-find_library(CLANG_LIBRARY ${CLANG_LIB_NAME} HINTS ${CLANG_DIR}/lib)
+find_library(CLANG_LIBRARY NAMES ${CLANG_LIB_NAMES} HINTS ${CLANG_DIR}/lib)
if (NOT EXISTS ${CLANG_LIBRARY})
- message(FATAL_ERROR "Unable to find Clang library ${CLANG_LIB_NAME} in ${CLANG_DIR}.")
+ string(REPLACE ";" ", " CLANG_LIB_NAMES_STRING "${CLANG_LIB_NAMES}")
+ message(FATAL_ERROR "Unable to find the Clang library in ${CLANG_DIR}.\
+ Names tried: ${CLANG_LIB_NAMES_STRING}.")
endif()
message(STATUS "CLANG: ${CLANG_DIR}, ${CLANG_LIBRARY} detected by ${CLANG_DIR_SOURCE}")
# Find highest version clang builtin includes folder to pass along to shiboken.
set(CLANG_BUILTIN_INCLUDES_DIR_PREFIX ${CLANG_DIR}/lib/clang)
-file(GLOB CLANG_BUILTIN_INCLUDES_DIR_VERSIONS "${CLANG_BUILTIN_INCLUDES_DIR_PREFIX}/*")
+file(GLOB CLANG_BUILTIN_INCLUDES_DIR_CANDIDATES "${CLANG_BUILTIN_INCLUDES_DIR_PREFIX}/*")
+
+# Collect only directories, and not files, and only directories starting with a number.
+set(CLANG_BUILTIN_INCLUDES_DIR_VERSIONS "")
+foreach(candidate ${CLANG_BUILTIN_INCLUDES_DIR_CANDIDATES})
+ get_filename_component(candidate_basename ${candidate} NAME)
+ if (IS_DIRECTORY ${candidate} AND ${candidate_basename} MATCHES "^[0-9]") # starts with number
+ list(APPEND CLANG_BUILTIN_INCLUDES_DIR_VERSIONS ${candidate})
+ endif()
+endforeach()
# Sort in alphabetical order the list of version folders.
list(SORT CLANG_BUILTIN_INCLUDES_DIR_VERSIONS)
@@ -113,7 +132,9 @@ list(SORT CLANG_BUILTIN_INCLUDES_DIR_VERSIONS)
# Reverse it so the first element is the highest version.
list(REVERSE CLANG_BUILTIN_INCLUDES_DIR_VERSIONS)
-message(STATUS "Found the following CLANG builtins includes directories: ${CLANG_BUILTIN_INCLUDES_DIR_VERSIONS}")
+message(STATUS
+ "Found the following CLANG builtins includes directories: ${CLANG_BUILTIN_INCLUDES_DIR_VERSIONS} \
+ Considered the following directories: ${CLANG_BUILTIN_INCLUDES_DIR_CANDIDATES}")
if(CLANG_BUILTIN_INCLUDES_DIR_VERSIONS)
# Get highest version.
list(GET CLANG_BUILTIN_INCLUDES_DIR_VERSIONS 0 CLANG_BUILTIN_INCLUDES_DIR_HIGHEST_VERSION)
@@ -122,11 +143,36 @@ if(CLANG_BUILTIN_INCLUDES_DIR_VERSIONS)
set(CLANG_BUILTIN_INCLUDES_DIR "${CLANG_BUILTIN_INCLUDES_DIR_HIGHEST_VERSION}/include")
endif()
endif()
+
message(STATUS "CLANG builtins includes directory chosen: ${CLANG_BUILTIN_INCLUDES_DIR}")
+# We don't exit with a hard error here, because it is uncertain whether all clang extra include
+# paths follow the same layout across OSes and distros.
+if (NOT CLANG_BUILTIN_INCLUDES_DIR)
+ message(WARNING "No CLANG builtins includes directory found. This may lead to shiboken \
+ execution failure.")
+endif()
+
set(CLANG_EXTRA_INCLUDES ${CLANG_DIR}/include)
set(CLANG_EXTRA_LIBRARIES ${CLANG_LIBRARY})
+# Check if one of the required clang headers is found. Error out early at CMake time instead of
+# compile time if not found.
+# It can happen that a user uses a distro-provided libclang.so, but no development header package
+# was installed (e.g. libclang-6.0-dev on Ubuntu).
+set(CMAKE_REQUIRED_INCLUDES ${CLANG_EXTRA_INCLUDES})
+set(CLANG_HEADER_FILE_TO_CHECK "clang-c/Index.h")
+check_include_file_cxx(${CLANG_HEADER_FILE_TO_CHECK} CLANG_INCLUDE_FOUND)
+unset(CMAKE_REQUIRED_INCLUDES)
+if (NOT CLANG_INCLUDE_FOUND)
+ # Need to unset so that when installing the package, CMake doesn't complain that the header
+ # still isn't found.
+ unset(CLANG_INCLUDE_FOUND CACHE)
+ message(FATAL_ERROR "Unable to find required Clang header file ${CLANG_HEADER_FILE_TO_CHECK} \
+ in ${CLANG_DIR}/include. Perhaps you forgot to install the clang development header \
+ package? (e.g. libclang-6.0-dev)")
+endif()
+
set(SHIBOKEN_VERSION_FILE_PATH "${CMAKE_SOURCE_DIR}/shiboken_version.py")
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS
${SHIBOKEN_VERSION_FILE_PATH}
diff --git a/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp b/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp
index 98cdbf286..7206d7ca8 100644
--- a/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp
+++ b/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp
@@ -230,6 +230,78 @@ static QString msgFallbackWarning(const QXmlStreamReader &reader, const QString
return msgTagWarning(reader, context, tag, message);
}
+struct QtXmlToSphinx::LinkContext
+{
+ enum Type
+ {
+ Method = 0x1, Function = 0x2,
+ FunctionMask = Method | Function,
+ Class = 0x4, Attribute = 0x8, Module = 0x10,
+ Reference = 0x20, External= 0x40
+ };
+
+ enum Flags { InsideBold = 0x1, InsideItalic = 0x2 };
+
+ explicit LinkContext(const QString &ref) : linkRef(ref) {}
+
+ QString linkRef;
+ QString linkText;
+ Type type = Reference;
+ int flags = 0;
+};
+
+static const char *linkKeyWord(QtXmlToSphinx::LinkContext::Type type)
+{
+ switch (type) {
+ case QtXmlToSphinx::LinkContext::Method:
+ return ":meth:";
+ case QtXmlToSphinx::LinkContext::Function:
+ return ":func:";
+ case QtXmlToSphinx::LinkContext::Class:
+ return ":class:";
+ case QtXmlToSphinx::LinkContext::Attribute:
+ return ":attr:";
+ case QtXmlToSphinx::LinkContext::Module:
+ return ":mod:";
+ case QtXmlToSphinx::LinkContext::Reference:
+ return ":ref:";
+ case QtXmlToSphinx::LinkContext::External:
+ break;
+ }
+ return "";
+}
+
+QTextStream &operator<<(QTextStream &str, const QtXmlToSphinx::LinkContext &linkContext)
+{
+ // Temporarily turn off bold/italic since links do not work within
+ if (linkContext.flags & QtXmlToSphinx::LinkContext::InsideBold)
+ str << "**";
+ else if (linkContext.flags & QtXmlToSphinx::LinkContext::InsideItalic)
+ str << '*';
+ str << ' ' << linkKeyWord(linkContext.type) << '`';
+ const bool isExternal = linkContext.type == QtXmlToSphinx::LinkContext::External;
+ if (!linkContext.linkText.isEmpty()) {
+ writeEscapedRstText(str, linkContext.linkText);
+ if (isExternal && !linkContext.linkText.endsWith(QLatin1Char(' ')))
+ str << ' ';
+ str << '<';
+ }
+ // Convert page titles to RST labels
+ str << (linkContext.type == QtXmlToSphinx::LinkContext::Reference
+ ? toRstLabel(linkContext.linkRef) : linkContext.linkRef);
+ if (!linkContext.linkText.isEmpty())
+ str << '>';
+ str << '`';
+ if (isExternal)
+ str << '_';
+ str << ' ';
+ if (linkContext.flags & QtXmlToSphinx::LinkContext::InsideBold)
+ str << "**";
+ else if (linkContext.flags & QtXmlToSphinx::LinkContext::InsideItalic)
+ str << '*';
+ return str;
+}
+
QtXmlToSphinx::QtXmlToSphinx(QtDocGenerator* generator, const QString& doc, const QString& context)
: m_context(context), m_generator(generator), m_insideBold(false), m_insideItalic(false)
{
@@ -893,20 +965,15 @@ QtXmlToSphinx::LinkContext *QtXmlToSphinx::handleLinkStart(const QString &type,
{
ref.replace(QLatin1String("::"), QLatin1String("."));
ref.remove(QLatin1String("()"));
- LinkContext *result = new LinkContext(toRstLabel(ref), type);
-
- result->linkTagEnding = QLatin1String("` ");
- if (m_insideBold) {
- result->linkTag.prepend(QLatin1String("**"));
- result->linkTagEnding.append(QLatin1String("**"));
- } else if (m_insideItalic) {
- result->linkTag.prepend(QLatin1Char('*'));
- result->linkTagEnding.append(QLatin1Char('*'));
- }
+ LinkContext *result = new LinkContext(ref);
+ if (m_insideBold)
+ result->flags |= LinkContext::InsideBold;
+ else if (m_insideItalic)
+ result->flags |= LinkContext::InsideItalic;
- if (result->type == functionLinkType() && !m_context.isEmpty()) {
- result->linkTag = QLatin1String(" :meth:`");
+ if (type == functionLinkType() && !m_context.isEmpty()) {
+ result->type = LinkContext::Method;
const QVector<QStringRef> rawlinklist = result->linkRef.splitRef(QLatin1Char('.'));
if (rawlinklist.size() == 1 || rawlinklist.constFirst() == m_context) {
QString context = resolveContextForMethod(rawlinklist.constLast().toString());
@@ -915,10 +982,10 @@ QtXmlToSphinx::LinkContext *QtXmlToSphinx::handleLinkStart(const QString &type,
} else {
result->linkRef = expandFunction(result->linkRef);
}
- } else if (result->type == functionLinkType() && m_context.isEmpty()) {
- result->linkTag = QLatin1String(" :func:`");
- } else if (result->type == classLinkType()) {
- result->linkTag = QLatin1String(" :class:`");
+ } else if (type == functionLinkType() && m_context.isEmpty()) {
+ result->type = LinkContext::Function;
+ } else if (type == classLinkType()) {
+ result->type = LinkContext::Class;
if (const TypeEntry *type = TypeDatabase::instance()->findType(result->linkRef)) {
result->linkRef = type->qualifiedTargetLangName();
} else { // fall back to the old heuristic if the type wasn't found.
@@ -930,37 +997,64 @@ QtXmlToSphinx::LinkContext *QtXmlToSphinx::handleLinkStart(const QString &type,
+ QLatin1Char('.'));
}
}
- } else if (result->type == QLatin1String("enum")) {
- result->linkTag = QLatin1String(" :attr:`");
- } else if (result->type == QLatin1String("page") && result->linkRef == m_generator->moduleName()) {
- result->linkTag = QLatin1String(" :mod:`");
+ } else if (type == QLatin1String("enum")) {
+ result->type = LinkContext::Attribute;
+ } else if (type == QLatin1String("page")) {
+ // Module, external web page or reference
+ if (result->linkRef == m_generator->moduleName())
+ result->type = LinkContext::Module;
+ else if (result->linkRef.startsWith(QLatin1String("http")))
+ result->type = LinkContext::External;
+ else
+ result->type = LinkContext::Reference;
} else {
- result->linkTag = QLatin1String(" :ref:`");
+ result->type = LinkContext::Reference;
}
return result;
}
-void QtXmlToSphinx::handleLinkText(LinkContext *linkContext, QString linktext) const
+// <link raw="Model/View Classes" href="model-view-programming.html#model-view-classes"
+// type="page" page="Model/View Programming">Model/View Classes</link>
+// <link type="page" page="http://doc.qt.io/qt-5/class.html">QML types</link>
+// <link raw="Qt Quick" href="qtquick-index.html" type="page" page="Qt Quick">Qt Quick</link>
+// <link raw="QObject" href="qobject.html" type="class">QObject</link>
+// <link raw="Qt::Window" href="qt.html#WindowType-enum" type="enum" enum="Qt::WindowType">Qt::Window</link>
+// <link raw="QNetworkSession::reject()" href="qnetworksession.html#reject" type="function">QNetworkSession::reject()</link>
+
+static QString fixLinkText(const QtXmlToSphinx::LinkContext *linkContext,
+ QString linktext)
{
+ if (linkContext->type == QtXmlToSphinx::LinkContext::External
+ || linkContext->type == QtXmlToSphinx::LinkContext::Reference) {
+ return linktext;
+ }
+ // For the language reference documentation, clear the link text if it matches
+ // the function/class/enumeration name.
linktext.replace(QLatin1String("::"), QLatin1String("."));
+ if (linkContext->linkRef == linktext)
+ return QString();
+ if ((linkContext->type & QtXmlToSphinx::LinkContext::FunctionMask) != 0
+ && (linkContext->linkRef + QLatin1String("()")) == linktext) {
+ return QString();
+ }
const QStringRef item = linkContext->linkRef.splitRef(QLatin1Char('.')).constLast();
- if (linkContext->linkRef == linktext
- || (linkContext->linkRef + QLatin1String("()")) == linktext
- || item == linktext
- || (item + QLatin1String("()")) == linktext) {
- linkContext->linkText.clear();
- } else {
- linkContext->linkText = linktext + QLatin1Char('<');
+ if (item == linktext)
+ return QString();
+ if ((linkContext->type & QtXmlToSphinx::LinkContext::FunctionMask) != 0
+ && (item + QLatin1String("()")) == linktext) {
+ return QString();
}
+ return linktext;
+}
+
+void QtXmlToSphinx::handleLinkText(LinkContext *linkContext, const QString &linktext) const
+{
+ linkContext->linkText = fixLinkText(linkContext, linktext);
}
void QtXmlToSphinx::handleLinkEnd(LinkContext *linkContext)
{
- if (!linkContext->linkText.isEmpty())
- linkContext->linkTagEnding.prepend(QLatin1Char('>'));
- m_output << linkContext->linkTag << linkContext->linkText;
- writeEscapedRstText(m_output, linkContext->linkRef);
- m_output << linkContext->linkTagEnding;
+ m_output << *linkContext;
}
// Copy images that are placed in a subdirectory "images" under the webxml files
diff --git a/sources/shiboken2/generator/qtdoc/qtdocgenerator.h b/sources/shiboken2/generator/qtdoc/qtdocgenerator.h
index d68eb1ea5..e467abe90 100644
--- a/sources/shiboken2/generator/qtdoc/qtdocgenerator.h
+++ b/sources/shiboken2/generator/qtdoc/qtdocgenerator.h
@@ -49,6 +49,8 @@ class QtDocGenerator;
class QtXmlToSphinx
{
public:
+ struct LinkContext;
+
struct InlineImage
{
QString tag;
@@ -114,17 +116,6 @@ public:
}
private:
- struct LinkContext
- {
- LinkContext(const QString &ref, const QString &lType) : linkRef(ref), type(lType) {}
-
- QString linkTag;
- QString linkRef;
- QString linkText;
- QString linkTagEnding;
- QString type;
- };
-
QString resolveContextForMethod(const QString& methodName) const;
QString expandFunction(const QString& function) const;
QString transform(const QString& doc);
@@ -161,7 +152,7 @@ private:
void handleAnchorTag(QXmlStreamReader& reader);
LinkContext *handleLinkStart(const QString &type, QString ref) const;
- void handleLinkText(LinkContext *linkContext, QString linktext) const;
+ void handleLinkText(LinkContext *linkContext, const QString &linktext) const;
void handleLinkEnd(LinkContext *linkContext);
typedef void (QtXmlToSphinx::*TagHandler)(QXmlStreamReader&);
diff --git a/sources/shiboken2/libshiboken/sbkpython.h b/sources/shiboken2/libshiboken/sbkpython.h
index 57828f624..6d90f4086 100644
--- a/sources/shiboken2/libshiboken/sbkpython.h
+++ b/sources/shiboken2/libshiboken/sbkpython.h
@@ -48,6 +48,10 @@
#define PyInt_Type PyLong_Type
#define PyInt_Check PyLong_Check
+ #define PyInt_CheckExact PyLong_CheckExact
+ #define PyInt_FromString PyLong_FromString
+ #define PyInt_FromSsize_t PyLong_FromSsize_t
+ #define PyInt_FromSize_t PyLong_FromSize_t
#define PyInt_AS_LONG PyLong_AS_LONG
#define PyInt_AsUnsignedLongLongMask PyLong_AsLongLong
#define PyInt_FromLong PyLong_FromLong