Gentoo Archives: gentoo-commits

From: "Gábor Oszkár Dénes" <gaboroszkar@××××××××××.com>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/proj/guru:dev commit in: dev-python/qiskit-aer/files/, dev-python/qiskit-aer/
Date: Wed, 30 Mar 2022 17:06:52
Message-Id: 1648659883.d4ea9369855ce920fac3cdbd4f67ed612963051e.gaboroszkar@gentoo
1 commit: d4ea9369855ce920fac3cdbd4f67ed612963051e
2 Author: Gábor Oszkár Dénes <gaboroszkar <AT> protonmail <DOT> com>
3 AuthorDate: Wed Mar 30 17:04:43 2022 +0000
4 Commit: Gábor Oszkár Dénes <gaboroszkar <AT> protonmail <DOT> com>
5 CommitDate: Wed Mar 30 17:04:43 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=d4ea9369
7
8 dev-python/qiskit-aer: new package
9
10 Package-Manager: Portage-3.0.30, Repoman-3.0.3
11 Signed-off-by: Gábor Oszkár Dénes <gaboroszkar <AT> protonmail.com>
12
13 dev-python/qiskit-aer/Manifest | 1 +
14 ...qiskit-aer-0.10.3-remove-cmake-dependency.patch | 10 +++
15 dev-python/qiskit-aer/metadata.xml | 13 +++
16 dev-python/qiskit-aer/qiskit-aer-0.10.3.ebuild | 92 ++++++++++++++++++++++
17 4 files changed, 116 insertions(+)
18
19 diff --git a/dev-python/qiskit-aer/Manifest b/dev-python/qiskit-aer/Manifest
20 new file mode 100644
21 index 000000000..c71d77b9a
22 --- /dev/null
23 +++ b/dev-python/qiskit-aer/Manifest
24 @@ -0,0 +1 @@
25 +DIST qiskit-aer-0.10.3.tar.gz 6657490 BLAKE2B 443f7df2259c720fb93a60659da9b1cded25f9dbdf585bd0322e9f4effe4c5955daf6587d6c3964ab4a7e4a8bf6270f857abae1cf4e6b0718801daa6a96c2aec SHA512 c882624bac373566b003a01fffa6963d4ad8796ce18786b50ef85350daac26814c147b36067eb6fce4f264919b3680246e767b5c13ac338817fd394620392079
26
27 diff --git a/dev-python/qiskit-aer/files/qiskit-aer-0.10.3-remove-cmake-dependency.patch b/dev-python/qiskit-aer/files/qiskit-aer-0.10.3-remove-cmake-dependency.patch
28 new file mode 100644
29 index 000000000..44917bbf8
30 --- /dev/null
31 +++ b/dev-python/qiskit-aer/files/qiskit-aer-0.10.3-remove-cmake-dependency.patch
32 @@ -0,0 +1,10 @@
33 +--- a/setup.py 2022-02-09 17:41:55.000000000 +0100
34 ++++ b/setup.py 2022-03-02 14:44:04.344551645 +0100
35 +@@ -72,7 +72,6 @@
36 +
37 + setup_requirements = common_requirements + [
38 + 'scikit-build>=0.11.0',
39 +- 'cmake!=3.17,!=3.17.0',
40 + 'pybind11>=2.6',
41 + ]
42 +
43
44 diff --git a/dev-python/qiskit-aer/metadata.xml b/dev-python/qiskit-aer/metadata.xml
45 new file mode 100644
46 index 000000000..78ba94b39
47 --- /dev/null
48 +++ b/dev-python/qiskit-aer/metadata.xml
49 @@ -0,0 +1,13 @@
50 +<?xml version="1.0" encoding="UTF-8"?>
51 +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
52 +<pkgmetadata>
53 + <!-- comaintainers-welcomed -->
54 + <maintainer type="person">
55 + <email>gaboroszkar@××××××××××.com</email>
56 + <name>Gábor Oszkár Dénes</name>
57 + </maintainer>
58 + <longdescription>
59 + Qiskit is an open-source framework for working with noisy quantum computers at the level of pulses, circuits, and algorithms.
60 + Qiskit is made up of elements that each work together to enable quantum computing. This element is Aer, which provides high-performance quantum computing simulators with realistic noise models.
61 + </longdescription>
62 +</pkgmetadata>
63
64 diff --git a/dev-python/qiskit-aer/qiskit-aer-0.10.3.ebuild b/dev-python/qiskit-aer/qiskit-aer-0.10.3.ebuild
65 new file mode 100644
66 index 000000000..9f4797132
67 --- /dev/null
68 +++ b/dev-python/qiskit-aer/qiskit-aer-0.10.3.ebuild
69 @@ -0,0 +1,92 @@
70 +# Copyright 2022 Gentoo Authors
71 +# Distributed under the terms of the GNU General Public License v2
72 +
73 +EAPI=8
74 +
75 +DISTUTILS_USE_PEP517=setuptools
76 +PYTHON_COMPAT=( python3_{8..10} )
77 +
78 +inherit distutils-r1
79 +
80 +DESCRIPTION="High performance simulator for quantum circuits that includes noise models"
81 +HOMEPAGE="https://github.com/Qiskit/qiskit-aer"
82 +SRC_URI="https://github.com/Qiskit/qiskit-aer/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz"
83 +
84 +LICENSE="Apache-2.0"
85 +SLOT="0"
86 +KEYWORDS="~amd64"
87 +
88 +# The reference implementation of BLAS/CBLAS is not compatible with qiskit-aer right now,
89 +# because importing library causes an error.
90 +# /usr/lib/python3.9/site-packages/qiskit/providers/aer/backends/controller_wrappers.cpython-39-x86_64-linux-gnu.so: undefined symbol: slamch_
91 +# Using sci-libs/openblas instead here,
92 +# with the option to switch between reference/openblas implementation runtime (eselect-ldso).
93 +COMMON_DEPEND="
94 + >=dev-python/numpy-1.16.3[${PYTHON_USEDEP}]
95 + >=dev-cpp/nlohmann_json-3.1.1
96 + >=dev-libs/spdlog-1.5.0
97 + >=dev-cpp/muParserX-4.0.8
98 + virtual/cblas[eselect-ldso]
99 + sci-libs/openblas[eselect-ldso]"
100 +
101 +BDEPEND="
102 + ${COMMON_DEPEND}
103 + >dev-util/cmake-3.17
104 + >=dev-python/scikit-build-0.11.0[${PYTHON_USEDEP}]
105 + >=dev-python/pybind11-2.6[${PYTHON_USEDEP}]
106 + test? (
107 + dev-python/ddt[${PYTHON_USEDEP}]
108 + dev-python/fixtures[${PYTHON_USEDEP}]
109 + )"
110 +
111 +RDEPEND="
112 + ${COMMON_DEPEND}
113 + >=dev-python/qiskit-terra-0.19.1[${PYTHON_USEDEP}]
114 + >=dev-python/scipy-1.0[${PYTHON_USEDEP}]"
115 +
116 +distutils_enable_tests pytest
117 +
118 +# Remove cmake dependency from setup.py because of
119 +# invalid dependency description. We put this dependency check in BDEPEND.
120 +PATCHES=( "${FILESDIR}/qiskit-aer-0.10.3-remove-cmake-dependency.patch" )
121 +
122 +check_openblas() {
123 + local libdir=$(get_libdir) me="openblas"
124 +
125 + # check blas
126 + local current_blas=$(eselect blas show ${libdir} | cut -d' ' -f2)
127 + if [[ ${current_blas} != "${me}" ]]; then
128 + eerror "Current eselect: BLAS/CBLAS ($libdir) -> [${current_blas}]."
129 + eerror "To use qiskit-aer, you have to issue (as root):"
130 + eerror "\t eselect blas set ${libdir} ${me}"
131 + return 1
132 + fi
133 + return 0
134 +}
135 +
136 +pkg_setup() {
137 + if use test; then
138 + check_openblas
139 + if [ $? -ne 0 ]; then
140 + die "Set blas implementation to openblas using 'eselect blas set openblas'!"
141 + fi
142 + fi
143 +}
144 +
145 +python_prepare_all() {
146 + export DISABLE_CONAN="ON"
147 + export DISABLE_DEPENDENCY_INSTALL="ON"
148 + distutils-r1_python_prepare_all
149 +}
150 +
151 +python_test() {
152 + # We have to hide the source code directory so tests
153 + # do not use these, but instead the compiled library.
154 + mv qiskit qiskit.hidden || die
155 + epytest
156 + mv qiskit.hidden qiskit || die
157 +}
158 +
159 +pkg_postinst() {
160 + check_openblas
161 +}