From 6bf18f9177bed59548795b8db52e07bb0543e992 Mon Sep 17 00:00:00 2001 From: yopito Date: Sat, 23 Jan 2021 19:58:28 +0100 Subject: [PATCH 1/3] shiboken2: update to 5.15.2, testing support, remove dummy packages add SHIBOKEN_CLANG_OPTIONS env variable support to manage crossbuild --- common/shlibs | 2 - srcpkgs/libshiboken-python3 | 1 - srcpkgs/python3-shiboken | 1 - ...ng-options-via-environment-variables.patch | 21 +++++ .../patches/tests-need-python-modules.patch | 13 +++ .../patches/tests-python-syntax.patch | 91 +++++++++++++++++++ srcpkgs/shiboken2/template | 19 +--- 7 files changed, 128 insertions(+), 20 deletions(-) delete mode 120000 srcpkgs/libshiboken-python3 delete mode 120000 srcpkgs/python3-shiboken create mode 100644 srcpkgs/shiboken2/patches/clang-options-via-environment-variables.patch create mode 100644 srcpkgs/shiboken2/patches/tests-need-python-modules.patch create mode 100644 srcpkgs/shiboken2/patches/tests-python-syntax.patch diff --git a/common/shlibs b/common/shlibs index 670be76ec65..6a925ae5900 100644 --- a/common/shlibs +++ b/common/shlibs @@ -1679,8 +1679,6 @@ libosmoctrl.so.0 libosmocore-0.7.0_1 libgtkglext-x11-1.0.so.0 gtkglext-1.2.0_4 libgdkglext-x11-1.0.so.0 gtkglext-1.2.0_4 libXaw3d.so.8 libXaw3d-1.6.2_1 -libshiboken-python2.7.so.1.2 libshiboken-python-1.2.2_2 -libshiboken-python3.6.so.1.2 libshiboken-python3-1.2.2_4 libshiboken2.so.5.15 libshiboken2-5.15.0_1 libpyside-python2.7.so.1.2 libpyside-python-1.2.2_2 libpyside-python3.6.so.1.2 libpyside-python3-1.2.2_6 diff --git a/srcpkgs/libshiboken-python3 b/srcpkgs/libshiboken-python3 deleted file mode 120000 index b1fbca61c21..00000000000 --- a/srcpkgs/libshiboken-python3 +++ /dev/null @@ -1 +0,0 @@ -shiboken2 \ No newline at end of file diff --git a/srcpkgs/python3-shiboken b/srcpkgs/python3-shiboken deleted file mode 120000 index b1fbca61c21..00000000000 --- a/srcpkgs/python3-shiboken +++ /dev/null @@ -1 +0,0 @@ -shiboken2 \ No newline at end of file diff --git a/srcpkgs/shiboken2/patches/clang-options-via-environment-variables.patch b/srcpkgs/shiboken2/patches/clang-options-via-environment-variables.patch new file mode 100644 index 00000000000..f8724b96bfb --- /dev/null +++ b/srcpkgs/shiboken2/patches/clang-options-via-environment-variables.patch @@ -0,0 +1,21 @@ +Add ability to pass additional options to clang via environnement variable. +With help from https://github.com/void-linux/void-packages/pull/26962 + +--- sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp ++++ sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp +@@ -305,6 +305,15 @@ + QByteArrayList emulatedCompilerOptions() + { + QByteArrayList result; ++ ++ QByteArray shiboken_clang_options = qgetenv("SHIBOKEN_CLANG_OPTIONS"); ++ // split to avoid double quoting drived by space inside it ++ if (!shiboken_clang_options.isEmpty()) { ++ for (const QByteArray &item: shiboken_clang_options.split(' ')) { ++ result.append(item); ++ } ++ } ++ + #if defined(Q_CC_MSVC) + HeaderPaths headerPaths; + result.append(QByteArrayLiteral("-fms-compatibility-version=19")); diff --git a/srcpkgs/shiboken2/patches/tests-need-python-modules.patch b/srcpkgs/shiboken2/patches/tests-need-python-modules.patch new file mode 100644 index 00000000000..24054690b09 --- /dev/null +++ b/srcpkgs/shiboken2/patches/tests-need-python-modules.patch @@ -0,0 +1,13 @@ +tests need python modules that are not installed yet: so point the built ones. +Reported upstream: https://bugreports.qt.io/browse/PYSIDE-1429 + +--- sources/shiboken2/tests/CMakeLists.txt.ORIG 2020-09-09 14:45:42.000000000 +0200 ++++ sources/shiboken2/tests/CMakeLists.txt 2020-11-12 14:16:46.577206385 +0100 +@@ -53,6 +53,6 @@ + list(FIND test_blacklist ${test_name} expect_fail) + add_test(${test_name} ${PYTHON_EXECUTABLE} ${test_file}) +- set_tests_properties(${test_name} PROPERTIES ENVIRONMENT "BUILD_DIR=${BUILD_DIR}") ++ set_tests_properties(${test_name} PROPERTIES ENVIRONMENT "BUILD_DIR=${BUILD_DIR};PYTHONPATH=${shibokenmodule_BINARY_DIR}:${minimal_BINARY_DIR}:${sample_BINARY_DIR}:${other_BINARY_DIR}:${smart_BINARY_DIR}") + set_tests_properties(${test_name} PROPERTIES TIMEOUT ${CTEST_TESTING_TIMEOUT}) + if (${expect_fail} GREATER -1) + set_tests_properties(${test_name} PROPERTIES WILL_FAIL TRUE) diff --git a/srcpkgs/shiboken2/patches/tests-python-syntax.patch b/srcpkgs/shiboken2/patches/tests-python-syntax.patch new file mode 100644 index 00000000000..5151c3cc71a --- /dev/null +++ b/srcpkgs/shiboken2/patches/tests-python-syntax.patch @@ -0,0 +1,91 @@ +This changeset is about both shiboken2 and python3-pyside2 +(that are separated packages) +upstream: yes + +From c6184e01e993dcca9798f306fb8e9cb322fdd0dc Mon Sep 17 00:00:00 2001 +From: Christian Tismer +Date: Thu, 3 Dec 2020 13:38:58 +0100 +Subject: [PATCH] fix both qflags_test and the qflags cppgenerator code + +There was a years-old qflags test failing on Python 3. +It was blacklisted with the comment + + "# Nested exception in Python 3" + +This was nonsense: The test was wrong also for Python 2. +It just happened to work, because Python 2 had some weird +errors leaking. The real bug was in missing error handling +in cppgenerator.cpp . + +See the main description in the issue. + +Change-Id: Ia0f9466640e0eb33f1b8b26178d33f2be0bcb32f +Task-number: PYSIDE-1442 +Reviewed-by: Friedemann Kleint +(cherry picked from commit 288fadb796ec4e11e99e3752d531ada7edf15d75) +--- + build_history/blacklist.txt | 3 --- + sources/pyside2/tests/QtCore/qflags_test.py | 12 +++++++----- + .../shiboken2/generator/shiboken2/cppgenerator.cpp | 2 ++ + 3 files changed, 9 insertions(+), 8 deletions(-) + +diff --git build_history/blacklist.txt build_history/blacklist.txt +index 9b63f9784..2a2a5d4c4 100644 +--- build_history/blacklist.txt ++++ build_history/blacklist.txt +@@ -18,9 +18,6 @@ + darwin py3 + [QtCore::qfileread_test] + darwin +-# Nested exception in Python 3 +-[QtCore::qflags_test] +- py3 + [QtCore::qobject_connect_notify_test] + linux + darwin +diff --git sources/pyside2/tests/QtCore/qflags_test.py sources/pyside2/tests/QtCore/qflags_test.py +index 08a7c55b1..e1e989c1e 100644 +--- sources/pyside2/tests/QtCore/qflags_test.py ++++ sources/pyside2/tests/QtCore/qflags_test.py +@@ -30,6 +30,7 @@ + + '''Test cases for QFlags''' + ++import operator + import os + import sys + import unittest +@@ -117,12 +118,13 @@ class QFlagsOnQVariant(unittest.TestCase): + class QFlagsWrongType(unittest.TestCase): + def testWrongType(self): + '''Wrong type passed to QFlags binary operators''' ++ for op in operator.or_, operator.and_, operator.xor: ++ for x in '43', 'jabba', QObject, object: ++ self.assertRaises(TypeError, op, Qt.NoItemFlags, x) ++ self.assertRaises(TypeError, op, x, Qt.NoItemFlags) ++ # making sure this actually does not fail all the time ++ self.assertEqual(operator.or_(Qt.NoItemFlags, 43), 43) + +- self.assertRaises(TypeError, Qt.NoItemFlags | '43') +- self.assertRaises(TypeError, Qt.NoItemFlags & '43') +- self.assertRaises(TypeError, 'jabba' & Qt.NoItemFlags) +- self.assertRaises(TypeError, 'hut' & Qt.NoItemFlags) +- self.assertRaises(TypeError, Qt.NoItemFlags & QObject()) + + if __name__ == '__main__': + unittest.main() +diff --git sources/shiboken2/generator/shiboken2/cppgenerator.cpp sources/shiboken2/generator/shiboken2/cppgenerator.cpp +index ff44db955..87ddd73a5 100644 +--- sources/shiboken2/generator/shiboken2/cppgenerator.cpp ++++ sources/shiboken2/generator/shiboken2/cppgenerator.cpp +@@ -5230,6 +5230,8 @@ void CppGenerator::writeFlagsBinaryOperator(QTextStream &s, const AbstractMetaEn + s << INDENT << "cppArg = static_cast<" << flagsEntry->originalName() + << ">(int(PyInt_AsLong(" << PYTHON_ARG << ")));\n"; + s << "#endif\n\n"; ++ s << INDENT << "if (PyErr_Occurred())\n" << indent(INDENT) ++ << INDENT << "return nullptr;\n" << outdent(INDENT); + s << INDENT << "cppResult = " << CPP_SELF_VAR << " " << cppOpName << " cppArg;\n"; + s << INDENT << "return "; + writeToPythonConversion(s, flagsType, nullptr, QLatin1String("cppResult")); +-- +2.29.2 diff --git a/srcpkgs/shiboken2/template b/srcpkgs/shiboken2/template index d0072254842..6a7298d51d3 100644 --- a/srcpkgs/shiboken2/template +++ b/srcpkgs/shiboken2/template @@ -1,12 +1,11 @@ # Template file for 'shiboken2' pkgname=shiboken2 -version=5.15.0 -revision=3 +version=5.15.2 +revision=1 _pkgname="pyside-setup-opensource-src-${version}" wrksrc="${_pkgname/%5.14.2.1/5.14.2}" build_wrksrc="sources/shiboken2" build_style=cmake -configure_args="-DBUILD_TESTS=OFF" hostmakedepends="cmake python3-devel" makedepends="python3-devel qt5-devel qt5-xmlpatterns-devel clang libxml2-devel libxslt-devel python3-numpy" @@ -16,7 +15,7 @@ maintainer="yopito " license="GPL-3.0-or-later" homepage="https://wiki.qt.io/Qt_for_Python/Shiboken" distfiles="https://download.qt.io/official_releases/QtForPython/pyside2/PySide2-${version}-src/${_pkgname}.tar.xz" -checksum=f1cdee53de3b76e22c1117a014a91ed95ac16e4760776f4f12dc38cd5a7b6b68 +checksum=b306504b0b8037079a8eab772ee774b9e877a2d84bab2dbefbe4fa6f83941418 python_version=3 export CLANG_INSTALL_DIR=${XBPS_CROSS_BASE}/usr @@ -50,15 +49,3 @@ python3-shiboken2_package() { vmove ${py3_sitelib} } } - -python3-shiboken_package() { - short_desc="Python3 shiboken2 bindings - tranditional dummy pkg" - depends="python3-shiboken2-${version}_${revision}" - build_style=meta -} - -libshiboken-python3_package() { - short_desc="Python3 shiboken2 bindings - tranditional dummy pkg" - depends="python3-shiboken2-${version}_${revision}" - build_style=meta -} From 7681d04ef95b965b7154e4016379137d4c30f637 Mon Sep 17 00:00:00 2001 From: yopito Date: Sat, 23 Jan 2021 19:58:31 +0100 Subject: [PATCH 2/3] python3-pyside2: update to 5.15.2, testing support, remove dummy packages --- common/shlibs | 2 - srcpkgs/libpyside-python3 | 1 - srcpkgs/python3-pyenet | 1 - srcpkgs/python3-pyside | 1 - srcpkgs/python3-pyside-phonon | 1 - .../patches/crossbuild-for-shiboken2.patch | 18 +-- .../patches/tests-correct-build_dir.patch | 14 +++ .../patches/tests-disable-invalid-ones.patch | 74 ++++++++++++ ...tests-find-python-modules-from-build.patch | 21 ++++ .../patches/tests-python-syntax.patch | 106 ++++++++++++++++++ srcpkgs/python3-pyside2/template | 67 +++++------ 11 files changed, 259 insertions(+), 47 deletions(-) delete mode 120000 srcpkgs/libpyside-python3 delete mode 120000 srcpkgs/python3-pyenet delete mode 120000 srcpkgs/python3-pyside delete mode 120000 srcpkgs/python3-pyside-phonon create mode 100644 srcpkgs/python3-pyside2/patches/tests-correct-build_dir.patch create mode 100644 srcpkgs/python3-pyside2/patches/tests-disable-invalid-ones.patch create mode 100644 srcpkgs/python3-pyside2/patches/tests-find-python-modules-from-build.patch create mode 100644 srcpkgs/python3-pyside2/patches/tests-python-syntax.patch diff --git a/common/shlibs b/common/shlibs index 6a925ae5900..4bc3b8255f5 100644 --- a/common/shlibs +++ b/common/shlibs @@ -1680,8 +1680,6 @@ libgtkglext-x11-1.0.so.0 gtkglext-1.2.0_4 libgdkglext-x11-1.0.so.0 gtkglext-1.2.0_4 libXaw3d.so.8 libXaw3d-1.6.2_1 libshiboken2.so.5.15 libshiboken2-5.15.0_1 -libpyside-python2.7.so.1.2 libpyside-python-1.2.2_2 -libpyside-python3.6.so.1.2 libpyside-python3-1.2.2_6 libpyside2.so.5.15 libpyside2-python3-5.15.0_1 libupsclient.so.4 libnetwork-ups-tools-2.7.2_1 libnutclient.so.0 libnetwork-ups-tools-2.7.2_1 diff --git a/srcpkgs/libpyside-python3 b/srcpkgs/libpyside-python3 deleted file mode 120000 index bb1745350a8..00000000000 --- a/srcpkgs/libpyside-python3 +++ /dev/null @@ -1 +0,0 @@ -python3-pyside2 \ No newline at end of file diff --git a/srcpkgs/python3-pyenet b/srcpkgs/python3-pyenet deleted file mode 120000 index bb1745350a8..00000000000 --- a/srcpkgs/python3-pyenet +++ /dev/null @@ -1 +0,0 @@ -python3-pyside2 \ No newline at end of file diff --git a/srcpkgs/python3-pyside b/srcpkgs/python3-pyside deleted file mode 120000 index bb1745350a8..00000000000 --- a/srcpkgs/python3-pyside +++ /dev/null @@ -1 +0,0 @@ -python3-pyside2 \ No newline at end of file diff --git a/srcpkgs/python3-pyside-phonon b/srcpkgs/python3-pyside-phonon deleted file mode 120000 index bb1745350a8..00000000000 --- a/srcpkgs/python3-pyside-phonon +++ /dev/null @@ -1 +0,0 @@ -python3-pyside2 \ No newline at end of file diff --git a/srcpkgs/python3-pyside2/patches/crossbuild-for-shiboken2.patch b/srcpkgs/python3-pyside2/patches/crossbuild-for-shiboken2.patch index 5a071a33d20..daad1fea702 100644 --- a/srcpkgs/python3-pyside2/patches/crossbuild-for-shiboken2.patch +++ b/srcpkgs/python3-pyside2/patches/crossbuild-for-shiboken2.patch @@ -1,11 +1,11 @@ --- sources/pyside2/cmake/Macros/PySideModules.cmake.ORIG +++ sources/pyside2/cmake/Macros/PySideModules.cmake -@@ -123,7 +123,7 @@ - BYPRODUCTS ${${module_SOURCES}} - COMMAND Shiboken2::shiboken2 ${GENERATOR_EXTRA_FLAGS} - "${pyside2_BINARY_DIR}/${module_NAME}_global.h" -- --include-paths=${shiboken_include_dirs} -+ --include-paths=${shiboken_include_dirs}${PATH_SEP}${CMAKE_FIND_ROOT_PATH}/usr/include - ${shiboken_framework_include_dirs_option} - --typesystem-paths=${pyside_binary_dir}${PATH_SEP}${pyside2_SOURCE_DIR}${PATH_SEP}${${module_TYPESYSTEM_PATH}} - --output-directory=${CMAKE_CURRENT_BINARY_DIR} +@@ -94,7 +94,7 @@ + # Workaround: Added ${QT_INCLUDE_DIR}/QtCore until + # qtdeclarative/8d560d1bf0a747bf62f73fad6b6774095442d9d2 has reached qt5.git + string(REPLACE ";" ${PATH_SEP} core_includes "${Qt5Core_INCLUDE_DIRS}") +- set(shiboken_include_dirs ${pyside2_SOURCE_DIR}${PATH_SEP}${QT_INCLUDE_DIR}${PATH_SEP}${core_includes}) ++ set(shiboken_include_dirs ${pyside2_SOURCE_DIR}${PATH_SEP}${QT_INCLUDE_DIR}${PATH_SEP}${core_includes}${PATH_SEP}${CMAKE_FIND_ROOT_PATH}/usr/include) + set(shiboken_framework_include_dirs_option "") + if(CMAKE_HOST_APPLE) + set(shiboken_framework_include_dirs "${QT_FRAMEWORK_INCLUDE_DIR}") diff --git a/srcpkgs/python3-pyside2/patches/tests-correct-build_dir.patch b/srcpkgs/python3-pyside2/patches/tests-correct-build_dir.patch new file mode 100644 index 00000000000..540e4304958 --- /dev/null +++ b/srcpkgs/python3-pyside2/patches/tests-correct-build_dir.patch @@ -0,0 +1,14 @@ +Reported upstream: https://bugreports.qt.io/browse/PYSIDE-1430 + +--- sources/pyside2/tests/CMakeLists.txt.ORIG 2020-11-11 13:51:30.000000000 +0100 ++++ sources/pyside2/tests/CMakeLists.txt 2020-11-24 11:42:34.629110123 +0100 +@@ -7,8 +7,7 @@ + + # BUILD_DIR and QT_DIR are used by init_paths.py for setting + # the path to the testbinding module +- get_filename_component(BUILD_DIR "${CMAKE_BINARY_DIR}" DIRECTORY) +- get_filename_component(BUILD_DIR "${CMAKE_BINARY_DIR}" DIRECTORY) ++ set(BUILD_DIR "${CMAKE_BINARY_DIR}") + set(QT_DIR "${_qt5Core_install_prefix}") + + macro(TEST_QT_MODULE var name) diff --git a/srcpkgs/python3-pyside2/patches/tests-disable-invalid-ones.patch b/srcpkgs/python3-pyside2/patches/tests-disable-invalid-ones.patch new file mode 100644 index 00000000000..ca4894b6fa9 --- /dev/null +++ b/srcpkgs/python3-pyside2/patches/tests-disable-invalid-ones.patch @@ -0,0 +1,74 @@ +Disable failing tests. Almost of these are related to OpenGL that is +unsupported by vnc virtual backend. + +Raw testing Status: 98% tests passed, 9 tests failed out of 471 + +--- sources/pyside2/tests/QtDataVisualization/CMakeLists.txt.ORIG ++++ sources/pyside2/tests/QtDataVisualization/CMakeLists.txt +@@ -1 +0,0 @@ +-PYSIDE_TEST(datavisualization_test.py) +--- sources/pyside2/tests/QtGui/CMakeLists.txt.ORIG ++++ sources/pyside2/tests/QtGui/CMakeLists.txt +@@ -20,14 +20,12 @@ + PYSIDE_TEST(qcolor_test.py) + PYSIDE_TEST(qcolor_reduce_test.py) + PYSIDE_TEST(qcursor_test.py) +-PYSIDE_TEST(qdatastream_gui_operators_test.py) + PYSIDE_TEST(qdesktopservices_test.py) + PYSIDE_TEST(qfontmetrics_test.py) + PYSIDE_TEST(qguiapplication_test.py) + PYSIDE_TEST(qicon_test.py) + PYSIDE_TEST(qitemselection_test.py) + PYSIDE_TEST(qmatrix_test.py) +-PYSIDE_TEST(qopenglbuffer_test.py) + PYSIDE_TEST(qpainter_test.py) + PYSIDE_TEST(qpdfwriter_test.py) + PYSIDE_TEST(qpixelformat_test.py) +--- sources/pyside2/tests/QtOpenGL/CMakeLists.txt.ORIG ++++ sources/pyside2/tests/QtOpenGL/CMakeLists.txt +@@ -1,2 +1 @@ +-PYSIDE_TEST(qglbuffer_test.py) + PYSIDE_TEST(qglwidget_test.py) +--- sources/pyside2/tests/QtScriptTools/CMakeLists.txt.ORIG ++++ sources/pyside2/tests/QtScriptTools/CMakeLists.txt +@@ -1 +0,0 @@ +-PYSIDE_TEST(debugger_test.py) +--- sources/pyside2/tests/QtWebEngineCore/CMakeLists.txt.ORIG ++++ sources/pyside2/tests/QtWebEngineCore/CMakeLists.txt +@@ -26,4 +26,3 @@ + ## + ############################################################################# + +-PYSIDE_TEST(web_engine_custom_scheme.py) +--- sources/pyside2/tests/QtWebEngineWidgets/CMakeLists.txt.ORIG ++++ sources/pyside2/tests/QtWebEngineWidgets/CMakeLists.txt +@@ -26,4 +26,3 @@ + ## + ############################################################################# + +-PYSIDE_TEST(pyside-474-qtwebengineview.py) +--- sources/pyside2/tests/QtWidgets/CMakeLists.txt.ORIG ++++ sources/pyside2/tests/QtWidgets/CMakeLists.txt +@@ -6,7 +6,6 @@ + PYSIDE_TEST(application_test.py) + PYSIDE_TEST(bug_172.py) + PYSIDE_TEST(bug_243.py) +-PYSIDE_TEST(bug_307.py) + PYSIDE_TEST(bug_324.py) + PYSIDE_TEST(bug_338.py) + PYSIDE_TEST(bug_363.py) +@@ -131,7 +131,6 @@ + PYSIDE_TEST(qtoolbox_test.py) + PYSIDE_TEST(qvariant_test.py) + PYSIDE_TEST(qwidget_setlayout_test.py) +-PYSIDE_TEST(qwidget_test.py) + PYSIDE_TEST(qcolormap_test.py) + PYSIDE_TEST(reference_count_test.py) + PYSIDE_TEST(signature_test.py) +--- sources/pyside2/tests/registry/CMakeLists.txt.ORIG ++++ sources/pyside2/tests/registry/CMakeLists.txt +@@ -37,4 +37,3 @@ + ## + ############################################################################# + +-PYSIDE_TEST(existence_test.py) diff --git a/srcpkgs/python3-pyside2/patches/tests-find-python-modules-from-build.patch b/srcpkgs/python3-pyside2/patches/tests-find-python-modules-from-build.patch new file mode 100644 index 00000000000..673998bc049 --- /dev/null +++ b/srcpkgs/python3-pyside2/patches/tests-find-python-modules-from-build.patch @@ -0,0 +1,21 @@ +tests need python modules that are not installed yet: point the built ones. +Reported upstream: https://bugreports.qt.io/browse/PYSIDE-1430 + +--- sources/pyside2/tests/init_paths.py.ORIG 2020-11-11 13:51:30.000000000 +0100 ++++ sources/pyside2/tests/init_paths.py 2020-11-21 23:36:33.131282473 +0100 +@@ -75,12 +75,12 @@ + + python_dirs = [os.path.join(src_dir, 'util')] # Helper module + +- pyside_build_dir = os.path.join(get_build_dir(), 'pyside2') +- python_dirs.append(pyside_build_dir) # for PySide2 ++ pyside_build_dir = os.path.join(get_build_dir(), 'PySide2') ++ python_dirs.append(get_build_dir()) # for PySide2 + lib_dirs = [os.path.join(pyside_build_dir, 'libpyside')] + + if testbindings_module: +- python_dirs.append(os.path.join(pyside_build_dir, ++ python_dirs.append(os.path.join(get_build_dir(), + 'tests', 'pysidetest')) + lib_dirs.append(_get_qt_lib_dir()) + diff --git a/srcpkgs/python3-pyside2/patches/tests-python-syntax.patch b/srcpkgs/python3-pyside2/patches/tests-python-syntax.patch new file mode 100644 index 00000000000..2c2e1367907 --- /dev/null +++ b/srcpkgs/python3-pyside2/patches/tests-python-syntax.patch @@ -0,0 +1,106 @@ +This changeset is about both shiboken2 and python3-pyside2 +(that are separated packages) +upstream: yes + +From c6184e01e993dcca9798f306fb8e9cb322fdd0dc Mon Sep 17 00:00:00 2001 +From: Christian Tismer +Date: Thu, 3 Dec 2020 13:38:58 +0100 +Subject: [PATCH] fix both qflags_test and the qflags cppgenerator code + +There was a years-old qflags test failing on Python 3. +It was blacklisted with the comment + + "# Nested exception in Python 3" + +This was nonsense: The test was wrong also for Python 2. +It just happened to work, because Python 2 had some weird +errors leaking. The real bug was in missing error handling +in cppgenerator.cpp . + +See the main description in the issue. + +Change-Id: Ia0f9466640e0eb33f1b8b26178d33f2be0bcb32f +Task-number: PYSIDE-1442 +Reviewed-by: Friedemann Kleint +(cherry picked from commit 288fadb796ec4e11e99e3752d531ada7edf15d75) +--- + build_history/blacklist.txt | 3 --- + sources/pyside2/tests/QtCore/qflags_test.py | 12 +++++++----- + .../shiboken2/generator/shiboken2/cppgenerator.cpp | 2 ++ + 3 files changed, 9 insertions(+), 8 deletions(-) + +diff --git build_history/blacklist.txt build_history/blacklist.txt +index 9b63f9784..2a2a5d4c4 100644 +--- build_history/blacklist.txt ++++ build_history/blacklist.txt +@@ -18,9 +18,6 @@ + darwin py3 + [QtCore::qfileread_test] + darwin +-# Nested exception in Python 3 +-[QtCore::qflags_test] +- py3 + [QtCore::qobject_connect_notify_test] + linux + darwin +diff --git sources/pyside2/tests/QtCore/qflags_test.py sources/pyside2/tests/QtCore/qflags_test.py +index 08a7c55b1..e1e989c1e 100644 +--- sources/pyside2/tests/QtCore/qflags_test.py ++++ sources/pyside2/tests/QtCore/qflags_test.py +@@ -30,6 +30,7 @@ + + '''Test cases for QFlags''' + ++import operator + import os + import sys + import unittest +@@ -117,12 +118,13 @@ class QFlagsOnQVariant(unittest.TestCase): + class QFlagsWrongType(unittest.TestCase): + def testWrongType(self): + '''Wrong type passed to QFlags binary operators''' ++ for op in operator.or_, operator.and_, operator.xor: ++ for x in '43', 'jabba', QObject, object: ++ self.assertRaises(TypeError, op, Qt.NoItemFlags, x) ++ self.assertRaises(TypeError, op, x, Qt.NoItemFlags) ++ # making sure this actually does not fail all the time ++ self.assertEqual(operator.or_(Qt.NoItemFlags, 43), 43) + +- self.assertRaises(TypeError, Qt.NoItemFlags | '43') +- self.assertRaises(TypeError, Qt.NoItemFlags & '43') +- self.assertRaises(TypeError, 'jabba' & Qt.NoItemFlags) +- self.assertRaises(TypeError, 'hut' & Qt.NoItemFlags) +- self.assertRaises(TypeError, Qt.NoItemFlags & QObject()) + + if __name__ == '__main__': + unittest.main() +diff --git sources/shiboken2/generator/shiboken2/cppgenerator.cpp sources/shiboken2/generator/shiboken2/cppgenerator.cpp +index ff44db955..87ddd73a5 100644 +--- sources/shiboken2/generator/shiboken2/cppgenerator.cpp ++++ sources/shiboken2/generator/shiboken2/cppgenerator.cpp +@@ -5230,6 +5230,8 @@ void CppGenerator::writeFlagsBinaryOperator(QTextStream &s, const AbstractMetaEn + s << INDENT << "cppArg = static_cast<" << flagsEntry->originalName() + << ">(int(PyInt_AsLong(" << PYTHON_ARG << ")));\n"; + s << "#endif\n\n"; ++ s << INDENT << "if (PyErr_Occurred())\n" << indent(INDENT) ++ << INDENT << "return nullptr;\n" << outdent(INDENT); + s << INDENT << "cppResult = " << CPP_SELF_VAR << " " << cppOpName << " cppArg;\n"; + s << INDENT << "return "; + writeToPythonConversion(s, flagsType, nullptr, QLatin1String("cppResult")); +-- +2.29.2 + +Fix python warning about 'is not' usage. +This diff is DISTINCT from the previous patch + +--- sources/pyside2/tests/QtWidgets/qwidget_test.py 2020-11-11 13:51:30.000000000 +0100 ++++ sources/pyside2/tests/QtWidgets/qwidget_test.py 2020-11-24 14:28:06.103093649 +0100 +@@ -73,7 +73,7 @@ + self.assertTrue(not widget.isVisible()) + widget.setVisible(True) + self.assertTrue(widget.isVisible()) +- self.assertTrue(widget.winId() is not 0) ++ self.assertTrue(widget.winId() != 0) + # skip this test on macOS since no native events are received + if sys.platform == 'darwin': + return diff --git a/srcpkgs/python3-pyside2/template b/srcpkgs/python3-pyside2/template index fe69087e4d0..467707fad34 100644 --- a/srcpkgs/python3-pyside2/template +++ b/srcpkgs/python3-pyside2/template @@ -1,12 +1,12 @@ # Template file for 'python3-pyside2' pkgname=python3-pyside2 -version=5.15.0 -revision=2 +version=5.15.2 +revision=1 _pkgname="pyside-setup-opensource-src-${version}" wrksrc="${_pkgname/%5.14.2.1/5.14.2}" build_wrksrc="sources/pyside2" build_style=cmake -configure_args="-DBUILD_TESTS=OFF -DPYTHON_EXECUTABLE=/usr/bin/python" +configure_args="-DPYTHON_EXECUTABLE=/usr/bin/python" hostmakedepends="cmake python3 shiboken2" makedepends="python3-devel libshiboken2-devel qt5-devel qt5-multimedia-devel qt5-tools-devel qt5-plugin-mysql qt5-plugin-odbc @@ -18,34 +18,57 @@ makedepends="python3-devel libshiboken2-devel qt5-devel qt5-serialport-devel $(vopt_if webengine 'qt5-webengine-devel')" depends="python3-shiboken2" +checkdepends="python3-distro tzdata pulseaudio qt5-quickcontrols" short_desc="Python3 bindings for the Qt5 toolkit" maintainer="yopito " license="LGPL-3.0-or-later" homepage="https://wiki.qt.io/Qt_for_Python" distfiles="https://download.qt.io/official_releases/QtForPython/pyside2/PySide2-${version}-src/${_pkgname}.tar.xz" -checksum=f1cdee53de3b76e22c1117a014a91ed95ac16e4760776f4f12dc38cd5a7b6b68 +checksum=b306504b0b8037079a8eab772ee774b9e877a2d84bab2dbefbe4fa6f83941418 + +build_options="webengine" +desc_option_webengine="Build Qt5 WebEngine bindings" + +subpackages="libpyside2-python3-devel libpyside2-python3" # needed by shiboken2 runtime -export CLANG_INSTALL_DIR=${XBPS_CROSS_BASE}/usr +export CLANG_INSTALL_DIR=/usr if [ ${CROSS_BUILD} ]; then hostmakedepends+=" qt5-qmake qt5-host-tools qt5-tools qt5-remoteobjects qt5-scxml" -fi -build_options="webengine" -desc_option_webengine="Build Qt5 WebEngine bindings" + # make clang of shiboken aware of crossbuild + SHIBOKEN_CLANG_OPTIONS="--target=${XBPS_CROSS_TRIPLET}" + SHIBOKEN_CLANG_OPTIONS+=" --sysroot=/usr/${XBPS_CROSS_TRIPLET}" -if [ "$XBPS_TARGET_ENDIAN" = "le" ]; then - build_options_default="webengine" + # qt5 is built by gcc, so clang of shiboken needs gcc stuff, at least for armv7l + if [ "$IN_CHROOT" ]; then + local gcc_ver="$(${XBPS_CROSS_TRIPLET}-gcc -dumpversion)" + local inc_root="/usr/${XBPS_CROSS_TRIPLET}/usr/include/c++/${gcc_ver}" + + SHIBOKEN_CLANG_OPTIONS+=" -isystem ${inc_root}" + SHIBOKEN_CLANG_OPTIONS+=" -isystem ${inc_root}/${XBPS_CROSS_TRIPLET}" + # XXX uneeded so far + #SHIBOKEN_CLANG_OPTIONS+=" -isystem ${inc_root}/backward" + fi + export SHIBOKEN_CLANG_OPTIONS fi -subpackages="libpyside2-python3-devel libpyside2-python3 libpyside-python3 - python3-pyside python3-pyside-phonon python3-pyenet" +if [ "$XBPS_TARGET_ENDIAN" = "le" ]; then + if [ "$XBPS_TARGET_WORDSIZE" = "$XBPS_WORDSIZE" ]; then + build_options_default="webengine" + fi +fi if [ "$build_option_webengine" ]; then subpackages+=" python3-pyside2-webengine" fi +pre_check() { + # no virtual backend is fine for OpenGL, vnc is fine for Qml tests + export QT_QPA_PLATFORM=vnc +} + python3-pyside2-webengine_package() { depends="python3-pyside2-${version}_${revision}" short_desc+=" - WebEngine component" @@ -73,23 +96,3 @@ libpyside2-python3_package() { vmove "usr/lib/*.so.*" } } - -libpyside-python3_package() { - short_desc+=" - transitional dummy package" - build_style=meta -} - -python3-pyside_package() { - short_desc+=" - transitional dummy package" - build_style=meta -} - -python3-pyside-phonon_package() { - short_desc+=" - transitional dummy package" - build_style=meta -} - -python3-pyenet_package() { - short_desc+=" - transitional dummy package" - build_style=meta -} From 7a74a3eed61b662bab9424dfef5ac3b2ab401f62 Mon Sep 17 00:00:00 2001 From: yopito Date: Sat, 23 Jan 2021 19:58:33 +0100 Subject: [PATCH 3/3] pyside2-tools: update to 5.15.2, testing support --- .../patches/tests-use-qt5-rcc-and-uic.patch | 34 +++++++++++++++++++ srcpkgs/pyside2-tools/template | 10 ++++-- 2 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 srcpkgs/pyside2-tools/patches/tests-use-qt5-rcc-and-uic.patch diff --git a/srcpkgs/pyside2-tools/patches/tests-use-qt5-rcc-and-uic.patch b/srcpkgs/pyside2-tools/patches/tests-use-qt5-rcc-and-uic.patch new file mode 100644 index 00000000000..0dc0f0bfb11 --- /dev/null +++ b/srcpkgs/pyside2-tools/patches/tests-use-qt5-rcc-and-uic.patch @@ -0,0 +1,34 @@ +--- sources/pyside2-tools/tests/CMakeLists.txt ++++ sources/pyside2-tools/tests/CMakeLists.txt +@@ -1,4 +1,11 @@ ++ ++# Since Qt v5.14, pyside2-uic and pyside2-rcc are directly provided by Qt5Core uic and rcc, ++# with '-g python' option ++ ++FIND_PROGRAM(PYSIDE2UICBINARY NAMES uic-qt5 uic) ++FIND_PROGRAM(PYSIDE2RCCBINARY NAMES rcc-qt5 rcc) ++ + add_subdirectory(rcc) +-add_test(QWizard ${SHIBOKEN_PYTHON_INTERPRETER} ${CMAKE_SOURCE_DIR}/pyside2-uic "${CMAKE_CURRENT_SOURCE_DIR}/qwizard_test.ui") ++add_test(QWizard ${PYSIDE2UICBINARY} --generator=python "${CMAKE_CURRENT_SOURCE_DIR}/qwizard_test.ui") + set_tests_properties(QWizard PROPERTIES + ENVIRONMENT "PYTHONPATH=$ENV{PYTHONPATH}:${CMAKE_SOURCE_DIR}:${CMAKE_CURRENT_SOURCE_DIR}") +--- sources/pyside2-tools/tests/rcc/CMakeLists.txt ++++ sources/pyside2-tools/tests/rcc/CMakeLists.txt +@@ -1,6 +1,6 @@ + macro(ADD_RCC_TEST name pyfile qrcfile) + add_test(${name} ${CMAKE_CURRENT_SOURCE_DIR}/run_test.sh +- ${PYSIDERCC_EXECUTABLE} ++ ${PYSIDE2RCCBINARY} + ${CMAKE_CURRENT_SOURCE_DIR}/${pyfile} + ${CMAKE_CURRENT_SOURCE_DIR}/${qrcfile} + ${CMAKE_CURRENT_SOURCE_DIR}) +--- sources/pyside2-tools/tests/rcc/run_test.sh ++++ sources/pyside2-tools/tests/rcc/run_test.sh +@@ -8,5 +8,5 @@ + # $3: qrc file + + export PYTHONPATH=$PYTHONPATH:`pwd` +-$1 -o `basename $3 .qrc`_rc.py $3 ++$1 --generator=python -o `basename $3 .qrc`_rc.py $3 + `pkg-config shiboken2 --variable=python_interpreter` $2 diff --git a/srcpkgs/pyside2-tools/template b/srcpkgs/pyside2-tools/template index 4e9fa743c30..7b49a46ec81 100644 --- a/srcpkgs/pyside2-tools/template +++ b/srcpkgs/pyside2-tools/template @@ -1,23 +1,27 @@ # Template file for 'pyside2-tools' pkgname=pyside2-tools -version=5.15.0 +version=5.15.2 revision=1 _pkgname="pyside-setup-opensource-src-${version}" wrksrc="${_pkgname/%5.14.2.1/5.14.2}" build_wrksrc="sources/pyside2-tools" build_style=cmake -configure_args="-DBUILD_TESTS=OFF" hostmakedepends="cmake python3-devel shiboken2" makedepends="python3-devel libshiboken2-devel qt5-devel libpyside2-python3-devel" +checkdepends="pkg-config" short_desc="Python3 bindings for the Qt5 toolkit" maintainer="yopito " license="LGPL-3.0-or-later" homepage="https://wiki.qt.io/Qt_for_Python/Shiboken" distfiles="https://download.qt.io/official_releases/QtForPython/pyside2/PySide2-${version}-src/${_pkgname}.tar.xz" -checksum=f1cdee53de3b76e22c1117a014a91ed95ac16e4760776f4f12dc38cd5a7b6b68 +checksum=b306504b0b8037079a8eab772ee774b9e877a2d84bab2dbefbe4fa6f83941418 python_version=3 if [ ${CROSS_BUILD} ]; then hostmakedepends+=" qt5-qmake qt5-host-tools" fi + +pre_check() { + export QT_QPA_PLATFORM=offscreen +}