diff options
| author | root <root@alpha.trunkmasters.com> | 2026-06-12 19:09:37 -0500 |
|---|---|---|
| committer | root <root@alpha.trunkmasters.com> | 2026-06-12 19:09:37 -0500 |
| commit | b590c8d7572b727d565cc0b8ff660d43569845de (patch) | |
| tree | 06f7a4102ea4e845df8b66660f252920d52952f9 /dev-python/pyside | |
| parent | 24f9cbfc4c34fdb6a6e03311674414e881ceab47 (diff) | |
| download | baldeagleos-repo-b590c8d7572b727d565cc0b8ff660d43569845de.tar.gz baldeagleos-repo-b590c8d7572b727d565cc0b8ff660d43569845de.tar.xz baldeagleos-repo-b590c8d7572b727d565cc0b8ff660d43569845de.zip | |
Adding metadata
Diffstat (limited to 'dev-python/pyside')
| -rw-r--r-- | dev-python/pyside/Manifest | 2 | ||||
| -rw-r--r-- | dev-python/pyside/files/pyside-6.10.0-dont-vendor-ffmpeg.patch | 18 | ||||
| -rw-r--r-- | dev-python/pyside/files/pyside-6.10.1-pass-ninja-opts.patch | 20 | ||||
| -rw-r--r-- | dev-python/pyside/files/pyside-6.10.2-quick-fix-build-wheel.patch | 15 | ||||
| -rw-r--r-- | dev-python/pyside/files/pyside-6.11.0-find-cmake-helpers.patch | 26 | ||||
| -rw-r--r-- | dev-python/pyside/files/pyside-6.11.1-fix-llvm-version.patch | 16 | ||||
| -rw-r--r-- | dev-python/pyside/metadata.xml | 57 | ||||
| -rw-r--r-- | dev-python/pyside/pyside-6.10.3.ebuild | 584 | ||||
| -rw-r--r-- | dev-python/pyside/pyside-6.11.1-r1.ebuild | 610 | ||||
| -rw-r--r-- | dev-python/pyside/pyside-6.9999.ebuild | 608 |
10 files changed, 1956 insertions, 0 deletions
diff --git a/dev-python/pyside/Manifest b/dev-python/pyside/Manifest new file mode 100644 index 000000000000..5cf249ef706c --- /dev/null +++ b/dev-python/pyside/Manifest @@ -0,0 +1,2 @@ +DIST pyside-setup-everywhere-src-6.10.3.tar.xz 17900952 BLAKE2B e30ede40299161a928a919895a9d26e04e9b58eafa681c2c41ebd37eed39e9b7df74435720e693f87e72f67701dad92cc36938896946f382dac6db0266365fa9 SHA512 6a42478bdfbaef07a993451de423420b20b1a0858c3a86b67071d209a384a6ec6847d95a057a7fc8585206434b817c54f1e301ccf057635e04ea63c6713a7eec +DIST pyside-setup-everywhere-src-6.11.1.tar.xz 17963432 BLAKE2B 12c24c6840ef2e80a398e0697530c71f6a1dcd234f70b6c173cb216c1ccd3bcc0cdc51bf39704efd6ab1971d993ffbb41b5f7bf4774dacbd2a65914324d687c5 SHA512 662c07ee644b2f62cb91d5df81751fcbf81169e3a0f6d1ff7853334f9401b59dab9f0d5fdc368c6a730e72c04c8271d10215ae4a7419652b77b9808e7dd94d0f diff --git a/dev-python/pyside/files/pyside-6.10.0-dont-vendor-ffmpeg.patch b/dev-python/pyside/files/pyside-6.10.0-dont-vendor-ffmpeg.patch new file mode 100644 index 000000000000..72c09ec5f9ca --- /dev/null +++ b/dev-python/pyside/files/pyside-6.10.0-dont-vendor-ffmpeg.patch @@ -0,0 +1,18 @@ +--- a/build_scripts/platforms/unix.py ++++ b/build_scripts/platforms/unix.py +@@ -234,14 +234,6 @@ def prepare_packages_posix(pyside_build, _vars, cross_build=False): + "{st_build_dir}/{st_package_name}/jar", + _vars=_vars) + +- # Some libraries specific to Linux/Android from 6.8 +- # eg: the libav* libraries are required for the multimedia module +- if config.is_internal_pyside_build() and (sys.platform != "darwin" or is_android): +- qt_multimedia_filters = [f"lib{lib}*.so*" for lib in PYSIDE_MULTIMEDIA_LIBS] +- copydir("{qt_lib_dir}", destination_qt_dir / "lib", +- _filter=qt_multimedia_filters, +- recursive=False, _vars=_vars, force_copy_symlinks=True) +- + # Copy Qt libs to package + if OPTION["STANDALONE"]: + if config.is_internal_pyside_build() or config.is_internal_shiboken_generator_build(): + diff --git a/dev-python/pyside/files/pyside-6.10.1-pass-ninja-opts.patch b/dev-python/pyside/files/pyside-6.10.1-pass-ninja-opts.patch new file mode 100644 index 000000000000..b6f05c5a59c5 --- /dev/null +++ b/dev-python/pyside/files/pyside-6.10.1-pass-ninja-opts.patch @@ -0,0 +1,20 @@ +Allows passing --load-average and not passing --jobs which would stop the jobserver from working. + +This is a Gentoo'ism so its not upstreamable in this form. + +diff --git a/build_scripts/main.py b/build_scripts/main.py +index cdaa439ff..3e088961e 100644 +--- a/build_scripts/main.py ++++ b/build_scripts/main.py +@@ -854,8 +854,8 @@ class PysideBuild(_build, CommandMixin, BuildInfoCollectorMixin): + + log.info(f"-- Compiling module {extension}...") + cmd_make = [str(self.make_path)] +- if OPTION["JOBS"]: +- cmd_make.append(OPTION["JOBS"]) ++ if self.make_generator == "Ninja": ++ cmd_make.extend(os.getenv("NINJAOPTS").split()) + if OPTION["LOG_LEVEL"] == LogLevel.VERBOSE and self.make_generator == "Ninja": + cmd_make.append("-v") + if run_process(cmd_make) != 0: + diff --git a/dev-python/pyside/files/pyside-6.10.2-quick-fix-build-wheel.patch b/dev-python/pyside/files/pyside-6.10.2-quick-fix-build-wheel.patch new file mode 100644 index 000000000000..56992c3f49a4 --- /dev/null +++ b/dev-python/pyside/files/pyside-6.10.2-quick-fix-build-wheel.patch @@ -0,0 +1,15 @@ +--- a/build_scripts/wheel_override.py ++++ b/build_scripts/wheel_override.py +@@ -20,9 +20,9 @@ + + from packaging import tags + from wheel import __version__ as wheel_version +- from wheel.bdist_wheel import bdist_wheel as _bdist_wheel +- from wheel.bdist_wheel import get_abi_tag, get_platform +- from wheel.bdist_wheel import safer_name as _safer_name ++ from setuptools.command.bdist_wheel import bdist_wheel as _bdist_wheel ++ from setuptools.command.bdist_wheel import get_abi_tag, get_platform ++ from setuptools.command.bdist_wheel import safer_name as _safer_name + + wheel_module_exists = True + except Exception as e: diff --git a/dev-python/pyside/files/pyside-6.11.0-find-cmake-helpers.patch b/dev-python/pyside/files/pyside-6.11.0-find-cmake-helpers.patch new file mode 100644 index 000000000000..4e321cc773ac --- /dev/null +++ b/dev-python/pyside/files/pyside-6.11.0-find-cmake-helpers.patch @@ -0,0 +1,26 @@ +diff --git a/sources/pyside6/cmake/PySideHelpers.cmake b/sources/pyside6/cmake/PySideHelpers.cmake +index ec803a1..335893f 100644 +--- a/sources/pyside6/cmake/PySideHelpers.cmake ++++ b/sources/pyside6/cmake/PySideHelpers.cmake +@@ -43,6 +43,8 @@ function(pyside_internal_find_host_shiboken_tools) + if(QFP_SHIBOKEN_HOST_PATH) + list(APPEND find_package_extra_args PATHS "${QFP_SHIBOKEN_HOST_PATH}/lib/cmake") + list(PREPEND CMAKE_FIND_ROOT_PATH "${QFP_SHIBOKEN_HOST_PATH}") ++ elseif(QFP_SHIBOKEN_TARGET_PATH) ++ list(APPEND find_package_extra_args PATHS "${QFP_SHIBOKEN_TARGET_PATH}/lib/cmake") + endif() + + # When doing a regular build, immediately mark the package as required. +diff --git a/sources/shiboken6/cmake/ShibokenHelpers.cmake b/sources/shiboken6/cmake/ShibokenHelpers.cmake +index 8c3c8f9..b5e3c68 100644 +--- a/sources/shiboken6/cmake/ShibokenHelpers.cmake ++++ b/sources/shiboken6/cmake/ShibokenHelpers.cmake +@@ -530,6 +530,8 @@ function(shiboken_internal_find_host_shiboken_tools) + if(QFP_SHIBOKEN_HOST_PATH) + list(APPEND find_package_extra_args PATHS "${QFP_SHIBOKEN_HOST_PATH}/lib/cmake") + list(PREPEND CMAKE_FIND_ROOT_PATH "${QFP_SHIBOKEN_HOST_PATH}") ++ elseif(QFP_SHIBOKEN_TARGET_PATH) ++ list(APPEND find_package_extra_args PATHS "${QFP_SHIBOKEN_TARGET_PATH}/lib/cmake") + endif() + set(SHIBOKEN6TOOLS_SKIP_FIND_DEPENDENCIES TRUE) + find_package( diff --git a/dev-python/pyside/files/pyside-6.11.1-fix-llvm-version.patch b/dev-python/pyside/files/pyside-6.11.1-fix-llvm-version.patch new file mode 100644 index 000000000000..28cc48601ef3 --- /dev/null +++ b/dev-python/pyside/files/pyside-6.11.1-fix-llvm-version.patch @@ -0,0 +1,16 @@ +https://codeberg.org/gentoo/gentoo/pulls/884#issuecomment-14921022 + +Fixes https://github.com/pyside/pyside-setup/commit/2f25d2a3db2ffc4c5e18654138249d285e995d08 + +--- a/sources/shiboken6_generator/cmake/ShibokenGeneratorSetup.cmake ++++ b/sources/shiboken6_generator/cmake/ShibokenGeneratorSetup.cmake +@@ -36,7 +36,7 @@ compute_config_py_values(shiboken6_VERSION) + + shiboken_internal_set_python_site_packages() + +-string(REGEX REPLACE "\\.[0-9]+\\.[0-9]+$" "" LLVM_VERSION "${LLVM_PACKAGE_VERSION}") ++set(LLVM_VERSION "${LLVM_VERSION_MAJOR}") + + set_cmake_cxx_flags() + set(CMAKE_CXX_FLAGS + diff --git a/dev-python/pyside/metadata.xml b/dev-python/pyside/metadata.xml new file mode 100644 index 000000000000..acd7c461e73e --- /dev/null +++ b/dev-python/pyside/metadata.xml @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://docs.baldeagleos.com/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person" proxied="proxy"> + <email>nowa@gentoo.org</email> + <name>Nowa Ammerlaan</name> + </maintainer> + <maintainer type="person" proxied="yes"> + <email>negril.nx+gentoo@gmail.com</email> + <name>Paul Zander</name> + </maintainer> + <use> + <flag name="3d">Build Qt3DCore, Qt3DAnimation, Qt3DExtras, Qt3DInput, Qt3DLogic, and Qt3DRender modules</flag> + <flag name="bluetooth">Build QtBluetooth module</flag> + <flag name="charts">Build QtCharts module</flag> + <flag name="concurrent">Build QtConcurrent module</flag> + <flag name="core">Build QtCore module, if disable then only shiboken will be built</flag> + <flag name="designer">Build QtDesigner and QtUiTools modules</flag> + <flag name="gles2-only">Build QtGui "QOpenGL*" classes</flag> + <flag name="graphs">Build QtGraphs module</flag> + <flag name="gui">Build QtGui module</flag> + <flag name="help">Build QtHelp module</flag> + <flag name="httpserver">Build QtHttpServer module</flag> + <flag name="location">Build QtLocation module</flag> + <flag name="multimedia">Build QtMultimedia and QtMultimediaWidgets modules</flag> + <flag name="network">Build QtNetwork module</flag> + <flag name="network-auth">Build QtNetworkAuth module</flag> + <flag name="nfc">Build QtNfc module</flag> + <flag name="numpy">Build with support for <pkg>dev-python/numpy</pkg> + </flag> + <flag name="pdfium">Build QtPdf module</flag> + <flag name="positioning">Build QtPositioning module</flag> + <flag name="printsupport">Build QtPrintSupport module</flag> + <flag name="qml">Build QtQml module</flag> + <flag name="quick">Build QtQuick and QtQuickWidgets modules</flag> + <flag name="quick3d">Build QtQuick3D and QtQuickWidgets modules</flag> + <flag name="scxml">Build QtScxml module</flag> + <flag name="sensors">Build QtSensors module</flag> + <flag name="serialbus">Build QtSerialBus modules</flag> + <flag name="serialport">Build QtSerialPort modules</flag> + <flag name="spatialaudio">Build QtSpatialAudio module</flag> + <flag name="speech">Build QtTextToSpeech module</flag> + <flag name="sql">Build QtSql module</flag> + <flag name="svg">Build QtSvg module</flag> + <flag name="remoteobjects">Build QtRemoteObjects module</flag> + <flag name="testlib">Build QtTest module</flag> + <flag name="tools">Build PySide Tools</flag> + <flag name="uitools">Build UITools module</flag> + <flag name="webchannel">Build QtWebChannel module</flag> + <flag name="webengine">Build QtWebEngine and QtWebEngineWidgets modules</flag> + <flag name="websockets">Build QtWebSockets module</flag> + <flag name="webview">Build QtWebView module</flag> + <flag name="widgets">Build QtWidgets module</flag> + <flag name="xml">Build QtXml module</flag> + </use> + <origin>baldeagleos-repo</origin> +</pkgmetadata> diff --git a/dev-python/pyside/pyside-6.10.3.ebuild b/dev-python/pyside/pyside-6.10.3.ebuild new file mode 100644 index 000000000000..a8f3c03591d3 --- /dev/null +++ b/dev-python/pyside/pyside-6.10.3.ebuild @@ -0,0 +1,584 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# NOTE: We combine here several PyPI packages, we do this because +# pyside can and does break if it is compiled with a different +# toolchain then was used to build shiboken. This bundling ensures +# that we always use the same toolchain for all components. + +EAPI=8 + +PYTHON_COMPAT=( python3_{13..14} ) +LLVM_COMPAT=( {18..21} ) +DISTUTILS_USE_PEP517=setuptools +DISTUTILS_EXT=1 + +inherit distutils-r1 llvm-r2 multiprocessing ninja-utils qmake-utils virtualx + +MY_PN=${PN}-setup-everywhere-src +MY_P=${MY_PN}-${PV} + +DESCRIPTION="Python bindings for the Qt framework" +HOMEPAGE="https://wiki.qt.io/PySide6" + +if [[ ${PV} == *.9999 ]]; then + inherit git-r3 + EGIT_REPO_URI=( + "https://code.qt.io/${PN}/${PN}-setup.git" + "https://github.com/qtproject/${PN}-${PN}-setup.git" + ) + EGIT_BRANCH=dev + [[ ${PV} == 6.*.9999 ]] && EGIT_BRANCH=${PV%.9999} +else + SRC_URI="https://download.qt.io/official_releases/QtForPython/${PN}6/PySide6-${PV}-src/${MY_P}.tar.xz" + S="${WORKDIR}/${MY_P}" + KEYWORDS="amd64 ~arm arm64 ~loong ~ppc64 ~riscv ~x86" +fi + +LICENSE="|| ( GPL-2 GPL-3 LGPL-3 )" +SLOT="6/${PV}" + +# If a flag enables multiple Qt modules, they should be ordered +# according to their dependencies, e.g. for 3d, 3DCore must be first. +# Widgets for various modules are handled as a special case later +declare -A QT_MODULES=( + ["3d"]="3DCore 3DRender 3DLogic 3DInput 3DAnimation 3DExtras" + ["bluetooth"]="Bluetooth" + ["charts"]="Charts" + ["+concurrent"]="Concurrent" + ["+core"]="Core" + ["+dbus"]="DBus" + ["designer"]="Designer" + ["+gui"]="Gui" + ["help"]="Help" + ["httpserver"]="HttpServer" + ["location"]="Location" + ["multimedia"]="Multimedia" # plus widgets + ["network-auth"]="NetworkAuth" + ["+network"]="Network" + ["nfc"]="Nfc" + ["+opengl"]="OpenGL" # plus widgets + ["pdfium"]="Pdf" # plus widgets + ["positioning"]="Positioning" + ["+printsupport"]="PrintSupport" + ["qml"]="Qml" + ["quick3d"]="Quick3D" + ["quick"]="Quick" # plus widgets + ["remoteobjects"]="RemoteObjects" + ["scxml"]="Scxml" + ["sensors"]="Sensors" + ["serialbus"]="SerialBus" + ["serialport"]="SerialPort" + ["spatialaudio"]="SpatialAudio" + ["+sql"]="Sql" + ["svg"]="Svg" # plus widgets + ["speech"]="TextToSpeech" + ["+testlib"]="Test" + ["uitools"]="UiTools" + ["webchannel"]="WebChannel" + ["webengine"]="WebEngineCore" # plus widgets and quick + ["websockets"]="WebSockets" + ["webview"]="WebView" + ["+widgets"]="Widgets" + ["+xml"]="Xml" +) + +# Manually reextract these requirements on version bumps by running the +# following one-liner from within "${S}": +# $ grep 'set.*_deps' PySide6/Qt*/CMakeLists.txt +declare -A QT_REQUIREMENTS=( + ["3d"]="gui network opengl" + ["bluetooth"]="core" + ["charts"]="core gui widgets" + ["concurrent"]="core" + ["dbus"]="core" + ["designer"]="widgets" + ["gles2-only"]="gui" + ["gui"]="core" + ["help"]="widgets" + ["httpserver"]="core concurrent network websockets" + ["location"]="core positioning" + ["multimedia"]="core gui network" + ["network-auth"]="network" + ["network"]="core" + ["nfc"]="core" + ["opengl"]="gui" + ["pdfium"]="core gui network" + ["positioning"]="core" + ["printsupport"]="widgets" + ["qml"]="network" + ["quick"]="gui network qml opengl" + ["quick3d"]="gui network qml quick" + ["remoteobjects"]="core network" + ["scxml"]="core" + ["sensors"]="core" + ["serialbus"]="core network serialport" + ["serialport"]="core" + ["spatialaudio"]="core gui network multimedia" + ["speech"]="core multimedia" + ["sql"]="widgets" + ["svg"]="gui" + ["testlib"]="widgets" + ["uitools"]="widgets" + ["webchannel"]="core" + ["webengine"]="core gui network printsupport quick webchannel" + ["websockets"]="network" + ["webview"]="gui quick webengine" + ["widgets"]="gui" + ["xml"]="core" +) + +IUSE="${!QT_MODULES[*]} debug doc gles2-only numpy test tools" +RESTRICT="!test? ( test )" + +# majority of QtQml tests require QtQuick support +REQUIRED_USE=" + test? ( + qml? ( quick ) + ) +" +for requirement in "${!QT_REQUIREMENTS[@]}"; do + REQUIRED_USE+=" ${requirement}? ( ${QT_REQUIREMENTS[${requirement}]} ) " +done + +# Minimal supported version of Qt. +QT_PV="$(ver_cut 1-3)*:6" + +# WebEngine needs sound support, so enable either pulseaudio or alsa +RDEPEND=" + dev-libs/libxml2:= + dev-libs/libxslt + =dev-qt/qtbase-${QT_PV}[concurrent?,dbus?,gles2-only=,network?,opengl?,sql?,widgets?,xml?] + $(llvm_gen_dep ' + llvm-core/clang:${LLVM_SLOT} + ') + 3d? ( =dev-qt/qt3d-${QT_PV}[qml?,gles2-only=] ) + bluetooth? ( =dev-qt/qtconnectivity-${QT_PV}[bluetooth] ) + charts? ( =dev-qt/qtcharts-${QT_PV} ) + designer? ( =dev-qt/qttools-${QT_PV}[designer,widgets,gles2-only=] ) + gui? ( + =dev-qt/qtbase-${QT_PV}[gui,jpeg(+)] + x11-libs/libxkbcommon + ) + help? ( =dev-qt/qttools-${QT_PV}[assistant,gles2-only=] ) + httpserver? ( =dev-qt/qthttpserver-${QT_PV} ) + location? ( =dev-qt/qtlocation-${QT_PV} ) + multimedia? ( =dev-qt/qtmultimedia-${QT_PV}[widgets(+)?] ) + network? ( =dev-qt/qtbase-${QT_PV}[ssl] ) + network-auth? ( =dev-qt/qtnetworkauth-${QT_PV} ) + nfc? ( =dev-qt/qtconnectivity-${QT_PV}[nfc] ) + numpy? ( >=dev-python/numpy-2.1.3[${PYTHON_USEDEP}] ) + pdfium? ( =dev-qt/qtwebengine-${QT_PV}[pdfium(-),widgets?] ) + positioning? ( =dev-qt/qtpositioning-${QT_PV} ) + printsupport? ( =dev-qt/qtbase-${QT_PV}[gui,widgets] ) + qml? ( =dev-qt/qtdeclarative-${QT_PV}[opengl?,widgets?] ) + quick3d? ( =dev-qt/qtquick3d-${QT_PV}[opengl?] ) + remoteobjects? ( =dev-qt/qtremoteobjects-${QT_PV} ) + scxml? ( =dev-qt/qtscxml-${QT_PV} ) + sensors? ( =dev-qt/qtsensors-${QT_PV}[qml?] ) + speech? ( =dev-qt/qtspeech-${QT_PV} ) + serialbus? ( =dev-qt/qtserialbus-${QT_PV} ) + serialport? ( =dev-qt/qtserialport-${QT_PV} ) + svg? ( =dev-qt/qtsvg-${QT_PV} ) + testlib? ( =dev-qt/qtbase-${QT_PV}[gui] ) + tools? ( + =dev-qt/qtbase-${QT_PV} + =dev-qt/qtdeclarative-${QT_PV}[qmlls] + =dev-qt/qttools-${QT_PV}[assistant,designer,linguist] + dev-python/pkginfo[${PYTHON_USEDEP}] + ) + uitools? ( =dev-qt/qttools-${QT_PV}[gles2-only=,widgets] ) + webchannel? ( =dev-qt/qtwebchannel-${QT_PV} ) + webengine? ( || ( + =dev-qt/qtwebengine-${QT_PV}[alsa,widgets?] + =dev-qt/qtwebengine-${QT_PV}[pulseaudio,widgets?] + ) + ) + websockets? ( =dev-qt/qtwebsockets-${QT_PV} ) + webview? ( =dev-qt/qtwebview-${QT_PV} ) + !dev-python/pyside:0 + !dev-python/shiboken6 + !dev-python/pyside6-tools +" + +DEPEND="${RDEPEND} + $(llvm_gen_dep ' + llvm-core/clang:${LLVM_SLOT} + llvm-core/llvm:${LLVM_SLOT} + ') + dev-util/vulkan-headers + test? ( =dev-qt/qtbase-${QT_PV}[gui] ) +" # testlib is toggled by the gui flag on qtbase + +BDEPEND=" + dev-build/cmake + dev-python/distro[${PYTHON_USEDEP}] + dev-python/wheel[${PYTHON_USEDEP}] + dev-util/patchelf + doc? ( + >=dev-libs/libxml2-2.6.32 + >=dev-libs/libxslt-1.1.19 + media-gfx/graphviz + dev-python/sphinx[${PYTHON_USEDEP}] + dev-python/myst-parser[${PYTHON_USEDEP}] + ) + numpy? ( dev-python/numpy[${PYTHON_USEDEP}] ) +" + +PATCHES=( + "${FILESDIR}/${PN}-6.10.2-quick-fix-build-wheel.patch" + "${FILESDIR}/${PN}-6.10.0-dont-vendor-ffmpeg.patch" + "${FILESDIR}/${PN}-6.10.1-pass-ninja-opts.patch" +) + +# Build system duplicates system libraries. TODO: fix +QA_PREBUILT=( + "/usr/lib/python*/site-packages/PySide6/*" +) + +python_prepare_all() { + distutils-r1_python_prepare_all + + # Shiboken6 assumes Vulkan headers live under either "$VULKAN_SDK/include" + # or "$VK_SDK_PATH/include" rather than "${EPREFIX}/usr/include/vulkan". + sed -i -e "s~\bdetectVulkan(&headerPaths);~headerPaths.append(HeaderPath{QByteArrayLiteral(\"${EPREFIX}/usr/include/vulkan\"), HeaderType::System});~" \ + sources/shiboken6/ApiExtractor/clangparser/compilersupport.cpp || die + + # Shiboken6 assumes the "/usr/lib/clang/${CLANG_NEWEST_VERSION}/include/" + # subdirectory provides Clang builtin includes (e.g., "stddef.h") for the + # currently installed version of Clang, where ${CLANG_NEWEST_VERSION} is + # the largest version specifier that exists under the "/usr/lib/clang/" + # subdirectory. This assumption is false in edge cases, including when + # users downgrade from newer Clang versions but fail to remove those + # versions with "emerge --depclean". See also: + # https://github.com/leycec/raiagent/issues/85 + # + # Sadly, the clang-* family of functions exported by the "toolchain-funcs" + # eclass are defective, returning nonsensical placeholder strings if the + # end user has *NOT* explicitly configured their C++ compiler to be Clang. + # PySide6 does *NOT* care whether the end user has done so or not, as + # PySide6 unconditionally requires Clang in either case. See also: + # https://bugs.gentoo.org/619490 + sed -e \ + 's~(findClangBuiltInIncludesDir())~(QStringLiteral("'"${EPREFIX}"'/usr/lib/clang/'"${LLVM_SLOT}"'/include"))~' \ + -i sources/shiboken6/ApiExtractor/clangparser/compilersupport.cpp || die + + sed -e \ + 's~set(libclang_directory_suffix "lib")~set(libclang_directory_suffix "'"$(get_libdir)"'")~' \ + -i sources/shiboken6/cmake/ShibokenHelpers.cmake || die + + # blacklist.txt works like XFAIL + cat <<- EOF >> build_history/blacklist.txt || die + # segfaults with QOpenGLContext::create + [pysidetest::qapp_like_a_macro_test] + linux + # no mypy + [pysidetest::mypy_correctness_test] + linux + # Tries to execute pip install + [pyside6-deploy::test_pyside6_deploy] + linux + [pyside6-android-deploy::test_pyside6_android_deploy] + linux + # Behavior changed and test not changed to accomodate + # https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-3135 + [registry::existence_test] + linux + # Doesn't appear to play well with virtualx as it tries to use wayland + [QtUiTools::loadUiType_test] + linux + # py3.14? + [sample::multiple_derived] + linux + EOF + + if ! use numpy; then + cat <<- EOF >> build_history/blacklist.txt || die + # Requires numpy support to pass + [sample::array_numpy] + linux + [sample::nontypetemplate] + linux + [QtGui::qpainter_test] + linux + [QtCore::qrangemodel_test] + linux + EOF + fi +} + +python_configure_all() { + export LLVM_INSTALL_DIR="$(get_llvm_prefix)" + + # see pyside-6.10.1-pass-ninja-opts.patch + export NINJAOPTS="$(get_NINJAOPTS)" + + ENABLED_QT_MODULES=() + + # The order matters, dependencies must come first so process + # REQUIRED_USE and recursively enable modules + enable_qt_mod() { + local flag=${1} + local modules=${QT_MODULES[${flag}]} + if [[ -z ${modules} ]]; then + die "incorrect flag=${flag}, not registered" + fi + local dependencies=${QT_REQUIREMENTS[${flag//+}]} + if [[ -n ${dependencies} ]]; then + local depflag + for depflag in ${dependencies}; do + if use "${depflag}"; then + if [[ -z ${QT_MODULES[${depflag}]} ]]; then + depflag=+${depflag} + fi + enable_qt_mod "${depflag}" + else + die "${depflag} is required but not enabled" + fi + done + fi + if [[ "${ENABLED_QT_MODULES[*]}" != *${modules}* ]]; then + # modules is whitespace separated. We expand implicitly. + ENABLED_QT_MODULES+=( ${modules} ) + fi + } + # Enable specified qt modules + local flag + for flag in "${!QT_MODULES[@]}"; do + if use "${flag//+}"; then + enable_qt_mod "${flag}" + fi + done + + # Special cases + if use widgets; then + use multimedia && ENABLED_QT_MODULES+=( MultimediaWidgets ) + use opengl && ENABLED_QT_MODULES+=( OpenGLWidgets ) + use pdfium && ENABLED_QT_MODULES+=( PdfWidgets ) + use quick && ENABLED_QT_MODULES+=( QuickWidgets ) + use svg && ENABLED_QT_MODULES+=( SvgWidgets ) + use webengine && ENABLED_QT_MODULES+=( WebEngineWidgets ) + fi + if use quick; then + use webengine && ENABLED_QT_MODULES+=( WebEngineQuick ) + use testlib && ENABLED_QT_MODULES+=( QuickTest ) + fi + + # Arguments listed in options.py + MAIN_DISTUTILS_ARGS=( + --cmake="${ESYSROOT}/usr/bin/cmake" + --ignore-git + --limited-api=no + --module-subset="$(printf '%s,' "${ENABLED_QT_MODULES[@]}")" + --no-strip + --no-size-optimization + --openssl="${ESYSROOT}/usr/bin/openssl" + --qt="$(ver_cut 1-3)" + --qtpaths="$(qt6_get_bindir)/qtpaths" + --verbose-build + --parallel="$(makeopts_jobs)" + "$(usex debug "--debug" "--relwithdebinfo")" + "--$(usex doc "build" "skip")-docs" + "--$(usex numpy "enable" "disable")-numpy-support" + ) + + if use test; then + MAIN_DISTUTILS_ARGS+=( + "--build-tests" + "--use-xvfb" + ) + fi + + if ! use tools; then + MAIN_DISTUTILS_ARGS+=( + "--no-qt-tools" + ) + fi +} + +python_compile() { + DISTUTILS_ARGS=( + "${MAIN_DISTUTILS_ARGS[@]}" + --build-type=shiboken6 + ) + distutils-r1_python_compile + + # The build system uses its own build dir, find the name of this dir. + local pyside_build_dir + read -r pyside_build_dir < <( + find "${BUILD_DIR}/build$((${#DISTUTILS_WHEELS[@]}-1))" \ + -maxdepth 1 -type d -name 'qfp*-py*-qt*-*' -printf "%f\n" + ) + export pyside_build_id="${pyside_build_dir#"qfp$(usev debug d)-py${EPYTHON#python}-qt$(ver_cut 1-3)-"}" + export PYTHONPATH="${BUILD_DIR}/build$((${#DISTUTILS_WHEELS[@]}-1))/${pyside_build_dir}/install/lib/${EPYTHON}/site-packages:${PYTHONPATH}" + + DISTUTILS_ARGS=( + "${MAIN_DISTUTILS_ARGS[@]}" + --reuse-build + --shiboken-target-path="${BUILD_DIR}/build$((${#DISTUTILS_WHEELS[@]}-1))/${pyside_build_dir}/install" + --build-type=shiboken6-generator + ) + distutils-r1_python_compile + export PYTHONPATH="${BUILD_DIR}/build$((${#DISTUTILS_WHEELS[@]}-1))/${pyside_build_dir}/install/lib/${EPYTHON}/site-packages:${PYTHONPATH}" + + # If no pyside modules enabled, build just shiboken + if [[ ${#ENABLED_QT_MODULES[@]} -gt 0 ]]; then + DISTUTILS_ARGS=( + "${MAIN_DISTUTILS_ARGS[@]}" + --reuse-build + --shiboken-target-path="${BUILD_DIR}/build$((${#DISTUTILS_WHEELS[@]}-1))/${pyside_build_dir}/install" + --build-type=pyside6 + ) + distutils-r1_python_compile + export PYTHONPATH="${BUILD_DIR}/build$((${#DISTUTILS_WHEELS[@]}-1))/${pyside_build_dir}/install/lib/${EPYTHON}/site-packages:${PYTHONPATH}" + fi + + # Link libraries to the usual location for backwards compatibility + pushd "${BUILD_DIR}/install/$(python_get_sitedir)" >/dev/null || + die + mkdir -p "${BUILD_DIR}/install/usr/$(get_libdir)" || die + local lib + for lib in */*.cpython-*.so + do + local base=${lib##*/} + ln -s "${base}" "${lib%/*}/${base%%.*}-${EPYTHON}.so" || + die + done + for lib in */*.cpython-*.so."$(ver_cut 1-2)" + do + local base=${lib##*/} + ln -s "${base}" "${lib%/*}/${base%%.*}-${EPYTHON}.so.$(ver_cut 1-2)" || + die + done + for lib in */*.so*; do + ln -s "../../$(python_get_sitedir)/${lib}" \ + "${BUILD_DIR}/install/usr/$(get_libdir)/${lib#*/}" || die + done + popd >/dev/null || die + + # Symlinks for compatibility with pypi wheels + local dir + if [[ -d ${BUILD_DIR}/install/$(python_get_sitedir)/PySide6 ]] + then + pushd "${BUILD_DIR}/install/$(python_get_sitedir)/PySide6" \ + >/dev/null || die + mkdir -p "${BUILD_DIR}/install/usr/share/PySide6" || die + for dir in doc glue typesystems; do + ln -s "../../../$(python_get_sitedir)/PySide6/${dir}" \ + "${BUILD_DIR}/install/usr/share/PySide6/${dir}" || + die + done + popd >/dev/null || die + fi + mkdir -p "${BUILD_DIR}/install/usr/include" + for dir in PySide6 shiboken6 shiboken6_generator; do + if [[ -d ${BUILD_DIR}/install/$(python_get_sitedir)/${dir}/include ]] + then + ln -s "../../$(python_get_sitedir)/${dir}/include" \ + "${BUILD_DIR}/install/usr/include/${dir//_generator}" || + die + fi + done + + # Install misc files from inner install dir + find "${BUILD_DIR}"/build*/"${pyside_build_dir}"/install -type f \ + -name libPySidePlugin.so -exec \ + mkdir -p "${BUILD_DIR}/install/$(qt6_get_plugindir)/designer/" \; \ + -exec \ + cp "{}" "${BUILD_DIR}/install/$(qt6_get_plugindir)/designer/" \; \ + || die + + for dir in cmake pkgconfig; do + find "${BUILD_DIR}"/build*/"${pyside_build_dir}"/install -type d -name "${dir}" \ + -exec cp -r "{}" "${BUILD_DIR}/install/usr/lib/" \; \ + || die + done + + # Uniquify the pkgconfigs file for the current Python target, + # preserving an unversioned "shiboken6.pc" file arbitrarily + # associated with the last Python target. + if [[ -f ${BUILD_DIR}/install/usr/lib/pkgconfig/shiboken6.pc ]] + then + sed -e 's~prefix=.*~prefix=/usr~g' \ + -e 's~exec_prefix=.*~exec_prefix=${prefix}~g' \ + -e "s~libdir=.*~libdir=$(python_get_sitedir)/shiboken6~g" \ + -e "s~includedir=.*~includedir=$(python_get_sitedir)/shiboken6_generator/include~g" \ + -i "${BUILD_DIR}/install/usr/lib/pkgconfig/shiboken6.pc" || die + cp "${BUILD_DIR}/install/usr/lib/pkgconfig/"shiboken6{,-${EPYTHON}}.pc || die + fi + if [[ -f ${BUILD_DIR}/install/usr/lib/pkgconfig/pyside6.pc ]] + then + sed -e 's~^Requires: shiboken6$~&-'${EPYTHON}'~' \ + -e 's~prefix=.*~prefix=/usr~g' \ + -e 's~exec_prefix=.*~exec_prefix=${prefix}~g' \ + -e "s~libdir=.*~libdir=$(python_get_sitedir)/PySide6~g" \ + -e "s~includedir=.*~includedir=$(python_get_sitedir)/PySide6/include~g" \ + -e "s~typesystemdir=.*~typesystemdir=$(python_get_sitedir)/PySide6/typesystems~g" \ + -e "s~gluedir=.*~gluedir=$(python_get_sitedir)/PySide6/glue~g" \ + -e "s~pythonpath=.*~pythonpath=$(python_get_sitedir)~g" \ + -i "${BUILD_DIR}/install/usr/lib/pkgconfig/pyside6.pc" || die + cp "${BUILD_DIR}/install/usr/lib/pkgconfig/"pyside6{,-${EPYTHON}}.pc || die + fi + + # _IMPORT_PREFIX breaks on split-usr/merged-usr plus weird random issues. + # These are not duplicates, the generated files are somehow different on + # different systems. + sed \ + -e "s~\${_IMPORT_PREFIX}/lib/libshiboken6\.cpython~/usr/$(get_libdir)/libshiboken6\.cpython~g" \ + -e "s~\${_IMPORT_PREFIX}/shiboken6/libshiboken6\.cpython~/usr/$(get_libdir)/libshiboken6\.cpython~g" \ + -e "s~\${_IMPORT_PREFIX}/bin/shiboken6~/usr/bin/shiboken6~g" \ + -e "s~\${_IMPORT_PREFIX}/shiboken6_generator/shiboken6~/usr/bin/shiboken6~g" \ + -e "s~\${_IMPORT_PREFIX}/lib/libpyside6\.cpython~/usr/$(get_libdir)/libpyside6\.cpython~g" \ + -e "s~\${_IMPORT_PREFIX}/PySide6/libpyside6\.cpython~/usr/$(get_libdir)/libpyside6\.cpython~g" \ + -e "s~\${_IMPORT_PREFIX}/lib/libpyside6qml\.cpython~/usr/$(get_libdir)/libpyside6qml\.cpython~g" \ + -e "s~\${_IMPORT_PREFIX}/PySide6/libpyside6qml\.cpython~/usr/$(get_libdir)/libpyside6qml\.cpython~g" \ + -e "s~libshiboken6\.cpython.*\.so\.$(ver_cut 1-3)~libshiboken6\${PYTHON_CONFIG_SUFFIX}\.so\.$(ver_cut 1-2)~g" \ + -e "s~libpyside6\.cpython.*\.so\.$(ver_cut 1-3)~libpyside6\${PYTHON_CONFIG_SUFFIX}\.so\.$(ver_cut 1-2)~g" \ + -e "s~libpyside6qml\.cpython.*\.so\.$(ver_cut 1-3)~libpyside6qml\${PYTHON_CONFIG_SUFFIX}\.so\.$(ver_cut 1-2)~g" \ + -e "s~libshiboken6\.cpython.*\.so\.$(ver_cut 1-2)~libshiboken6\${PYTHON_CONFIG_SUFFIX}\.so\.$(ver_cut 1-2)~g" \ + -e "s~libpyside6\.cpython.*\.so\.$(ver_cut 1-2)~libpyside6\${PYTHON_CONFIG_SUFFIX}\.so\.$(ver_cut 1-2)~g" \ + -e "s~libpyside6qml\.cpython.*\.so\.$(ver_cut 1-2)~libpyside6qml\${PYTHON_CONFIG_SUFFIX}\.so\.$(ver_cut 1-2)~g" \ + -e "s~\${PACKAGE_PREFIX_DIR}/~\${PACKAGE_PREFIX_DIR}/share/PySide6/~g" \ + -e "s~\${_IMPORT_PREFIX}/shiboken6/include~/usr/include/shiboken6~g" \ + -e "s~\${_IMPORT_PREFIX}/PySide6/include~/usr/include/PySide6~g" \ + -i "${BUILD_DIR}/install/usr/lib/cmake/"*/*.cmake || die + local file + for file in "${BUILD_DIR}/install/usr/lib/cmake/"*/*.cpython-*.cmake + do + local base=${file##*/} + ln -s "${base}" "${file%/*}/${base%%.*}-${EPYTHON}.cmake" || + die + done +} + +python_test() { + # Otherwise it picks the last built directory breaking assumption for multi target builds + local pyside_build_dir="qfp$(usev debug d)-py${EPYTHON#python}-qt$(ver_cut 1-3)-${pyside_build_id}" + + local buildno=$(find "${BUILD_DIR}"/build* -name "${pyside_build_dir}" | sort -V | tail -n1) + if [[ -z "${buildno}" ]]; then + die "could not find any build directories for ${pyside_build_dir}" + fi + + buildno="${buildno#"${BUILD_DIR}/build"}" + buildno="${buildno%"/${pyside_build_dir}"}" + + local -x PYTHONPATH="${BUILD_DIR}/install$(python_get_sitedir)" + local -x QTEST_ENVIRONMENT=ci + + # test shiboken6 build + virtx ${EPYTHON} testrunner.py test --buildno "$((buildno - 1))" --projects=shiboken6 || + die "Tests failed with ${EPYTHON}" + + if use core; then + # test pyside6 build + virtx ${EPYTHON} testrunner.py test --buildno "${buildno}" --projects=pyside6 || + die "Tests failed with ${EPYTHON}" + fi +} + +pkg_preinst() { + # Avoid symlinks being blocked by directories + rm -rf "${EROOT}/usr/include/"{PySide6,shiboken6} || die + rm -rf "${EROOT}/usr/share/PySide6" || die +} diff --git a/dev-python/pyside/pyside-6.11.1-r1.ebuild b/dev-python/pyside/pyside-6.11.1-r1.ebuild new file mode 100644 index 000000000000..02c5cf55b5df --- /dev/null +++ b/dev-python/pyside/pyside-6.11.1-r1.ebuild @@ -0,0 +1,610 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# NOTE: We combine here several PyPI packages, we do this because +# pyside can and does break if it is compiled with a different +# toolchain then was used to build shiboken. This bundling ensures +# that we always use the same toolchain for all components. + +EAPI=8 + +PYTHON_COMPAT=( python3_{13..14} ) +LLVM_COMPAT=( {18..22} ) +DISTUTILS_USE_PEP517=setuptools +DISTUTILS_EXT=1 + +inherit distutils-r1 llvm-r2 multiprocessing ninja-utils qmake-utils virtualx + +MY_PN=${PN}-setup-everywhere-src +MY_P=${MY_PN}-${PV} + +DESCRIPTION="Python bindings for the Qt framework" +HOMEPAGE="https://wiki.qt.io/PySide6" + +if [[ ${PV} == *.9999 ]]; then + inherit git-r3 + EGIT_REPO_URI=( + "https://code.qt.io/${PN}/${PN}-setup.git" + "https://github.com/qtproject/${PN}-${PN}-setup.git" + ) + EGIT_BRANCH=dev + [[ ${PV} == 6.*.9999 ]] && EGIT_BRANCH=${PV%.9999} +else + SRC_URI="https://download.qt.io/official_releases/QtForPython/${PN}6/PySide6-${PV}-src/${MY_P}.tar.xz" + S="${WORKDIR}/${MY_P}" + KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc64 ~riscv ~x86" +fi + +LICENSE="|| ( GPL-2 GPL-3 LGPL-3 )" +SLOT="6/${PV}" + +# If a flag enables multiple Qt modules, they should be ordered +# according to their dependencies, e.g. for 3d, 3DCore must be first. +# Widgets for various modules are handled as a special case later +declare -A QT_MODULES=( + ["3d"]="3DCore 3DRender 3DLogic 3DInput 3DAnimation 3DExtras" + ["bluetooth"]="Bluetooth" + ["charts"]="Charts" + ["+concurrent"]="Concurrent" + ["+core"]="Core" + ["+dbus"]="DBus" + ["designer"]="Designer" + ["graphs"]="Graphs" # plus widgets + ["+gui"]="Gui" + ["help"]="Help" + ["httpserver"]="HttpServer" + ["location"]="Location" + ["multimedia"]="Multimedia" # plus widgets + ["network-auth"]="NetworkAuth" + ["+network"]="Network" + ["nfc"]="Nfc" + ["+opengl"]="OpenGL" # plus widgets + ["pdfium"]="Pdf" # plus widgets + ["positioning"]="Positioning" + ["+printsupport"]="PrintSupport" + ["qml"]="Qml" + ["quick3d"]="Quick3D" + ["quick"]="Quick" # plus widgets + ["remoteobjects"]="RemoteObjects" + ["scxml"]="Scxml" + ["sensors"]="Sensors" + ["serialbus"]="SerialBus" + ["serialport"]="SerialPort" + ["spatialaudio"]="SpatialAudio" + ["+sql"]="Sql" + ["svg"]="Svg" # plus widgets + ["speech"]="TextToSpeech" + ["+testlib"]="Test" + ["uitools"]="UiTools" + ["webchannel"]="WebChannel" + ["webengine"]="WebEngineCore" # plus widgets and quick + ["websockets"]="WebSockets" + ["webview"]="WebView" + ["+widgets"]="Widgets" + ["+xml"]="Xml" +) + +# Manually reextract these requirements on version bumps by running the +# following one-liner from within "${S}": +# $ grep -E '(set|list).*_deps' sources/pyside6/PySide6/Qt*/CMakeLists.txt +declare -A QT_REQUIREMENTS=( + ["3d"]="gui network" + ["bluetooth"]="core" + ["charts"]="core gui widgets" + ["concurrent"]="core" + ["dbus"]="core" + ["designer"]="widgets" + ["gles2-only"]="gui" + ["graphs"]="core network gui qml quick quick3d" + ["gui"]="core" + ["help"]="widgets" + ["httpserver"]="core concurrent network websockets" + ["location"]="core positioning" + ["multimedia"]="core gui network" + ["network-auth"]="network" + ["network"]="core" + ["nfc"]="core" + ["opengl"]="gui" + ["pdfium"]="core gui network" + ["positioning"]="core" + ["printsupport"]="widgets" + ["qml"]="network" + ["quick"]="gui network qml" + ["quick3d"]="gui network qml quick" + ["remoteobjects"]="core network" + ["scxml"]="core" + ["sensors"]="core" + ["serialbus"]="core network serialport" + ["serialport"]="core" + ["spatialaudio"]="core gui network multimedia" + ["speech"]="core multimedia" + ["sql"]="widgets" + ["svg"]="gui" + ["testlib"]="widgets" + ["uitools"]="widgets" + ["webchannel"]="core" + ["webengine"]="core gui network printsupport webchannel" + ["websockets"]="network" + ["webview"]="gui quick webengine" + ["widgets"]="gui" + ["xml"]="core" +) +# Manually reextract these requirements on version bumps by running the +# following one-liner from within "${S}": +# $ grep 'check_qt_opengl' sources/pyside6/PySide6/Qt*/CMakeLists.txt +declare -a CONDITIONAL_OPENGL=( + 3d graphs quick +) + +IUSE="${!QT_MODULES[*]} debug doc gles2-only numpy test tools" +RESTRICT="!test? ( test )" + +# majority of QtQml tests require QtQuick support +REQUIRED_USE=" + test? ( + qml? ( quick ) + ) +" +for requirement in "${!QT_REQUIREMENTS[@]}"; do + REQUIRED_USE+=" ${requirement}? ( ${QT_REQUIREMENTS[${requirement}]} ) " +done + +# Minimal supported version of Qt. +QT_PV="$(ver_cut 1-3)*:6" + +# USE="tools" is heavily automagic based on what other qt tools are installed at build time. + +# WebEngine needs sound support, so enable either pulseaudio or alsa +RDEPEND=" + dev-libs/libxml2:= + dev-libs/libxslt + =dev-qt/qtbase-${QT_PV}[concurrent?,dbus?,gles2-only=,network?,opengl=,sql?,widgets?,xml?] + $(llvm_gen_dep ' + llvm-core/clang:${LLVM_SLOT} + ') + 3d? ( =dev-qt/qt3d-${QT_PV}[qml?,gles2-only=] ) + bluetooth? ( =dev-qt/qtconnectivity-${QT_PV}[bluetooth] ) + charts? ( =dev-qt/qtcharts-${QT_PV} ) + designer? ( =dev-qt/qttools-${QT_PV}[designer,widgets,gles2-only=] ) + graphs? ( =dev-qt/qtgraphs-${QT_PV}[quick3d] ) + gui? ( + =dev-qt/qtbase-${QT_PV}[gui,jpeg(+)] + x11-libs/libxkbcommon + ) + help? ( =dev-qt/qttools-${QT_PV}[assistant,gles2-only=] ) + httpserver? ( =dev-qt/qthttpserver-${QT_PV} ) + location? ( =dev-qt/qtlocation-${QT_PV} ) + multimedia? ( =dev-qt/qtmultimedia-${QT_PV}[widgets(+)?] ) + network? ( =dev-qt/qtbase-${QT_PV}[ssl] ) + network-auth? ( =dev-qt/qtnetworkauth-${QT_PV} ) + nfc? ( =dev-qt/qtconnectivity-${QT_PV}[nfc] ) + numpy? ( >=dev-python/numpy-2.1.3[${PYTHON_USEDEP}] ) + pdfium? ( =dev-qt/qtwebengine-${QT_PV}[pdfium(-),widgets?] ) + positioning? ( =dev-qt/qtpositioning-${QT_PV} ) + printsupport? ( =dev-qt/qtbase-${QT_PV}[gui,widgets] ) + qml? ( =dev-qt/qtdeclarative-${QT_PV}[opengl?,widgets?] ) + quick3d? ( =dev-qt/qtquick3d-${QT_PV}[opengl?] ) + remoteobjects? ( =dev-qt/qtremoteobjects-${QT_PV} ) + scxml? ( =dev-qt/qtscxml-${QT_PV} ) + sensors? ( =dev-qt/qtsensors-${QT_PV}[qml?] ) + speech? ( =dev-qt/qtspeech-${QT_PV} ) + serialbus? ( =dev-qt/qtserialbus-${QT_PV} ) + serialport? ( =dev-qt/qtserialport-${QT_PV} ) + svg? ( =dev-qt/qtsvg-${QT_PV} ) + testlib? ( =dev-qt/qtbase-${QT_PV}[gui] ) + tools? ( + =dev-qt/qtbase-${QT_PV} + =dev-qt/qtdeclarative-${QT_PV}[qmlls] + =dev-qt/qttools-${QT_PV}[assistant,designer,linguist] + dev-python/pkginfo[${PYTHON_USEDEP}] + ) + uitools? ( =dev-qt/qttools-${QT_PV}[gles2-only=,widgets] ) + webchannel? ( =dev-qt/qtwebchannel-${QT_PV} ) + webengine? ( || ( + =dev-qt/qtwebengine-${QT_PV}[alsa,widgets?] + =dev-qt/qtwebengine-${QT_PV}[pulseaudio,widgets?] + ) + ) + websockets? ( =dev-qt/qtwebsockets-${QT_PV} ) + webview? ( =dev-qt/qtwebview-${QT_PV} ) + !dev-python/pyside:0 + !dev-python/shiboken6 + !dev-python/pyside6-tools +" + +DEPEND="${RDEPEND} + $(llvm_gen_dep ' + llvm-core/clang:${LLVM_SLOT} + llvm-core/llvm:${LLVM_SLOT} + ') + dev-util/vulkan-headers + test? ( =dev-qt/qtbase-${QT_PV}[gui] ) +" # testlib is toggled by the gui flag on qtbase + +BDEPEND=" + dev-build/cmake + dev-python/distro[${PYTHON_USEDEP}] + dev-python/wheel[${PYTHON_USEDEP}] + dev-util/patchelf + doc? ( + >=dev-libs/libxml2-2.6.32 + >=dev-libs/libxslt-1.1.19 + media-gfx/graphviz + dev-python/sphinx[${PYTHON_USEDEP}] + dev-python/myst-parser[${PYTHON_USEDEP}] + ) + numpy? ( dev-python/numpy[${PYTHON_USEDEP}] ) + test? ( dev-python/pkginfo[${PYTHON_USEDEP}] ) +" + +PATCHES=( + "${FILESDIR}/${PN}-6.10.0-dont-vendor-ffmpeg.patch" + "${FILESDIR}/${PN}-6.10.1-pass-ninja-opts.patch" + "${FILESDIR}/${PN}-6.11.0-find-cmake-helpers.patch" + "${FILESDIR}/${PN}-6.11.1-fix-llvm-version.patch" +) + +# Build system duplicates system libraries. TODO: fix +QA_PREBUILT=( + "/usr/lib/python*/site-packages/PySide6/*" +) + +python_prepare_all() { + distutils-r1_python_prepare_all + + # Shiboken6 assumes Vulkan headers live under either "$VULKAN_SDK/include" + # or "$VK_SDK_PATH/include" rather than "${EPREFIX}/usr/include/vulkan". + sed -i -e "s~\bdetectVulkan(&headerPaths);~headerPaths.append(HeaderPath{QByteArrayLiteral(\"${EPREFIX}/usr/include/vulkan\"), HeaderType::System});~" \ + sources/shiboken6_generator/ApiExtractor/clangparser/compilersupport.cpp || die + + # Shiboken6 assumes the "/usr/lib/clang/${CLANG_NEWEST_VERSION}/include/" + # subdirectory provides Clang builtin includes (e.g., "stddef.h") for the + # currently installed version of Clang, where ${CLANG_NEWEST_VERSION} is + # the largest version specifier that exists under the "/usr/lib/clang/" + # subdirectory. This assumption is false in edge cases, including when + # users downgrade from newer Clang versions but fail to remove those + # versions with "emerge --depclean". See also: + # https://github.com/leycec/raiagent/issues/85 + # + # Sadly, the clang-* family of functions exported by the "toolchain-funcs" + # eclass are defective, returning nonsensical placeholder strings if the + # end user has *NOT* explicitly configured their C++ compiler to be Clang. + # PySide6 does *NOT* care whether the end user has done so or not, as + # PySide6 unconditionally requires Clang in either case. See also: + # https://bugs.gentoo.org/619490 + sed -e \ + 's~(findClangBuiltInIncludesDir())~(QStringLiteral("'"${EPREFIX}"'/usr/lib/clang/'"${LLVM_SLOT}"'/include"))~' \ + -i sources/shiboken6_generator/ApiExtractor/clangparser/compilersupport.cpp || die + + sed -e \ + 's~set(libclang_directory_suffix "lib")~set(libclang_directory_suffix "'"$(get_libdir)"'")~' \ + -i sources/shiboken6/cmake/ShibokenHelpers.cmake || die + + # blacklist.txt works like XFAIL + cat <<- EOF >> build_history/blacklist.txt || die + # segfaults with QOpenGLContext::create + [pysidetest::qapp_like_a_macro_test] + linux + # no mypy + [pysidetest::mypy_correctness_test] + linux + # Tries to execute pip install + [pyside6-deploy::test_pyside6_deploy] + linux + [pyside6-android-deploy::test_pyside6_android_deploy] + linux + # Behavior changed and test not changed to accomodate + # https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-3135 + [registry::existence_test] + linux + # Doesn't appear to play well with virtualx as it tries to use wayland + [QtUiTools::loadUiType_test] + linux + # py3.14? + [sample::multiple_derived] + linux + # Doesn't appear to play well with virtualx as it tries to use wayland + [QtWidgets::qapp_issue_585] + linux + EOF + + if ! use numpy; then + cat <<- EOF >> build_history/blacklist.txt || die + # Requires numpy support to pass + [sample::array_numpy] + linux + [sample::nontypetemplate] + linux + [QtGui::qpainter_test] + linux + [QtCore::qrangemodel_test] + linux + [QtGraphs::qgraphs_numpy_test] + linux + EOF + fi +} + +python_configure_all() { + export LLVM_INSTALL_DIR="$(get_llvm_prefix)" + + # see pyside-6.10.1-pass-ninja-opts.patch + export NINJAOPTS="$(get_NINJAOPTS)" + + ENABLED_QT_MODULES=() + + # The order matters, dependencies must come first so process + # REQUIRED_USE and recursively enable modules + enable_qt_mod() { + local flag=${1} + local modules=${QT_MODULES[${flag}]} + if [[ -z ${modules} ]]; then + die "incorrect flag=${flag}, not registered" + fi + local dependencies=${QT_REQUIREMENTS[${flag//+}]} + if [[ -n ${dependencies} ]]; then + local depflag + for depflag in ${dependencies}; do + if use "${depflag}"; then + if [[ -z ${QT_MODULES[${depflag}]} ]]; then + depflag=+${depflag} + fi + enable_qt_mod "${depflag}" + else + die "${depflag} is required but not enabled" + fi + done + if use opengl && [[ ${CONDITIONAL_OPENGL[@]} =~ ${flag//+} ]]; then + # match key in QT_MODULES + enable_qt_mod "+opengl" + fi + fi + if [[ "${ENABLED_QT_MODULES[*]}" != *${modules}* ]]; then + # modules is whitespace separated. We expand implicitly. + ENABLED_QT_MODULES+=( ${modules} ) + fi + } + # Enable specified qt modules + local flag + for flag in "${!QT_MODULES[@]}"; do + if use "${flag//+}"; then + enable_qt_mod "${flag}" + fi + done + + # Special cases + if use widgets; then + use multimedia && ENABLED_QT_MODULES+=( MultimediaWidgets ) + use opengl && ENABLED_QT_MODULES+=( OpenGLWidgets ) + use pdfium && ENABLED_QT_MODULES+=( PdfWidgets ) + use quick && ENABLED_QT_MODULES+=( QuickWidgets ) + use graphs && ENABLED_QT_MODULES+=( GraphsWidgets ) # requires QuickWidgets + use svg && ENABLED_QT_MODULES+=( SvgWidgets ) + use webengine && ENABLED_QT_MODULES+=( WebEngineWidgets ) + fi + if use quick; then + use webengine && ENABLED_QT_MODULES+=( WebEngineQuick ) + use testlib && ENABLED_QT_MODULES+=( QuickTest ) + fi + + # Arguments listed in options.py + MAIN_DISTUTILS_ARGS=( + --cmake="${ESYSROOT}/usr/bin/cmake" + --ignore-git + --limited-api=no + --module-subset="$(printf '%s,' "${ENABLED_QT_MODULES[@]}")" + --no-strip + --no-size-optimization + --openssl="${ESYSROOT}/usr/bin/openssl" + --qt="$(ver_cut 1-3)" + --qtpaths="$(qt6_get_bindir)/qtpaths" + --log-level=verbose + --parallel="$(makeopts_jobs)" + "$(usex debug "--debug" "--relwithdebinfo")" + "--$(usex doc "build" "skip")-docs" + "--$(usex numpy "enable" "disable")-numpy-support" + ) + + if use test; then + MAIN_DISTUTILS_ARGS+=( + "--build-tests" + "--use-xvfb" + ) + fi + + if ! use tools; then + MAIN_DISTUTILS_ARGS+=( + "--no-qt-tools" + ) + fi +} + +python_compile() { + DISTUTILS_ARGS=( + "${MAIN_DISTUTILS_ARGS[@]}" + --build-type=shiboken6-generator + ) + distutils-r1_python_compile + + # The build system uses its own build dir, find the name of this dir. + local pyside_build_dir + read -r pyside_build_dir < <( + find "${BUILD_DIR}/build$((${#DISTUTILS_WHEELS[@]}-1))" \ + -maxdepth 1 -type d -name 'qfp*-py*-qt*-*' -printf "%f\n" + ) + export pyside_build_id="${pyside_build_dir#"qfp$(usev debug d)-py${EPYTHON#python}-qt$(ver_cut 1-3)-"}" + export PYTHONPATH="${BUILD_DIR}/build$((${#DISTUTILS_WHEELS[@]}-1))/${pyside_build_dir}/package:${BUILD_DIR}/build$((${#DISTUTILS_WHEELS[@]}-1))/${pyside_build_dir}/install/lib/${EPYTHON}/site-packages:${PYTHONPATH}" + + DISTUTILS_ARGS=( + "${MAIN_DISTUTILS_ARGS[@]}" + --reuse-build + --shiboken-target-path="${BUILD_DIR}/build$((${#DISTUTILS_WHEELS[@]}-1))/${pyside_build_dir}/package/shiboken6_generator" + --build-type=shiboken6 + ) + distutils-r1_python_compile + export PYTHONPATH="${BUILD_DIR}/build$((${#DISTUTILS_WHEELS[@]}-1))/${pyside_build_dir}/package:${BUILD_DIR}/build$((${#DISTUTILS_WHEELS[@]}-1))/${pyside_build_dir}/install/lib/${EPYTHON}/site-packages:${PYTHONPATH}" + + # Copy shiboken6_generator files to shiboken6 package so we can reuse the shiboken-target-path + rsync -ur "${BUILD_DIR}/build$((${#DISTUTILS_WHEELS[@]}-2))/${pyside_build_dir}/package/shiboken6_generator/"* "${BUILD_DIR}/build$((${#DISTUTILS_WHEELS[@]}-1))/${pyside_build_dir}/package/shiboken6/" || die + ln -s shiboken6 "${BUILD_DIR}/build$((${#DISTUTILS_WHEELS[@]}-1))/${pyside_build_dir}/package/shiboken6_generator" || die + + # If no pyside modules enabled, build just shiboken + if [[ ${#ENABLED_QT_MODULES[@]} -gt 0 ]]; then + DISTUTILS_ARGS=( + "${MAIN_DISTUTILS_ARGS[@]}" + --reuse-build + --shiboken-target-path="${BUILD_DIR}/build$((${#DISTUTILS_WHEELS[@]}-1))/${pyside_build_dir}/package/shiboken6" + --build-type=pyside6 + ) + distutils-r1_python_compile + export PYTHONPATH="${BUILD_DIR}/build$((${#DISTUTILS_WHEELS[@]}-1))/${pyside_build_dir}/package:${BUILD_DIR}/build$((${#DISTUTILS_WHEELS[@]}-1))/${pyside_build_dir}/install/lib/${EPYTHON}/site-packages:${PYTHONPATH}" + fi + + # Link libraries to the usual location for backwards compatibility + pushd "${BUILD_DIR}/install/$(python_get_sitedir)" >/dev/null || + die + mkdir -p "${BUILD_DIR}/install/usr/$(get_libdir)" || die + local lib + for lib in */*.cpython-*.so + do + local base=${lib##*/} + ln -s "${base}" "${lib%/*}/${base%%.*}-${EPYTHON}.so" || + die + done + for lib in */*.cpython-*.so."$(ver_cut 1-2)" + do + local base=${lib##*/} + ln -s "${base}" "${lib%/*}/${base%%.*}-${EPYTHON}.so.$(ver_cut 1-2)" || + die + done + for lib in */*.so*; do + ln -s "../../$(python_get_sitedir)/${lib}" \ + "${BUILD_DIR}/install/usr/$(get_libdir)/${lib#*/}" || die + done + popd >/dev/null || die + + # Symlinks for compatibility with pypi wheels + local dir + if [[ -d ${BUILD_DIR}/install/$(python_get_sitedir)/PySide6 ]] + then + pushd "${BUILD_DIR}/install/$(python_get_sitedir)/PySide6" \ + >/dev/null || die + mkdir -p "${BUILD_DIR}/install/usr/share/PySide6" || die + for dir in doc glue typesystems; do + ln -s "../../../$(python_get_sitedir)/PySide6/${dir}" \ + "${BUILD_DIR}/install/usr/share/PySide6/${dir}" || + die + done + popd >/dev/null || die + fi + mkdir -p "${BUILD_DIR}/install/usr/include" + for dir in PySide6 shiboken6 shiboken6_generator; do + if [[ -d ${BUILD_DIR}/install/$(python_get_sitedir)/${dir}/include ]] + then + ln -s "../../$(python_get_sitedir)/${dir}/include" \ + "${BUILD_DIR}/install/usr/include/${dir//_generator}" || + die + fi + done + + # Install misc files from inner install dir + find "${BUILD_DIR}"/build*/"${pyside_build_dir}"/install -type f \ + -name libPySidePlugin.so -exec \ + mkdir -p "${BUILD_DIR}/install/$(qt6_get_plugindir)/designer/" \; \ + -exec \ + cp "{}" "${BUILD_DIR}/install/$(qt6_get_plugindir)/designer/" \; \ + || die + + for dir in cmake pkgconfig; do + find "${BUILD_DIR}"/build*/"${pyside_build_dir}"/install/lib -type d -path "*/lib/${dir}" \ + -exec cp -nr "{}" "${BUILD_DIR}/install/usr/lib/" \; \ + || die + done + + # Uniquify the pkgconfigs file for the current Python target, + # preserving an unversioned "shiboken6.pc" file arbitrarily + # associated with the last Python target. + if [[ -f ${BUILD_DIR}/install/usr/lib/pkgconfig/shiboken6.pc ]] + then + sed -e 's~prefix=.*~prefix=/usr~g' \ + -e 's~exec_prefix=.*~exec_prefix=${prefix}~g' \ + -e "s~libdir=.*~libdir=$(python_get_sitedir)/shiboken6~g" \ + -e "s~includedir=.*~includedir=$(python_get_sitedir)/shiboken6_generator/include~g" \ + -i "${BUILD_DIR}/install/usr/lib/pkgconfig/shiboken6.pc" || die + cp "${BUILD_DIR}/install/usr/lib/pkgconfig/"shiboken6{,-${EPYTHON}}.pc || die + fi + if [[ -f ${BUILD_DIR}/install/usr/lib/pkgconfig/pyside6.pc ]] + then + sed -e 's~^Requires: shiboken6$~&-'${EPYTHON}'~' \ + -e 's~prefix=.*~prefix=/usr~g' \ + -e 's~exec_prefix=.*~exec_prefix=${prefix}~g' \ + -e "s~libdir=.*~libdir=$(python_get_sitedir)/PySide6~g" \ + -e "s~includedir=.*~includedir=$(python_get_sitedir)/PySide6/include~g" \ + -e "s~typesystemdir=.*~typesystemdir=$(python_get_sitedir)/PySide6/typesystems~g" \ + -e "s~gluedir=.*~gluedir=$(python_get_sitedir)/PySide6/glue~g" \ + -e "s~pythonpath=.*~pythonpath=$(python_get_sitedir)~g" \ + -i "${BUILD_DIR}/install/usr/lib/pkgconfig/pyside6.pc" || die + cp "${BUILD_DIR}/install/usr/lib/pkgconfig/"pyside6{,-${EPYTHON}}.pc || die + fi + + # _IMPORT_PREFIX breaks on split-usr/merged-usr plus weird random issues. + # These are not duplicates, the generated files are somehow different on + # different systems. + sed \ + -e "s~\${_IMPORT_PREFIX}/lib/libshiboken6\.cpython~/usr/$(get_libdir)/libshiboken6\.cpython~g" \ + -e "s~\${_IMPORT_PREFIX}/shiboken6/libshiboken6\.cpython~/usr/$(get_libdir)/libshiboken6\.cpython~g" \ + -e "s~\${_IMPORT_PREFIX}/bin/shiboken6~/usr/bin/shiboken6~g" \ + -e "s~\${_IMPORT_PREFIX}/shiboken6_generator/shiboken6~/usr/bin/shiboken6~g" \ + -e "s~\${_IMPORT_PREFIX}/lib/libpyside6\.cpython~/usr/$(get_libdir)/libpyside6\.cpython~g" \ + -e "s~\${_IMPORT_PREFIX}/PySide6/libpyside6\.cpython~/usr/$(get_libdir)/libpyside6\.cpython~g" \ + -e "s~\${_IMPORT_PREFIX}/lib/libpyside6qml\.cpython~/usr/$(get_libdir)/libpyside6qml\.cpython~g" \ + -e "s~\${_IMPORT_PREFIX}/PySide6/libpyside6qml\.cpython~/usr/$(get_libdir)/libpyside6qml\.cpython~g" \ + -e "s~libshiboken6\.cpython.*\.so\.$(ver_cut 1-3)~libshiboken6\${PYTHON_CONFIG_SUFFIX}\.so\.$(ver_cut 1-2)~g" \ + -e "s~libpyside6\.cpython.*\.so\.$(ver_cut 1-3)~libpyside6\${PYTHON_CONFIG_SUFFIX}\.so\.$(ver_cut 1-2)~g" \ + -e "s~libpyside6qml\.cpython.*\.so\.$(ver_cut 1-3)~libpyside6qml\${PYTHON_CONFIG_SUFFIX}\.so\.$(ver_cut 1-2)~g" \ + -e "s~libshiboken6\.cpython.*\.so\.$(ver_cut 1-2)~libshiboken6\${PYTHON_CONFIG_SUFFIX}\.so\.$(ver_cut 1-2)~g" \ + -e "s~libpyside6\.cpython.*\.so\.$(ver_cut 1-2)~libpyside6\${PYTHON_CONFIG_SUFFIX}\.so\.$(ver_cut 1-2)~g" \ + -e "s~libpyside6qml\.cpython.*\.so\.$(ver_cut 1-2)~libpyside6qml\${PYTHON_CONFIG_SUFFIX}\.so\.$(ver_cut 1-2)~g" \ + -e "s~\${_IMPORT_PREFIX}/shiboken6/include~/usr/include/shiboken6~g" \ + -e "s~\${_IMPORT_PREFIX}/PySide6/include~/usr/include/PySide6~g" \ + -i "${BUILD_DIR}/install/usr/lib/cmake/"*/*.cmake || die + local file + for file in "${BUILD_DIR}/install/usr/lib/cmake/"*/*.cpython-*.cmake + do + local base=${file##*/} + ln -s "${base}" "${file%/*}/${base%%.*}-${EPYTHON}.cmake" || + die + done +} + +python_test() { + # Otherwise it picks the last built directory breaking assumption for multi target builds + local pyside_build_dir="qfp$(usev debug d)-py${EPYTHON#python}-qt$(ver_cut 1-3)-${pyside_build_id}" + + local buildno=$(find "${BUILD_DIR}"/build* -name "${pyside_build_dir}" | sort -V | tail -n1) + if [[ -z "${buildno}" ]]; then + die "could not find any build directories for ${pyside_build_dir}" + fi + + buildno="${buildno#"${BUILD_DIR}/build"}" + buildno="${buildno%"/${pyside_build_dir}"}" + + local -x PYTHONPATH="${BUILD_DIR}/install$(python_get_sitedir)" + local -x QTEST_ENVIRONMENT=ci + + # test shiboken6 build + virtx ${EPYTHON} testrunner.py test --buildno "$((buildno - 1))" --projects=shiboken6 || + die "Tests failed with ${EPYTHON}" + + if use core; then + # test pyside6 build + virtx ${EPYTHON} testrunner.py test --buildno "${buildno}" --projects=pyside6 || + die "Tests failed with ${EPYTHON}" + fi +} + +pkg_preinst() { + # Avoid symlinks being blocked by directories + rm -rf "${EROOT}/usr/include/"{PySide6,shiboken6} || die + rm -rf "${EROOT}/usr/share/PySide6" || die +} diff --git a/dev-python/pyside/pyside-6.9999.ebuild b/dev-python/pyside/pyside-6.9999.ebuild new file mode 100644 index 000000000000..3bbe9443427b --- /dev/null +++ b/dev-python/pyside/pyside-6.9999.ebuild @@ -0,0 +1,608 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# NOTE: We combine here several PyPI packages, we do this because +# pyside can and does break if it is compiled with a different +# toolchain then was used to build shiboken. This bundling ensures +# that we always use the same toolchain for all components. + +EAPI=8 + +PYTHON_COMPAT=( python3_{13..14} ) +LLVM_COMPAT=( {18..22} ) +DISTUTILS_USE_PEP517=setuptools +DISTUTILS_EXT=1 + +inherit distutils-r1 llvm-r2 multiprocessing ninja-utils qmake-utils virtualx + +MY_PN=${PN}-setup-everywhere-src +MY_P=${MY_PN}-${PV} + +DESCRIPTION="Python bindings for the Qt framework" +HOMEPAGE="https://wiki.qt.io/PySide6" + +if [[ ${PV} == *.9999 ]]; then + inherit git-r3 + EGIT_REPO_URI=( + "https://code.qt.io/${PN}/${PN}-setup.git" + "https://github.com/qtproject/${PN}-${PN}-setup.git" + ) + EGIT_BRANCH=dev + [[ ${PV} == 6.*.9999 ]] && EGIT_BRANCH=${PV%.9999} +else + SRC_URI="https://download.qt.io/official_releases/QtForPython/${PN}6/PySide6-${PV}-src/${MY_P}.tar.xz" + S="${WORKDIR}/${MY_P}" + KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc64 ~riscv ~x86" +fi + +LICENSE="|| ( GPL-2 GPL-3 LGPL-3 )" +SLOT="6/${PV}" + +# If a flag enables multiple Qt modules, they should be ordered +# according to their dependencies, e.g. for 3d, 3DCore must be first. +# Widgets for various modules are handled as a special case later +declare -A QT_MODULES=( + ["3d"]="3DCore 3DRender 3DLogic 3DInput 3DAnimation 3DExtras" + ["bluetooth"]="Bluetooth" + ["charts"]="Charts" + ["+concurrent"]="Concurrent" + ["+core"]="Core" + ["+dbus"]="DBus" + ["designer"]="Designer" + ["graphs"]="Graphs" # plus widgets + ["+gui"]="Gui" + ["help"]="Help" + ["httpserver"]="HttpServer" + ["location"]="Location" + ["multimedia"]="Multimedia" # plus widgets + ["network-auth"]="NetworkAuth" + ["+network"]="Network" + ["nfc"]="Nfc" + ["+opengl"]="OpenGL" # plus widgets + ["pdfium"]="Pdf" # plus widgets + ["positioning"]="Positioning" + ["+printsupport"]="PrintSupport" + ["qml"]="Qml" + ["quick3d"]="Quick3D" + ["quick"]="Quick" # plus widgets + ["remoteobjects"]="RemoteObjects" + ["scxml"]="Scxml" + ["sensors"]="Sensors" + ["serialbus"]="SerialBus" + ["serialport"]="SerialPort" + ["spatialaudio"]="SpatialAudio" + ["+sql"]="Sql" + ["svg"]="Svg" # plus widgets + ["speech"]="TextToSpeech" + ["+testlib"]="Test" + ["uitools"]="UiTools" + ["webchannel"]="WebChannel" + ["webengine"]="WebEngineCore" # plus widgets and quick + ["websockets"]="WebSockets" + ["webview"]="WebView" + ["+widgets"]="Widgets" + ["+xml"]="Xml" +) + +# Manually reextract these requirements on version bumps by running the +# following one-liner from within "${S}": +# $ grep -E '(set|list).*_deps' sources/pyside6/PySide6/Qt*/CMakeLists.txt +declare -A QT_REQUIREMENTS=( + ["3d"]="gui network" + ["bluetooth"]="core" + ["charts"]="core gui widgets" + ["concurrent"]="core" + ["dbus"]="core" + ["designer"]="widgets" + ["gles2-only"]="gui" + ["graphs"]="core network gui qml quick quick3d" + ["gui"]="core" + ["help"]="widgets" + ["httpserver"]="core concurrent network websockets" + ["location"]="core positioning" + ["multimedia"]="core gui network" + ["network-auth"]="network" + ["network"]="core" + ["nfc"]="core" + ["opengl"]="gui" + ["pdfium"]="core gui network" + ["positioning"]="core" + ["printsupport"]="widgets" + ["qml"]="network" + ["quick"]="gui network qml" + ["quick3d"]="gui network qml quick" + ["remoteobjects"]="core network" + ["scxml"]="core" + ["sensors"]="core" + ["serialbus"]="core network serialport" + ["serialport"]="core" + ["spatialaudio"]="core gui network multimedia" + ["speech"]="core multimedia" + ["sql"]="widgets" + ["svg"]="gui" + ["testlib"]="widgets" + ["uitools"]="widgets" + ["webchannel"]="core" + ["webengine"]="core gui network printsupport webchannel" + ["websockets"]="network" + ["webview"]="gui quick webengine" + ["widgets"]="gui" + ["xml"]="core" +) +# Manually reextract these requirements on version bumps by running the +# following one-liner from within "${S}": +# $ grep 'check_qt_opengl' sources/pyside6/PySide6/Qt*/CMakeLists.txt +declare -a CONDITIONAL_OPENGL=( + 3d graphs quick +) + +IUSE="${!QT_MODULES[*]} debug doc gles2-only numpy test tools" +RESTRICT="!test? ( test )" + +# majority of QtQml tests require QtQuick support +REQUIRED_USE=" + test? ( + qml? ( quick ) + ) +" +for requirement in "${!QT_REQUIREMENTS[@]}"; do + REQUIRED_USE+=" ${requirement}? ( ${QT_REQUIREMENTS[${requirement}]} ) " +done + +# Minimal supported version of Qt. +QT_PV="$(ver_cut 1-3)*:6" + +# USE="tools" is heavily automagic based on what other qt tools are installed at build time. + +# WebEngine needs sound support, so enable either pulseaudio or alsa +RDEPEND=" + dev-libs/libxml2:= + dev-libs/libxslt + =dev-qt/qtbase-${QT_PV}[concurrent?,dbus?,gles2-only=,network?,opengl=,sql?,widgets?,xml?] + $(llvm_gen_dep ' + llvm-core/clang:${LLVM_SLOT} + ') + 3d? ( =dev-qt/qt3d-${QT_PV}[qml?,gles2-only=] ) + bluetooth? ( =dev-qt/qtconnectivity-${QT_PV}[bluetooth] ) + charts? ( =dev-qt/qtcharts-${QT_PV} ) + designer? ( =dev-qt/qttools-${QT_PV}[designer,widgets,gles2-only=] ) + graphs? ( =dev-qt/qtgraphs-${QT_PV}[quick3d] ) + gui? ( + =dev-qt/qtbase-${QT_PV}[gui,jpeg(+)] + x11-libs/libxkbcommon + ) + help? ( =dev-qt/qttools-${QT_PV}[assistant,gles2-only=] ) + httpserver? ( =dev-qt/qthttpserver-${QT_PV} ) + location? ( =dev-qt/qtlocation-${QT_PV} ) + multimedia? ( =dev-qt/qtmultimedia-${QT_PV}[widgets(+)?] ) + network? ( =dev-qt/qtbase-${QT_PV}[ssl] ) + network-auth? ( =dev-qt/qtnetworkauth-${QT_PV} ) + nfc? ( =dev-qt/qtconnectivity-${QT_PV}[nfc] ) + numpy? ( >=dev-python/numpy-2.1.3[${PYTHON_USEDEP}] ) + pdfium? ( =dev-qt/qtwebengine-${QT_PV}[pdfium(-),widgets?] ) + positioning? ( =dev-qt/qtpositioning-${QT_PV} ) + printsupport? ( =dev-qt/qtbase-${QT_PV}[gui,widgets] ) + qml? ( =dev-qt/qtdeclarative-${QT_PV}[opengl?,widgets?] ) + quick3d? ( =dev-qt/qtquick3d-${QT_PV}[opengl?] ) + remoteobjects? ( =dev-qt/qtremoteobjects-${QT_PV} ) + scxml? ( =dev-qt/qtscxml-${QT_PV} ) + sensors? ( =dev-qt/qtsensors-${QT_PV}[qml?] ) + speech? ( =dev-qt/qtspeech-${QT_PV} ) + serialbus? ( =dev-qt/qtserialbus-${QT_PV} ) + serialport? ( =dev-qt/qtserialport-${QT_PV} ) + svg? ( =dev-qt/qtsvg-${QT_PV} ) + testlib? ( =dev-qt/qtbase-${QT_PV}[gui] ) + tools? ( + =dev-qt/qtbase-${QT_PV} + =dev-qt/qtdeclarative-${QT_PV}[qmlls] + =dev-qt/qttools-${QT_PV}[assistant,designer,linguist] + dev-python/pkginfo[${PYTHON_USEDEP}] + ) + uitools? ( =dev-qt/qttools-${QT_PV}[gles2-only=,widgets] ) + webchannel? ( =dev-qt/qtwebchannel-${QT_PV} ) + webengine? ( || ( + =dev-qt/qtwebengine-${QT_PV}[alsa,widgets?] + =dev-qt/qtwebengine-${QT_PV}[pulseaudio,widgets?] + ) + ) + websockets? ( =dev-qt/qtwebsockets-${QT_PV} ) + webview? ( =dev-qt/qtwebview-${QT_PV} ) + !dev-python/pyside:0 + !dev-python/shiboken6 + !dev-python/pyside6-tools +" + +DEPEND="${RDEPEND} + $(llvm_gen_dep ' + llvm-core/clang:${LLVM_SLOT} + llvm-core/llvm:${LLVM_SLOT} + ') + dev-util/vulkan-headers + test? ( =dev-qt/qtbase-${QT_PV}[gui] ) +" # testlib is toggled by the gui flag on qtbase + +BDEPEND=" + dev-build/cmake + dev-python/distro[${PYTHON_USEDEP}] + dev-python/wheel[${PYTHON_USEDEP}] + dev-util/patchelf + doc? ( + >=dev-libs/libxml2-2.6.32 + >=dev-libs/libxslt-1.1.19 + media-gfx/graphviz + dev-python/sphinx[${PYTHON_USEDEP}] + dev-python/myst-parser[${PYTHON_USEDEP}] + ) + numpy? ( dev-python/numpy[${PYTHON_USEDEP}] ) + test? ( dev-python/pkginfo[${PYTHON_USEDEP}] ) +" + +PATCHES=( + "${FILESDIR}/${PN}-6.10.0-dont-vendor-ffmpeg.patch" + "${FILESDIR}/${PN}-6.10.1-pass-ninja-opts.patch" +) + +# Build system duplicates system libraries. TODO: fix +QA_PREBUILT=( + "/usr/lib/python*/site-packages/PySide6/*" +) + +python_prepare_all() { + distutils-r1_python_prepare_all + + # Shiboken6 assumes Vulkan headers live under either "$VULKAN_SDK/include" + # or "$VK_SDK_PATH/include" rather than "${EPREFIX}/usr/include/vulkan". + sed -i -e "s~\bdetectVulkan(&headerPaths);~headerPaths.append(HeaderPath{QByteArrayLiteral(\"${EPREFIX}/usr/include/vulkan\"), HeaderType::System});~" \ + sources/shiboken6_generator/ApiExtractor/clangparser/compilersupport.cpp || die + + # Shiboken6 assumes the "/usr/lib/clang/${CLANG_NEWEST_VERSION}/include/" + # subdirectory provides Clang builtin includes (e.g., "stddef.h") for the + # currently installed version of Clang, where ${CLANG_NEWEST_VERSION} is + # the largest version specifier that exists under the "/usr/lib/clang/" + # subdirectory. This assumption is false in edge cases, including when + # users downgrade from newer Clang versions but fail to remove those + # versions with "emerge --depclean". See also: + # https://github.com/leycec/raiagent/issues/85 + # + # Sadly, the clang-* family of functions exported by the "toolchain-funcs" + # eclass are defective, returning nonsensical placeholder strings if the + # end user has *NOT* explicitly configured their C++ compiler to be Clang. + # PySide6 does *NOT* care whether the end user has done so or not, as + # PySide6 unconditionally requires Clang in either case. See also: + # https://bugs.gentoo.org/619490 + sed -e \ + 's~(findClangBuiltInIncludesDir())~(QStringLiteral("'"${EPREFIX}"'/usr/lib/clang/'"${LLVM_SLOT}"'/include"))~' \ + -i sources/shiboken6_generator/ApiExtractor/clangparser/compilersupport.cpp || die + + sed -e \ + 's~set(libclang_directory_suffix "lib")~set(libclang_directory_suffix "'"$(get_libdir)"'")~' \ + -i sources/shiboken6/cmake/ShibokenHelpers.cmake || die + + # blacklist.txt works like XFAIL + cat <<- EOF >> build_history/blacklist.txt || die + # segfaults with QOpenGLContext::create + [pysidetest::qapp_like_a_macro_test] + linux + # no mypy + [pysidetest::mypy_correctness_test] + linux + # Tries to execute pip install + [pyside6-deploy::test_pyside6_deploy] + linux + [pyside6-android-deploy::test_pyside6_android_deploy] + linux + # Behavior changed and test not changed to accomodate + # https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-3135 + [registry::existence_test] + linux + # Doesn't appear to play well with virtualx as it tries to use wayland + [QtUiTools::loadUiType_test] + linux + # py3.14? + [sample::multiple_derived] + linux + # Doesn't appear to play well with virtualx as it tries to use wayland + [QtWidgets::qapp_issue_585] + linux + EOF + + if ! use numpy; then + cat <<- EOF >> build_history/blacklist.txt || die + # Requires numpy support to pass + [sample::array_numpy] + linux + [sample::nontypetemplate] + linux + [QtGui::qpainter_test] + linux + [QtCore::qrangemodel_test] + linux + [QtGraphs::qgraphs_numpy_test] + linux + EOF + fi +} + +python_configure_all() { + export LLVM_INSTALL_DIR="$(get_llvm_prefix)" + + # see pyside-6.10.1-pass-ninja-opts.patch + export NINJAOPTS="$(get_NINJAOPTS)" + + ENABLED_QT_MODULES=() + + # The order matters, dependencies must come first so process + # REQUIRED_USE and recursively enable modules + enable_qt_mod() { + local flag=${1} + local modules=${QT_MODULES[${flag}]} + if [[ -z ${modules} ]]; then + die "incorrect flag=${flag}, not registered" + fi + local dependencies=${QT_REQUIREMENTS[${flag//+}]} + if [[ -n ${dependencies} ]]; then + local depflag + for depflag in ${dependencies}; do + if use "${depflag}"; then + if [[ -z ${QT_MODULES[${depflag}]} ]]; then + depflag=+${depflag} + fi + enable_qt_mod "${depflag}" + else + die "${depflag} is required but not enabled" + fi + done + if use opengl && [[ ${CONDITIONAL_OPENGL[@]} =~ ${flag//+} ]]; then + # match key in QT_MODULES + enable_qt_mod "+opengl" + fi + fi + if [[ "${ENABLED_QT_MODULES[*]}" != *${modules}* ]]; then + # modules is whitespace separated. We expand implicitly. + ENABLED_QT_MODULES+=( ${modules} ) + fi + } + # Enable specified qt modules + local flag + for flag in "${!QT_MODULES[@]}"; do + if use "${flag//+}"; then + enable_qt_mod "${flag}" + fi + done + + # Special cases + if use widgets; then + use multimedia && ENABLED_QT_MODULES+=( MultimediaWidgets ) + use opengl && ENABLED_QT_MODULES+=( OpenGLWidgets ) + use pdfium && ENABLED_QT_MODULES+=( PdfWidgets ) + use quick && ENABLED_QT_MODULES+=( QuickWidgets ) + use graphs && ENABLED_QT_MODULES+=( GraphsWidgets ) # requires QuickWidgets + use svg && ENABLED_QT_MODULES+=( SvgWidgets ) + use webengine && ENABLED_QT_MODULES+=( WebEngineWidgets ) + fi + if use quick; then + use webengine && ENABLED_QT_MODULES+=( WebEngineQuick ) + use testlib && ENABLED_QT_MODULES+=( QuickTest ) + fi + + # Arguments listed in options.py + MAIN_DISTUTILS_ARGS=( + --cmake="${ESYSROOT}/usr/bin/cmake" + --ignore-git + --limited-api=no + --module-subset="$(printf '%s,' "${ENABLED_QT_MODULES[@]}")" + --no-strip + --no-size-optimization + --openssl="${ESYSROOT}/usr/bin/openssl" + --qt="$(ver_cut 1-3)" + --qtpaths="$(qt6_get_bindir)/qtpaths" + --log-level=verbose + --parallel="$(makeopts_jobs)" + "$(usex debug "--debug" "--relwithdebinfo")" + "--$(usex doc "build" "skip")-docs" + "--$(usex numpy "enable" "disable")-numpy-support" + ) + + if use test; then + MAIN_DISTUTILS_ARGS+=( + "--build-tests" + "--use-xvfb" + ) + fi + + if ! use tools; then + MAIN_DISTUTILS_ARGS+=( + "--no-qt-tools" + ) + fi +} + +python_compile() { + DISTUTILS_ARGS=( + "${MAIN_DISTUTILS_ARGS[@]}" + --build-type=shiboken6-generator + ) + distutils-r1_python_compile + + # The build system uses its own build dir, find the name of this dir. + local pyside_build_dir + read -r pyside_build_dir < <( + find "${BUILD_DIR}/build$((${#DISTUTILS_WHEELS[@]}-1))" \ + -maxdepth 1 -type d -name 'qfp*-py*-qt*-*' -printf "%f\n" + ) + export pyside_build_id="${pyside_build_dir#"qfp$(usev debug d)-py${EPYTHON#python}-qt$(ver_cut 1-3)-"}" + export PYTHONPATH="${BUILD_DIR}/build$((${#DISTUTILS_WHEELS[@]}-1))/${pyside_build_dir}/package:${BUILD_DIR}/build$((${#DISTUTILS_WHEELS[@]}-1))/${pyside_build_dir}/install/lib/${EPYTHON}/site-packages:${PYTHONPATH}" + + DISTUTILS_ARGS=( + "${MAIN_DISTUTILS_ARGS[@]}" + --reuse-build + --shiboken-target-path="${BUILD_DIR}/build$((${#DISTUTILS_WHEELS[@]}-1))/${pyside_build_dir}/package/shiboken6_generator" + --build-type=shiboken6 + ) + distutils-r1_python_compile + export PYTHONPATH="${BUILD_DIR}/build$((${#DISTUTILS_WHEELS[@]}-1))/${pyside_build_dir}/package:${BUILD_DIR}/build$((${#DISTUTILS_WHEELS[@]}-1))/${pyside_build_dir}/install/lib/${EPYTHON}/site-packages:${PYTHONPATH}" + + # Copy shiboken6_generator files to shiboken6 package so we can reuse the shiboken-target-path + rsync -ur "${BUILD_DIR}/build$((${#DISTUTILS_WHEELS[@]}-2))/${pyside_build_dir}/package/shiboken6_generator/"* "${BUILD_DIR}/build$((${#DISTUTILS_WHEELS[@]}-1))/${pyside_build_dir}/package/shiboken6/" || die + ln -s shiboken6 "${BUILD_DIR}/build$((${#DISTUTILS_WHEELS[@]}-1))/${pyside_build_dir}/package/shiboken6_generator" || die + + # If no pyside modules enabled, build just shiboken + if [[ ${#ENABLED_QT_MODULES[@]} -gt 0 ]]; then + DISTUTILS_ARGS=( + "${MAIN_DISTUTILS_ARGS[@]}" + --reuse-build + --shiboken-target-path="${BUILD_DIR}/build$((${#DISTUTILS_WHEELS[@]}-1))/${pyside_build_dir}/package/shiboken6" + --build-type=pyside6 + ) + distutils-r1_python_compile + export PYTHONPATH="${BUILD_DIR}/build$((${#DISTUTILS_WHEELS[@]}-1))/${pyside_build_dir}/package:${BUILD_DIR}/build$((${#DISTUTILS_WHEELS[@]}-1))/${pyside_build_dir}/install/lib/${EPYTHON}/site-packages:${PYTHONPATH}" + fi + + # Link libraries to the usual location for backwards compatibility + pushd "${BUILD_DIR}/install/$(python_get_sitedir)" >/dev/null || + die + mkdir -p "${BUILD_DIR}/install/usr/$(get_libdir)" || die + local lib + for lib in */*.cpython-*.so + do + local base=${lib##*/} + ln -s "${base}" "${lib%/*}/${base%%.*}-${EPYTHON}.so" || + die + done + for lib in */*.cpython-*.so."$(ver_cut 1-2)" + do + local base=${lib##*/} + ln -s "${base}" "${lib%/*}/${base%%.*}-${EPYTHON}.so.$(ver_cut 1-2)" || + die + done + for lib in */*.so*; do + ln -s "../../$(python_get_sitedir)/${lib}" \ + "${BUILD_DIR}/install/usr/$(get_libdir)/${lib#*/}" || die + done + popd >/dev/null || die + + # Symlinks for compatibility with pypi wheels + local dir + if [[ -d ${BUILD_DIR}/install/$(python_get_sitedir)/PySide6 ]] + then + pushd "${BUILD_DIR}/install/$(python_get_sitedir)/PySide6" \ + >/dev/null || die + mkdir -p "${BUILD_DIR}/install/usr/share/PySide6" || die + for dir in doc glue typesystems; do + ln -s "../../../$(python_get_sitedir)/PySide6/${dir}" \ + "${BUILD_DIR}/install/usr/share/PySide6/${dir}" || + die + done + popd >/dev/null || die + fi + mkdir -p "${BUILD_DIR}/install/usr/include" + for dir in PySide6 shiboken6 shiboken6_generator; do + if [[ -d ${BUILD_DIR}/install/$(python_get_sitedir)/${dir}/include ]] + then + ln -s "../../$(python_get_sitedir)/${dir}/include" \ + "${BUILD_DIR}/install/usr/include/${dir//_generator}" || + die + fi + done + + # Install misc files from inner install dir + find "${BUILD_DIR}"/build*/"${pyside_build_dir}"/install -type f \ + -name libPySidePlugin.so -exec \ + mkdir -p "${BUILD_DIR}/install/$(qt6_get_plugindir)/designer/" \; \ + -exec \ + cp "{}" "${BUILD_DIR}/install/$(qt6_get_plugindir)/designer/" \; \ + || die + + for dir in cmake pkgconfig; do + find "${BUILD_DIR}"/build*/"${pyside_build_dir}"/install/lib -type d -path "*/lib/${dir}" \ + -exec cp -nr "{}" "${BUILD_DIR}/install/usr/lib/" \; \ + || die + done + + # Uniquify the pkgconfigs file for the current Python target, + # preserving an unversioned "shiboken6.pc" file arbitrarily + # associated with the last Python target. + if [[ -f ${BUILD_DIR}/install/usr/lib/pkgconfig/shiboken6.pc ]] + then + sed -e 's~prefix=.*~prefix=/usr~g' \ + -e 's~exec_prefix=.*~exec_prefix=${prefix}~g' \ + -e "s~libdir=.*~libdir=$(python_get_sitedir)/shiboken6~g" \ + -e "s~includedir=.*~includedir=$(python_get_sitedir)/shiboken6_generator/include~g" \ + -i "${BUILD_DIR}/install/usr/lib/pkgconfig/shiboken6.pc" || die + cp "${BUILD_DIR}/install/usr/lib/pkgconfig/"shiboken6{,-${EPYTHON}}.pc || die + fi + if [[ -f ${BUILD_DIR}/install/usr/lib/pkgconfig/pyside6.pc ]] + then + sed -e 's~^Requires: shiboken6$~&-'${EPYTHON}'~' \ + -e 's~prefix=.*~prefix=/usr~g' \ + -e 's~exec_prefix=.*~exec_prefix=${prefix}~g' \ + -e "s~libdir=.*~libdir=$(python_get_sitedir)/PySide6~g" \ + -e "s~includedir=.*~includedir=$(python_get_sitedir)/PySide6/include~g" \ + -e "s~typesystemdir=.*~typesystemdir=$(python_get_sitedir)/PySide6/typesystems~g" \ + -e "s~gluedir=.*~gluedir=$(python_get_sitedir)/PySide6/glue~g" \ + -e "s~pythonpath=.*~pythonpath=$(python_get_sitedir)~g" \ + -i "${BUILD_DIR}/install/usr/lib/pkgconfig/pyside6.pc" || die + cp "${BUILD_DIR}/install/usr/lib/pkgconfig/"pyside6{,-${EPYTHON}}.pc || die + fi + + # _IMPORT_PREFIX breaks on split-usr/merged-usr plus weird random issues. + # These are not duplicates, the generated files are somehow different on + # different systems. + sed \ + -e "s~\${_IMPORT_PREFIX}/lib/libshiboken6\.cpython~/usr/$(get_libdir)/libshiboken6\.cpython~g" \ + -e "s~\${_IMPORT_PREFIX}/shiboken6/libshiboken6\.cpython~/usr/$(get_libdir)/libshiboken6\.cpython~g" \ + -e "s~\${_IMPORT_PREFIX}/bin/shiboken6~/usr/bin/shiboken6~g" \ + -e "s~\${_IMPORT_PREFIX}/shiboken6_generator/shiboken6~/usr/bin/shiboken6~g" \ + -e "s~\${_IMPORT_PREFIX}/lib/libpyside6\.cpython~/usr/$(get_libdir)/libpyside6\.cpython~g" \ + -e "s~\${_IMPORT_PREFIX}/PySide6/libpyside6\.cpython~/usr/$(get_libdir)/libpyside6\.cpython~g" \ + -e "s~\${_IMPORT_PREFIX}/lib/libpyside6qml\.cpython~/usr/$(get_libdir)/libpyside6qml\.cpython~g" \ + -e "s~\${_IMPORT_PREFIX}/PySide6/libpyside6qml\.cpython~/usr/$(get_libdir)/libpyside6qml\.cpython~g" \ + -e "s~libshiboken6\.cpython.*\.so\.$(ver_cut 1-3)~libshiboken6\${PYTHON_CONFIG_SUFFIX}\.so\.$(ver_cut 1-2)~g" \ + -e "s~libpyside6\.cpython.*\.so\.$(ver_cut 1-3)~libpyside6\${PYTHON_CONFIG_SUFFIX}\.so\.$(ver_cut 1-2)~g" \ + -e "s~libpyside6qml\.cpython.*\.so\.$(ver_cut 1-3)~libpyside6qml\${PYTHON_CONFIG_SUFFIX}\.so\.$(ver_cut 1-2)~g" \ + -e "s~libshiboken6\.cpython.*\.so\.$(ver_cut 1-2)~libshiboken6\${PYTHON_CONFIG_SUFFIX}\.so\.$(ver_cut 1-2)~g" \ + -e "s~libpyside6\.cpython.*\.so\.$(ver_cut 1-2)~libpyside6\${PYTHON_CONFIG_SUFFIX}\.so\.$(ver_cut 1-2)~g" \ + -e "s~libpyside6qml\.cpython.*\.so\.$(ver_cut 1-2)~libpyside6qml\${PYTHON_CONFIG_SUFFIX}\.so\.$(ver_cut 1-2)~g" \ + -e "s~\${_IMPORT_PREFIX}/shiboken6/include~/usr/include/shiboken6~g" \ + -e "s~\${_IMPORT_PREFIX}/PySide6/include~/usr/include/PySide6~g" \ + -i "${BUILD_DIR}/install/usr/lib/cmake/"*/*.cmake || die + local file + for file in "${BUILD_DIR}/install/usr/lib/cmake/"*/*.cpython-*.cmake + do + local base=${file##*/} + ln -s "${base}" "${file%/*}/${base%%.*}-${EPYTHON}.cmake" || + die + done +} + +python_test() { + # Otherwise it picks the last built directory breaking assumption for multi target builds + local pyside_build_dir="qfp$(usev debug d)-py${EPYTHON#python}-qt$(ver_cut 1-3)-${pyside_build_id}" + + local buildno=$(find "${BUILD_DIR}"/build* -name "${pyside_build_dir}" | sort -V | tail -n1) + if [[ -z "${buildno}" ]]; then + die "could not find any build directories for ${pyside_build_dir}" + fi + + buildno="${buildno#"${BUILD_DIR}/build"}" + buildno="${buildno%"/${pyside_build_dir}"}" + + local -x PYTHONPATH="${BUILD_DIR}/install$(python_get_sitedir)" + local -x QTEST_ENVIRONMENT=ci + + # test shiboken6 build + virtx ${EPYTHON} testrunner.py test --buildno "$((buildno - 1))" --projects=shiboken6 || + die "Tests failed with ${EPYTHON}" + + if use core; then + # test pyside6 build + virtx ${EPYTHON} testrunner.py test --buildno "${buildno}" --projects=pyside6 || + die "Tests failed with ${EPYTHON}" + fi +} + +pkg_preinst() { + # Avoid symlinks being blocked by directories + rm -rf "${EROOT}/usr/include/"{PySide6,shiboken6} || die + rm -rf "${EROOT}/usr/share/PySide6" || die +} |
