Gentoo Archives: gentoo-commits

From: Rick Farina <zerochaos@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/shiboken2/
Date: Fri, 22 May 2020 17:23:21
Message-Id: 1590168129.b8a532bc7a527dccb168aade3bf6d4c03af53146.zerochaos@gentoo
1 commit: b8a532bc7a527dccb168aade3bf6d4c03af53146
2 Author: Rick Farina <zerochaos <AT> gentoo <DOT> org>
3 AuthorDate: Fri May 22 16:33:30 2020 +0000
4 Commit: Rick Farina <zerochaos <AT> gentoo <DOT> org>
5 CommitDate: Fri May 22 17:22:09 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b8a532bc
7
8 dev-python/shiboken2: imported from leycec/raiagent
9
10 very slightly modified
11
12 Package-Manager: Portage-2.3.99, Repoman-2.3.22
13 Signed-off-by: Rick Farina <zerochaos <AT> gentoo.org>
14
15 dev-python/shiboken2/Manifest | 2 +
16 dev-python/shiboken2/metadata.xml | 13 ++
17 dev-python/shiboken2/shiboken2-5.14.1-r3.ebuild | 172 ++++++++++++++++++++++++
18 dev-python/shiboken2/shiboken2-5.14.2.ebuild | 169 +++++++++++++++++++++++
19 4 files changed, 356 insertions(+)
20
21 diff --git a/dev-python/shiboken2/Manifest b/dev-python/shiboken2/Manifest
22 new file mode 100644
23 index 00000000000..a1325269803
24 --- /dev/null
25 +++ b/dev-python/shiboken2/Manifest
26 @@ -0,0 +1,2 @@
27 +DIST pyside-setup-opensource-src-5.14.1.tar.xz 3217008 BLAKE2B c02a79ecea0ba8c7f5547d16c842437455f7f7fce9b7993849919b593fc50b70661e1fc7c1e01eb6a505807f05e17696b2e7727f6ada9ecae2ce30a9ab37a4aa SHA512 6dfe8dc6f302a35a6448c4facb2b98d638506381638c8bda69b75a47ea6cb3168b11515faf0000dbfb5e36bfad5d14488ba5a9bd914adb3f5c38ed18714521d4
28 +DIST pyside-setup-opensource-src-5.14.2.tar.xz 3238036 BLAKE2B 454f19ae4e154747bad2b833727ab62ded15bbac495cc0bef112ce6cccdd69bb5bb541c9b31125bd05090bfce042bac2ac8b47690c695e82b5c901e45e87f681 SHA512 6708c4ebb115119796756ccac89197e111eb27c4a91f52875da04eff4ca6f9e3fffefc18cc0219a8c3a3c81a667bf7509909a6d1d9ff1ee2cc0d957453cceffa
29
30 diff --git a/dev-python/shiboken2/metadata.xml b/dev-python/shiboken2/metadata.xml
31 new file mode 100644
32 index 00000000000..766f70c1559
33 --- /dev/null
34 +++ b/dev-python/shiboken2/metadata.xml
35 @@ -0,0 +1,13 @@
36 +<?xml version="1.0" encoding="UTF-8"?>
37 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
38 +<pkgmetadata>
39 + <maintainer type="person">
40 + <email>zerochaos@g.o</email>
41 + <name>Rick Farina</name>
42 + </maintainer>
43 + <use>
44 + <flag name="docstrings">Expose documentation as Python docstrings (recommended)</flag>
45 + <flag name="numpy">Implicitly convert passed NumPy arrays to Qt lists</flag>
46 + <flag name="vulkan">Generate "QSurface::VulkanSurface" bindings</flag>
47 + </use>
48 +</pkgmetadata>
49
50 diff --git a/dev-python/shiboken2/shiboken2-5.14.1-r3.ebuild b/dev-python/shiboken2/shiboken2-5.14.1-r3.ebuild
51 new file mode 100644
52 index 00000000000..c3fab92d51e
53 --- /dev/null
54 +++ b/dev-python/shiboken2/shiboken2-5.14.1-r3.ebuild
55 @@ -0,0 +1,172 @@
56 +# Copyright 1999-2020 Gentoo Authors
57 +# Distributed under the terms of the GNU General Public License v2
58 +
59 +EAPI=7
60 +
61 +# TODO: Remove the shiboken2 5.14.1-specific "sed" kludge on the next bump.
62 +# TODO: Remove Python 2.7 support on the next bump. Gentoo support for Python
63 +# 2.7 effectively ceases in April 2020.
64 +# TODO: Split the "/usr/bin/shiboken2" binding generator from the
65 +# "/usr/lib64/libshiboken2-*.so" family of shared libraries. The former
66 +# requires everything (including Clang) at runtime; the latter only requires
67 +# Qt and Python at runtime. Note that "pip" separates these two as well. See:
68 +# https://doc.qt.io/qtforpython/shiboken2/faq.html#is-there-any-runtime-dependency-on-the-generated-binding
69 +# Once split, the PySide2 ebuild should be revised to require
70 +# "/usr/bin/shiboken2" at build time and "libshiboken2-*.so" at runtime.
71 +# TODO: Add PyPy once officially supported. See also:
72 +# https://bugreports.qt.io/browse/PYSIDE-535
73 +PYTHON_COMPAT=( python2_7 python3_{6,7,8} )
74 +
75 +inherit cmake-utils llvm python-r1
76 +
77 +MY_P=pyside-setup-opensource-src-${PV}
78 +
79 +DESCRIPTION="Python binding generator for C++ libraries"
80 +HOMEPAGE="https://wiki.qt.io/PySide2"
81 +SRC_URI="https://download.qt.io/official_releases/QtForPython/pyside2/PySide2-${PV}-src/${MY_P}.tar.xz"
82 +
83 +# The "sources/shiboken2/libshiboken" directory is triple-licensed under the
84 +# GPL v2, v3+, and LGPL v3. All remaining files are licensed under the GPL v3
85 +# with version 1.0 of a Qt-specific exception enabling shiboken2 output to be
86 +# arbitrarily relicensed. (TODO)
87 +LICENSE="|| ( GPL-2 GPL-3+ LGPL-3 ) GPL-3"
88 +SLOT="0"
89 +KEYWORDS="~amd64"
90 +IUSE="+docstrings numpy test vulkan"
91 +REQUIRED_USE="${PYTHON_REQUIRED_USE}"
92 +
93 +#tests fail pretty bad and I'm not fixing them right now
94 +RESTRICT="test"
95 +
96 +# Minimal supported version of Qt.
97 +QT_PV="$(ver_cut 1-2):5"
98 +
99 +# Since Clang is required at both build- and runtime, BDEPEND is omitted here.
100 +RDEPEND="${PYTHON_DEPS}
101 + >=dev-qt/qtcore-${QT_PV}
102 + >=sys-devel/clang-6:=
103 + docstrings? (
104 + >=dev-libs/libxml2-2.6.32
105 + >=dev-libs/libxslt-1.1.19
106 + >=dev-qt/qtxml-${QT_PV}
107 + >=dev-qt/qtxmlpatterns-${QT_PV}
108 + )
109 + numpy? ( dev-python/numpy[${PYTHON_USEDEP}] )
110 + vulkan? ( dev-util/vulkan-headers )
111 +"
112 +DEPEND="${RDEPEND}
113 + test? ( >=dev-qt/qttest-${QT_PV} )
114 +"
115 +
116 +S=${WORKDIR}/${MY_P}/sources/shiboken2
117 +DOCS=( AUTHORS )
118 +
119 +# Ensure the path returned by get_llvm_prefix() contains clang as well.
120 +llvm_check_deps() {
121 + has_version "sys-devel/clang:${LLVM_SLOT}"
122 +}
123 +
124 +src_prepare() {
125 + # TODO: File upstream issue requesting a sane way to disable NumPy support.
126 + if ! use numpy; then
127 + sed -i -e '/\bprint(os\.path\.realpath(numpy))/d' \
128 + libshiboken/CMakeLists.txt || die
129 + fi
130 +
131 + # Shiboken2 assumes Vulkan headers live under either "$VULKAN_SDK/include"
132 + # or "$VK_SDK_PATH/include" rather than "${EPREFIX}/usr/include/vulkan".
133 + if use vulkan; then
134 + sed -i -e 's~\bdetectVulkan(&headerPaths);~headerPaths.append(HeaderPath{QByteArrayLiteral("'${EPREFIX}'/usr/include/vulkan"), HeaderType::System});~' \
135 + ApiExtractor/clangparser/compilersupport.cpp || die
136 + fi
137 +
138 + # Shiboken2 assumes the "/usr/lib/clang/${CLANG_NEWEST_VERSION}/include/"
139 + # subdirectory provides Clang builtin includes (e.g., "stddef.h") for the
140 + # currently installed version of Clang, where ${CLANG_NEWEST_VERSION} is
141 + # the largest version specifier that exists under the "/usr/lib/clang/"
142 + # subdirectory. This assumption is false in edge cases, including when
143 + # users downgrade from newer Clang versions but fail to remove those
144 + # versions with "emerge --depclean". See also:
145 + # https://github.com/leycec/raiagent/issues/85
146 + #
147 + # Sadly, the clang-* family of functions exported by the "toolchain-funcs"
148 + # eclass are defective, returning nonsensical placeholder strings if the
149 + # end user has *NOT* explicitly configured their C++ compiler to be Clang.
150 + # PySide2 does *NOT* care whether the end user has done so or not, as
151 + # PySide2 unconditionally requires Clang in either case. This requires us
152 + # to temporarily coerce the "${CPP}" environment variable identifying the
153 + # current C++ compiler to "clang" immediately *BEFORE* calling such a
154 + # function and then restoring that variable to its prior state immediately
155 + # *AFTER* returning from that function call merely to force the
156 + # clang-fullversion() function called below to return sanity. See also:
157 + # https://bugs.gentoo.org/619490
158 + _CPP_old="$(tc-getCPP)"
159 + CPP=clang
160 + sed -i -e 's~(findClangBuiltInIncludesDir())~(QStringLiteral("'${EPREFIX}'/usr/lib/clang/'$(clang-fullversion)'/include"))~' \
161 + ApiExtractor/clangparser/compilersupport.cpp || die
162 + CPP="${_CPP_old}"
163 +
164 + cmake-utils_src_prepare
165 +}
166 +
167 +src_configure() {
168 + local mycmakeargs=(
169 + -DBUILD_TESTS=$(usex test)
170 + -DDISABLE_DOCSTRINGS=$(usex !docstrings)
171 + )
172 +
173 + shiboken2_configure() {
174 + local mycmakeargs=(
175 + "${mycmakeargs[@]}"
176 + -DPYTHON_CONFIG_SUFFIX="-${EPYTHON}"
177 + -DPYTHON_EXECUTABLE="${PYTHON}"
178 + -DUSE_PYTHON_VERSION="${EPYTHON#python}"
179 + )
180 + # CMakeLists.txt expects LLVM_INSTALL_DIR as an environment variable.
181 + LLVM_INSTALL_DIR="$(get_llvm_prefix)" cmake-utils_src_configure
182 + }
183 + python_foreach_impl shiboken2_configure
184 +}
185 +
186 +src_compile() {
187 + python_foreach_impl cmake-utils_src_compile
188 +}
189 +
190 +src_test() {
191 + python_foreach_impl cmake-utils_src_test
192 +}
193 +
194 +src_install() {
195 + shiboken2_install() {
196 + cmake-utils_src_install
197 + python_optimize
198 +
199 + # Uniquify the "shiboken2" executable for the current Python target,
200 + # preserving an unversioned "shiboken2" file arbitrarily associated
201 + # with the last Python target.
202 + cp "${ED}"/usr/bin/${PN}{,-${EPYTHON}} || die
203 +
204 + # Uniquify the Shiboken2 pkgconfig file for the current Python target,
205 + # preserving an unversioned "shiboken2.pc" file arbitrarily associated
206 + # with the last Python target. See also:
207 + # https://github.com/leycec/raiagent/issues/73
208 + cp "${ED}/usr/$(get_libdir)"/pkgconfig/${PN}{,-${EPYTHON}}.pc || die
209 + }
210 + python_foreach_impl shiboken2_install
211 +
212 + # CMakeLists.txt installs a "Shiboken2Targets-gentoo.cmake" file forcing
213 + # downstream consumers (e.g., PySide2) to target one "libshiboken2-*.so"
214 + # library and one "shiboken2" executable linked to one Python interpreter.
215 + # See also:
216 + # https://bugreports.qt.io/browse/PYSIDE-1053
217 + # https://github.com/leycec/raiagent/issues/74
218 + sed -i \
219 + -e 's~shiboken2-python[[:digit:]]\+\.[[:digit:]]\+~shiboken2${PYTHON_CONFIG_SUFFIX}~g' \
220 + -e 's~/bin/shiboken2~/bin/shiboken2${PYTHON_CONFIG_SUFFIX}~g' \
221 + "${ED}/usr/$(get_libdir)"/cmake/Shiboken2-${PV}/Shiboken2Targets-gentoo.cmake || die
222 +
223 + # Remove the broken "shiboken_tool.py" script. By inspection, this script
224 + # reduces to a noop. Moreover, this script raises the following exception:
225 + # FileNotFoundError: [Errno 2] No such file or directory: '/usr/bin/../shiboken_tool.py': '/usr/bin/../shiboken_tool.py'
226 + rm "${ED}"/usr/bin/shiboken_tool.py
227 +}
228
229 diff --git a/dev-python/shiboken2/shiboken2-5.14.2.ebuild b/dev-python/shiboken2/shiboken2-5.14.2.ebuild
230 new file mode 100644
231 index 00000000000..80c69ff0912
232 --- /dev/null
233 +++ b/dev-python/shiboken2/shiboken2-5.14.2.ebuild
234 @@ -0,0 +1,169 @@
235 +# Copyright 1999-2020 Gentoo Authors
236 +# Distributed under the terms of the GNU General Public License v2
237 +
238 +EAPI=7
239 +
240 +# TODO: Split the "/usr/bin/shiboken2" binding generator from the
241 +# "/usr/lib64/libshiboken2-*.so" family of shared libraries. The former
242 +# requires everything (including Clang) at runtime; the latter only requires
243 +# Qt and Python at runtime. Note that "pip" separates these two as well. See:
244 +# https://doc.qt.io/qtforpython/shiboken2/faq.html#is-there-any-runtime-dependency-on-the-generated-binding
245 +# Once split, the PySide2 ebuild should be revised to require
246 +# "/usr/bin/shiboken2" at build time and "libshiboken2-*.so" at runtime.
247 +# TODO: Add PyPy once officially supported. See also:
248 +# https://bugreports.qt.io/browse/PYSIDE-535
249 +PYTHON_COMPAT=( python3_{6,7,8} )
250 +
251 +inherit cmake-utils llvm python-r1 toolchain-funcs
252 +
253 +MY_P=pyside-setup-opensource-src-${PV}
254 +
255 +DESCRIPTION="Python binding generator for C++ libraries"
256 +HOMEPAGE="https://wiki.qt.io/PySide2"
257 +SRC_URI="https://download.qt.io/official_releases/QtForPython/pyside2/PySide2-${PV}-src/${MY_P}.tar.xz"
258 +
259 +# The "sources/shiboken2/libshiboken" directory is triple-licensed under the
260 +# GPL v2, v3+, and LGPL v3. All remaining files are licensed under the GPL v3
261 +# with version 1.0 of a Qt-specific exception enabling shiboken2 output to be
262 +# arbitrarily relicensed. (TODO)
263 +LICENSE="|| ( GPL-2 GPL-3+ LGPL-3 ) GPL-3"
264 +SLOT="0"
265 +KEYWORDS="~amd64"
266 +IUSE="+docstrings numpy test vulkan"
267 +REQUIRED_USE="${PYTHON_REQUIRED_USE}"
268 +
269 +#tests fail pretty bad and I'm not fixing them right now
270 +RESTRICT="test"
271 +
272 +# Minimal supported version of Qt.
273 +QT_PV="$(ver_cut 1-2):5"
274 +
275 +# Since Clang is required at both build- and runtime, BDEPEND is omitted here.
276 +RDEPEND="${PYTHON_DEPS}
277 + >=dev-qt/qtcore-${QT_PV}
278 + >=sys-devel/clang-6:=
279 + docstrings? (
280 + >=dev-libs/libxml2-2.6.32
281 + >=dev-libs/libxslt-1.1.19
282 + >=dev-qt/qtxml-${QT_PV}
283 + >=dev-qt/qtxmlpatterns-${QT_PV}
284 + )
285 + numpy? ( dev-python/numpy[${PYTHON_USEDEP}] )
286 + vulkan? ( dev-util/vulkan-headers )
287 +"
288 +DEPEND="${RDEPEND}
289 + test? ( >=dev-qt/qttest-${QT_PV} )
290 +"
291 +
292 +S=${WORKDIR}/${MY_P}/sources/shiboken2
293 +DOCS=( AUTHORS )
294 +
295 +# Ensure the path returned by get_llvm_prefix() contains clang as well.
296 +llvm_check_deps() {
297 + has_version "sys-devel/clang:${LLVM_SLOT}"
298 +}
299 +
300 +src_prepare() {
301 + # TODO: File upstream issue requesting a sane way to disable NumPy support.
302 + if ! use numpy; then
303 + sed -i -e '/\bprint(os\.path\.realpath(numpy))/d' \
304 + libshiboken/CMakeLists.txt || die
305 + fi
306 +
307 + # Shiboken2 assumes Vulkan headers live under either "$VULKAN_SDK/include"
308 + # or "$VK_SDK_PATH/include" rather than "${EPREFIX}/usr/include/vulkan".
309 + if use vulkan; then
310 + sed -i -e 's~\bdetectVulkan(&headerPaths);~headerPaths.append(HeaderPath{QByteArrayLiteral("'${EPREFIX}'/usr/include/vulkan"), HeaderType::System});~' \
311 + ApiExtractor/clangparser/compilersupport.cpp || die
312 + fi
313 +
314 + # Shiboken2 assumes the "/usr/lib/clang/${CLANG_NEWEST_VERSION}/include/"
315 + # subdirectory provides Clang builtin includes (e.g., "stddef.h") for the
316 + # currently installed version of Clang, where ${CLANG_NEWEST_VERSION} is
317 + # the largest version specifier that exists under the "/usr/lib/clang/"
318 + # subdirectory. This assumption is false in edge cases, including when
319 + # users downgrade from newer Clang versions but fail to remove those
320 + # versions with "emerge --depclean". See also:
321 + # https://github.com/leycec/raiagent/issues/85
322 + #
323 + # Sadly, the clang-* family of functions exported by the "toolchain-funcs"
324 + # eclass are defective, returning nonsensical placeholder strings if the
325 + # end user has *NOT* explicitly configured their C++ compiler to be Clang.
326 + # PySide2 does *NOT* care whether the end user has done so or not, as
327 + # PySide2 unconditionally requires Clang in either case. This requires us
328 + # to temporarily coerce the "${CPP}" environment variable identifying the
329 + # current C++ compiler to "clang" immediately *BEFORE* calling such a
330 + # function and then restoring that variable to its prior state immediately
331 + # *AFTER* returning from that function call merely to force the
332 + # clang-fullversion() function called below to return sanity. See also:
333 + # https://bugs.gentoo.org/619490
334 + _CPP_old="$(tc-getCPP)"
335 + CPP=clang
336 + sed -i -e 's~(findClangBuiltInIncludesDir())~(QStringLiteral("'${EPREFIX}'/usr/lib/clang/'$(clang-fullversion)'/include"))~' \
337 + ApiExtractor/clangparser/compilersupport.cpp || die
338 + CPP="${_CPP_old}"
339 +
340 + cmake-utils_src_prepare
341 +}
342 +
343 +src_configure() {
344 + local mycmakeargs=(
345 + -DBUILD_TESTS=$(usex test)
346 + -DDISABLE_DOCSTRINGS=$(usex !docstrings)
347 + )
348 +
349 + shiboken2_configure() {
350 + local mycmakeargs=(
351 + "${mycmakeargs[@]}"
352 + -DPYTHON_CONFIG_SUFFIX="-${EPYTHON}"
353 + -DPYTHON_EXECUTABLE="${PYTHON}"
354 + -DUSE_PYTHON_VERSION="${EPYTHON#python}"
355 + )
356 + # CMakeLists.txt expects LLVM_INSTALL_DIR as an environment variable.
357 + LLVM_INSTALL_DIR="$(get_llvm_prefix)" cmake-utils_src_configure
358 + }
359 + python_foreach_impl shiboken2_configure
360 +}
361 +
362 +src_compile() {
363 + python_foreach_impl cmake-utils_src_compile
364 +}
365 +
366 +src_test() {
367 + python_foreach_impl cmake-utils_src_test
368 +}
369 +
370 +src_install() {
371 + shiboken2_install() {
372 + cmake-utils_src_install
373 + python_optimize
374 +
375 + # Uniquify the "shiboken2" executable for the current Python target,
376 + # preserving an unversioned "shiboken2" file arbitrarily associated
377 + # with the last Python target.
378 + cp "${ED}"/usr/bin/${PN}{,-${EPYTHON}} || die
379 +
380 + # Uniquify the Shiboken2 pkgconfig file for the current Python target,
381 + # preserving an unversioned "shiboken2.pc" file arbitrarily associated
382 + # with the last Python target. See also:
383 + # https://github.com/leycec/raiagent/issues/73
384 + cp "${ED}/usr/$(get_libdir)"/pkgconfig/${PN}{,-${EPYTHON}}.pc || die
385 + }
386 + python_foreach_impl shiboken2_install
387 +
388 + # CMakeLists.txt installs a "Shiboken2Targets-gentoo.cmake" file forcing
389 + # downstream consumers (e.g., PySide2) to target one "libshiboken2-*.so"
390 + # library and one "shiboken2" executable linked to one Python interpreter.
391 + # See also:
392 + # https://bugreports.qt.io/browse/PYSIDE-1053
393 + # https://github.com/leycec/raiagent/issues/74
394 + sed -i \
395 + -e 's~shiboken2-python[[:digit:]]\+\.[[:digit:]]\+~shiboken2${PYTHON_CONFIG_SUFFIX}~g' \
396 + -e 's~/bin/shiboken2~/bin/shiboken2${PYTHON_CONFIG_SUFFIX}~g' \
397 + "${ED}/usr/$(get_libdir)"/cmake/Shiboken2-${PV}/Shiboken2Targets-gentoo.cmake || die
398 +
399 + # Remove the broken "shiboken_tool.py" script. By inspection, this script
400 + # reduces to a noop. Moreover, this script raises the following exception:
401 + # FileNotFoundError: [Errno 2] No such file or directory: '/usr/bin/../shiboken_tool.py': '/usr/bin/../shiboken_tool.py'
402 + rm "${ED}"/usr/bin/shiboken_tool.py
403 +}