Gentoo Archives: gentoo-commits

From: Andrew Ammerlaan <andrewammerlaan@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/shiboken6/
Date: Mon, 07 Nov 2022 10:18:35
Message-Id: 1667816298.0f3f7efba853dbf095731fedea3d47f290a5f596.andrewammerlaan@gentoo
1 commit: 0f3f7efba853dbf095731fedea3d47f290a5f596
2 Author: Bernd Waibel <waebbl-gentoo <AT> posteo <DOT> net>
3 AuthorDate: Thu Oct 27 22:43:38 2022 +0000
4 Commit: Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
5 CommitDate: Mon Nov 7 10:18:18 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0f3f7efb
7
8 dev-python/shiboken6: add 6.4.0
9
10 Need to restrict to <clang-16 for now, bug #873391
11
12 Bug: https://bugs.gentoo.org/873391
13 Signed-off-by: Bernd Waibel <waebbl-gentoo <AT> posteo.net>
14 Signed-off-by: Andrew Ammerlaan <andrewammerlaan <AT> gentoo.org>
15
16 dev-python/shiboken6/Manifest | 1 +
17 dev-python/shiboken6/shiboken6-6.4.0.ebuild | 169 ++++++++++++++++++++++++++++
18 2 files changed, 170 insertions(+)
19
20 diff --git a/dev-python/shiboken6/Manifest b/dev-python/shiboken6/Manifest
21 index d775a81b0c8a..0e0ec12a5299 100644
22 --- a/dev-python/shiboken6/Manifest
23 +++ b/dev-python/shiboken6/Manifest
24 @@ -1 +1,2 @@
25 DIST pyside-setup-opensource-src-6.3.2.tar.xz 7853068 BLAKE2B 5b39e2f98bca0155d3f6617be206b759b628d0126fd30d76d67352c5c78a385938ce61a3c42b75343b9fde708e9f66617122c687ea9ecffca9cd0ab3af91a2ff SHA512 8d25d20b64ac7874e9b7866f101b6bfd7b6fe1fffa602fec6113e1fdaa11608f14a58c2ae1d87b45ee3eac6a07bd55e66dbbd222727cfe6860d8f444bc2b1ff0
26 +DIST pyside-setup-opensource-src-6.4.0.tar.xz 8551772 BLAKE2B 180d9f2182b8df04394677bbcb0765764d9de1f34064fc688a3ccae8ec37174b4a01fa70c80d98c7ca7fe6b45239225bd801c552d332e2c6fc4a3726535e72e9 SHA512 0517408f110830b888f04777c60b29479831604877da13c5a41a710888ebe53064f06d9b7b61d5c6e6a483ac5ee1639a63bb7f9844301df53e3e9ca8eafcf9e9
27
28 diff --git a/dev-python/shiboken6/shiboken6-6.4.0.ebuild b/dev-python/shiboken6/shiboken6-6.4.0.ebuild
29 new file mode 100644
30 index 000000000000..4d5e47200b4c
31 --- /dev/null
32 +++ b/dev-python/shiboken6/shiboken6-6.4.0.ebuild
33 @@ -0,0 +1,169 @@
34 +# Copyright 1999-2022 Gentoo Authors
35 +# Distributed under the terms of the GNU General Public License v2
36 +
37 +EAPI=8
38 +
39 +# TODO: Split the "/usr/bin/shiboken6" binding generator from the
40 +# "/usr/lib64/libshiboken6-*.so" family of shared libraries. The former
41 +# requires everything (including Clang) at runtime; the latter only requires
42 +# Qt and Python at runtime. Note that "pip" separates these two as well. See:
43 +# https://doc.qt.io/qtforpython/shiboken6/faq.html#is-there-any-runtime-dependency-on-the-generated-binding
44 +# Once split, the PySide6 ebuild should be revised to require
45 +# "/usr/bin/shiboken6" at build time and "libshiboken6-*.so" at runtime.
46 +# TODO: Add PyPy once officially supported. See also:
47 +# https://bugreports.qt.io/browse/PYSIDE-535
48 +PYTHON_COMPAT=( python3_{8..11} )
49 +
50 +inherit cmake llvm python-r1 toolchain-funcs
51 +
52 +MY_P=pyside-setup-opensource-src-${PV}
53 +
54 +DESCRIPTION="Python binding generator for C++ libraries"
55 +HOMEPAGE="https://wiki.qt.io/PySide6"
56 +SRC_URI="https://download.qt.io/official_releases/QtForPython/pyside6/PySide6-${PV}-src/${MY_P}.tar.xz"
57 +S="${WORKDIR}/${MY_P}/sources/shiboken6"
58 +
59 +# The "sources/shiboken6/libshiboken" directory is triple-licensed under the
60 +# GPL v2, v3+, and LGPL v3. All remaining files are licensed under the GPL v3
61 +# with version 1.0 of a Qt-specific exception enabling shiboken6 output to be
62 +# arbitrarily relicensed. (TODO)
63 +LICENSE="|| ( GPL-2 GPL-3+ LGPL-3 ) GPL-3"
64 +SLOT="0"
65 +KEYWORDS="~amd64"
66 +IUSE="+docstrings numpy test vulkan"
67 +REQUIRED_USE="${PYTHON_REQUIRED_USE}"
68 +
69 +# Tests fail pretty bad and I'm not fixing them right now
70 +RESTRICT="test"
71 +
72 +# Minimal supported version of Qt.
73 +QT_PV="$(ver_cut 1-2):6"
74 +
75 +# Since Clang is required at both build- and runtime, BDEPEND is omitted here.
76 +LLVM_MAX_SLOT=15
77 +RDEPEND="${PYTHON_DEPS}
78 + >=dev-qt/qtbase-${QT_PV}
79 + <sys-devel/clang-16:=
80 + <sys-devel/clang-runtime-16:=
81 + docstrings? (
82 + >=dev-libs/libxml2-2.6.32
83 + >=dev-libs/libxslt-1.1.19
84 + )
85 + numpy? ( dev-python/numpy[${PYTHON_USEDEP}] )
86 + vulkan? ( dev-util/vulkan-headers )
87 +"
88 +DEPEND="${RDEPEND}
89 + test? ( >=dev-qt/qtbase-${QT_PV}[gui] )
90 +"
91 +# testlib is toggled by the gui flag on qtbase
92 +
93 +DOCS=( AUTHORS )
94 +
95 +PATCHES=(
96 + "${FILESDIR}/${PN}-6.3.1-no-strip.patch"
97 +)
98 +
99 +# Ensure the path returned by get_llvm_prefix() contains clang as well.
100 +llvm_check_deps() {
101 + has_version "sys-devel/clang:${LLVM_SLOT}"
102 +}
103 +
104 +src_prepare() {
105 + # TODO: File upstream issue requesting a sane way to disable NumPy support.
106 + if ! use numpy; then
107 + sed -i -e '/\bprint(os\.path\.realpath(numpy))/d' \
108 + libshiboken/CMakeLists.txt || die
109 + fi
110 +
111 + # Shiboken6 assumes Vulkan headers live under either "$VULKAN_SDK/include"
112 + # or "$VK_SDK_PATH/include" rather than "${EPREFIX}/usr/include/vulkan".
113 + if use vulkan; then
114 + sed -i -e "s~\bdetectVulkan(&headerPaths);~headerPaths.append(HeaderPath{QByteArrayLiteral(\"${EPREFIX}/usr/include/vulkan\"), HeaderType::System});~" \
115 + ApiExtractor/clangparser/compilersupport.cpp || die
116 + fi
117 +
118 + # Shiboken6 assumes the "/usr/lib/clang/${CLANG_NEWEST_VERSION}/include/"
119 + # subdirectory provides Clang builtin includes (e.g., "stddef.h") for the
120 + # currently installed version of Clang, where ${CLANG_NEWEST_VERSION} is
121 + # the largest version specifier that exists under the "/usr/lib/clang/"
122 + # subdirectory. This assumption is false in edge cases, including when
123 + # users downgrade from newer Clang versions but fail to remove those
124 + # versions with "emerge --depclean". See also:
125 + # https://github.com/leycec/raiagent/issues/85
126 + #
127 + # Sadly, the clang-* family of functions exported by the "toolchain-funcs"
128 + # eclass are defective, returning nonsensical placeholder strings if the
129 + # end user has *NOT* explicitly configured their C++ compiler to be Clang.
130 + # PySide6 does *NOT* care whether the end user has done so or not, as
131 + # PySide6 unconditionally requires Clang in either case. See also:
132 + # https://bugs.gentoo.org/619490
133 + sed -i -e 's~(findClangBuiltInIncludesDir())~(QStringLiteral("'"${EPREFIX}"'/usr/lib/clang/'$(CPP=clang clang-fullversion)'/include"))~' \
134 + ApiExtractor/clangparser/compilersupport.cpp || die
135 +
136 + cmake_src_prepare
137 +}
138 +
139 +src_configure() {
140 + # Minimal tests for now, 2 failing with the extended version
141 + # FIXME Subscripted generics cannot be used with class and instance checks
142 + local mycmakeargs=(
143 + -DBUILD_TESTS=$(usex test)
144 + -DDISABLE_DOCSTRINGS=$(usex !docstrings)
145 + )
146 +
147 + shiboken6_configure() {
148 + local mycmakeargs=(
149 + "${mycmakeargs[@]}"
150 + -DPYTHON_CONFIG_SUFFIX="-${EPYTHON}"
151 + -DPYTHON_EXECUTABLE="${PYTHON}"
152 + -DUSE_PYTHON_VERSION="${EPYTHON#python}"
153 + )
154 + # CMakeLists.txt expects LLVM_INSTALL_DIR as an environment variable.
155 + local -x LLVM_INSTALL_DIR="$(get_llvm_prefix "${LLVM_MAX_SLOT}")"
156 + cmake_src_configure
157 + }
158 + python_foreach_impl shiboken6_configure
159 +}
160 +
161 +src_compile() {
162 + python_foreach_impl cmake_src_compile
163 +}
164 +
165 +src_test() {
166 + python_foreach_impl cmake_src_test
167 +}
168 +
169 +src_install() {
170 + shiboken6_install() {
171 + cmake_src_install
172 + python_optimize
173 +
174 + # Uniquify the "shiboken6" executable for the current Python target,
175 + # preserving an unversioned "shiboken6" file arbitrarily associated
176 + # with the last Python target.
177 + cp "${ED}"/usr/bin/${PN}{,-${EPYTHON}} || die
178 +
179 + # Uniquify the Shiboken6 pkgconfig file for the current Python target,
180 + # preserving an unversioned "shiboken6.pc" file arbitrarily associated
181 + # with the last Python target. See also:
182 + # https://github.com/leycec/raiagent/issues/73
183 + cp "${ED}/usr/$(get_libdir)"/pkgconfig/${PN}{,-${EPYTHON}}.pc || die
184 + }
185 + python_foreach_impl shiboken6_install
186 +
187 + # CMakeLists.txt installs a "Shiboken6Targets-gentoo.cmake" file forcing
188 + # downstream consumers (e.g., PySide6) to target one "libshiboken6-*.so"
189 + # library and one "shiboken6" executable linked to one Python interpreter.
190 + # See also:
191 + # https://bugreports.qt.io/browse/PYSIDE-1053
192 + # https://github.com/leycec/raiagent/issues/74
193 + sed -i \
194 + -e 's~shiboken6-python[[:digit:]]\+\.[[:digit:]]\+~shiboken6${PYTHON_CONFIG_SUFFIX}~g' \
195 + -e 's~/bin/shiboken6~/bin/shiboken6${PYTHON_CONFIG_SUFFIX}~g' \
196 + "${ED}/usr/$(get_libdir)"/cmake/Shiboken6-${PV}/Shiboken6Targets-${CMAKE_BUILD_TYPE,,}.cmake || die
197 +
198 + # Remove the broken "shiboken_tool.py" script. By inspection, this script
199 + # reduces to a noop. Moreover, this script raises the following exception:
200 + # FileNotFoundError: [Errno 2] No such file or directory: '/usr/bin/../shiboken_tool.py': '/usr/bin/../shiboken_tool.py'
201 + rm "${ED}"/usr/bin/shiboken_tool.py || die
202 +}