Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/qiskit-aer/
Date: Sun, 30 Oct 2022 20:41:52
Message-Id: 1667162494.c29c30829b1625aa1da865962656ce3eb7bd032c.sam@gentoo
1 commit: c29c30829b1625aa1da865962656ce3eb7bd032c
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Sun Oct 30 20:30:21 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Sun Oct 30 20:41:34 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c29c3082
7
8 dev-python/qiskit-aer: add 0.11.1
9
10 Bug: https://bugs.gentoo.org/865129
11 Signed-off-by: Sam James <sam <AT> gentoo.org>
12
13 dev-python/qiskit-aer/Manifest | 1 +
14 dev-python/qiskit-aer/qiskit-aer-0.11.1.ebuild | 92 ++++++++++++++++++++++++++
15 2 files changed, 93 insertions(+)
16
17 diff --git a/dev-python/qiskit-aer/Manifest b/dev-python/qiskit-aer/Manifest
18 index 1dd95accffd1..c2048858b315 100644
19 --- a/dev-python/qiskit-aer/Manifest
20 +++ b/dev-python/qiskit-aer/Manifest
21 @@ -1 +1,2 @@
22 DIST qiskit-aer-0.10.3.gh.tar.gz 6657490 BLAKE2B 443f7df2259c720fb93a60659da9b1cded25f9dbdf585bd0322e9f4effe4c5955daf6587d6c3964ab4a7e4a8bf6270f857abae1cf4e6b0718801daa6a96c2aec SHA512 c882624bac373566b003a01fffa6963d4ad8796ce18786b50ef85350daac26814c147b36067eb6fce4f264919b3680246e767b5c13ac338817fd394620392079
23 +DIST qiskit-aer-0.11.1.gh.tar.gz 6699343 BLAKE2B 3795e1f71914bbc0074a2eac10a82a28f3171d50f292a13dcb705f62daa5fa332a1eabd52391c1b168a822ca6428feb79fe08bb7c93cfd2f7ee5b0d38fed012b SHA512 7880f2ee99f34eca285b9e7cd096981db2f981d41c54881c4036e2745e4af1185b740d93cd157b83ce4adaf8c207c9c063b86e9a1fa514d1388437d6f33e219f
24
25 diff --git a/dev-python/qiskit-aer/qiskit-aer-0.11.1.ebuild b/dev-python/qiskit-aer/qiskit-aer-0.11.1.ebuild
26 new file mode 100644
27 index 000000000000..826271003482
28 --- /dev/null
29 +++ b/dev-python/qiskit-aer/qiskit-aer-0.11.1.ebuild
30 @@ -0,0 +1,92 @@
31 +# Copyright 2022 Gentoo Authors
32 +# Distributed under the terms of the GNU General Public License v2
33 +
34 +EAPI=8
35 +
36 +DISTUTILS_USE_PEP517=setuptools
37 +PYTHON_COMPAT=( python3_{8..10} )
38 +
39 +inherit distutils-r1
40 +
41 +DESCRIPTION="High performance simulator for quantum circuits that includes noise models"
42 +HOMEPAGE="https://github.com/Qiskit/qiskit-aer"
43 +SRC_URI="https://github.com/Qiskit/qiskit-aer/archive/refs/tags/${PV}.tar.gz -> ${P}.gh.tar.gz"
44 +
45 +LICENSE="Apache-2.0"
46 +SLOT="0"
47 +KEYWORDS="~amd64"
48 +
49 +# The reference implementation of BLAS/CBLAS is not compatible with qiskit-aer right now,
50 +# because importing library causes an error.
51 +# /usr/lib/python3.9/site-packages/qiskit/providers/aer/backends/controller_wrappers.cpython-39-x86_64-linux-gnu.so: undefined symbol: slamch_
52 +# Using sci-libs/openblas instead here,
53 +# with the option to switch between reference/openblas implementation runtime (eselect-ldso).
54 +COMMON_DEPEND="
55 + >=dev-python/numpy-1.16.3[${PYTHON_USEDEP}]
56 + >=dev-cpp/nlohmann_json-3.1.1
57 + >=dev-libs/spdlog-1.5.0
58 + >=dev-cpp/muParserX-4.0.8
59 + virtual/cblas[eselect-ldso]
60 + sci-libs/openblas[eselect-ldso]"
61 +
62 +BDEPEND="
63 + ${COMMON_DEPEND}
64 + >dev-util/cmake-3.17
65 + >=dev-python/scikit-build-0.11.0[${PYTHON_USEDEP}]
66 + >=dev-python/pybind11-2.6[${PYTHON_USEDEP}]
67 + test? (
68 + dev-python/ddt[${PYTHON_USEDEP}]
69 + dev-python/fixtures[${PYTHON_USEDEP}]
70 + )"
71 +
72 +RDEPEND="
73 + ${COMMON_DEPEND}
74 + >=dev-python/qiskit-terra-0.21.0[${PYTHON_USEDEP}]
75 + >=dev-python/scipy-1.0[${PYTHON_USEDEP}]"
76 +
77 +distutils_enable_tests pytest
78 +
79 +# Remove cmake dependency from setup.py because of
80 +# invalid dependency description. We put this dependency check in BDEPEND.
81 +PATCHES=( "${FILESDIR}/qiskit-aer-0.10.3-remove-cmake-dependency.patch" )
82 +
83 +check_openblas() {
84 + local libdir=$(get_libdir) me="openblas"
85 +
86 + # check blas
87 + local current_blas=$(eselect blas show ${libdir} | cut -d' ' -f2)
88 + if [[ ${current_blas} != "${me}" ]]; then
89 + eerror "Current eselect: BLAS/CBLAS ($libdir) -> [${current_blas}]."
90 + eerror "To use qiskit-aer, you have to issue (as root):"
91 + eerror "\t eselect blas set ${libdir} ${me}"
92 + return 1
93 + fi
94 + return 0
95 +}
96 +
97 +pkg_setup() {
98 + if use test; then
99 + check_openblas
100 + if [ $? -ne 0 ]; then
101 + die "Set blas implementation to openblas using 'eselect blas set openblas'!"
102 + fi
103 + fi
104 +}
105 +
106 +python_prepare_all() {
107 + export DISABLE_CONAN="ON"
108 + export DISABLE_DEPENDENCY_INSTALL="ON"
109 + distutils-r1_python_prepare_all
110 +}
111 +
112 +python_test() {
113 + # We have to hide the source code directory so tests
114 + # do not use these, but instead the compiled library.
115 + mv qiskit_aer qiskit_aer.hidden || die
116 + epytest -s
117 + mv qiskit_aer.hidden qiskit_aer || die
118 +}
119 +
120 +pkg_postinst() {
121 + check_openblas
122 +}