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