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-terra/files/, dev-python/qiskit-terra/
Date: Wed, 30 Mar 2022 17:06:51
Message-Id: 1648659792.b6a17bc8aac0a7bc79fff730a2d929ad72b6de43.gaboroszkar@gentoo
1 commit: b6a17bc8aac0a7bc79fff730a2d929ad72b6de43
2 Author: Gábor Oszkár Dénes <gaboroszkar <AT> protonmail <DOT> com>
3 AuthorDate: Wed Mar 30 17:03:12 2022 +0000
4 Commit: Gábor Oszkár Dénes <gaboroszkar <AT> protonmail <DOT> com>
5 CommitDate: Wed Mar 30 17:03:12 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=b6a17bc8
7
8 dev-python/qiskit-terra: 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-terra/Manifest | 1 +
14 .../qiskit-terra-0.19.2-test-corrections.patch | 36 +++++++++++
15 dev-python/qiskit-terra/metadata.xml | 16 +++++
16 dev-python/qiskit-terra/qiskit-terra-0.19.2.ebuild | 70 ++++++++++++++++++++++
17 4 files changed, 123 insertions(+)
18
19 diff --git a/dev-python/qiskit-terra/Manifest b/dev-python/qiskit-terra/Manifest
20 new file mode 100644
21 index 000000000..ab8d97606
22 --- /dev/null
23 +++ b/dev-python/qiskit-terra/Manifest
24 @@ -0,0 +1 @@
25 +DIST qiskit-terra-0.19.2.tar.gz 9536647 BLAKE2B 966370a782179512f3c4cd209f604f536ac4ac503f4805681d5729f4d6df4020bbaa5a2beb2fc393506eaa67a81666254375f14b827e07e1c1478a381fde5b45 SHA512 d02c028a86927610f1bca63830cb489069e68e016ed744a4092a96ddde163ea8ca1071048fc82b1807d4136e1fb2b0fcdde6d1a639ffc2ebe7c99dfd50c2e3d4
26
27 diff --git a/dev-python/qiskit-terra/files/qiskit-terra-0.19.2-test-corrections.patch b/dev-python/qiskit-terra/files/qiskit-terra-0.19.2-test-corrections.patch
28 new file mode 100644
29 index 000000000..ec44ebe75
30 --- /dev/null
31 +++ b/dev-python/qiskit-terra/files/qiskit-terra-0.19.2-test-corrections.patch
32 @@ -0,0 +1,36 @@
33 +diff --git a/test/python/qobj/test_pulse_converter.py b/test/python/qobj/test_pulse_converter.py
34 +index ea5b77e78..cde568ecf 100644
35 +--- a/test/python/qobj/test_pulse_converter.py
36 ++++ b/test/python/qobj/test_pulse_converter.py
37 +@@ -341,7 +341,8 @@ class TestQobjToInstructionConverter(QiskitTestCase):
38 +
39 + self.assertEqual(evaluated_instruction.start_time, 1)
40 + self.assertEqual(evaluated_instruction.duration, 1)
41 +- self.assertEqual(evaluated_instruction.instructions[0][-1], instruction)
42 ++ self.assertEqual(evaluated_instruction.instructions[0][-1].channel, instruction.channel)
43 ++ self.assertAlmostEqual(evaluated_instruction.instructions[0][-1].frequency, instruction.frequency)
44 +
45 + def test_delay(self):
46 + """Test converted qobj from Delay."""
47 +diff --git a/test/randomized/test_transpiler_equivalence.py b/test/randomized/test_transpiler_equivalence.py
48 +index 302760279..1d0a3e16f 100644
49 +--- a/test/randomized/test_transpiler_equivalence.py
50 ++++ b/test/randomized/test_transpiler_equivalence.py
51 +@@ -21,7 +21,7 @@ from hypothesis.stateful import Bundle, RuleBasedStateMachine
52 +
53 + import hypothesis.strategies as st
54 +
55 +-from qiskit import execute, transpile, Aer
56 ++from qiskit import execute, transpile, BasicAer
57 + from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
58 + from qiskit.circuit import Measure, Reset, Gate, Barrier
59 + from qiskit.test.mock import (
60 +@@ -98,7 +98,7 @@ class QCircuitMachine(RuleBasedStateMachine):
61 + qubits = Bundle("qubits")
62 + clbits = Bundle("clbits")
63 +
64 +- backend = Aer.get_backend("qasm_simulator")
65 ++ backend = BasicAer.get_backend("qasm_simulator")
66 + max_qubits = int(backend.configuration().n_qubits / 2)
67 +
68 + def __init__(self):
69
70 diff --git a/dev-python/qiskit-terra/metadata.xml b/dev-python/qiskit-terra/metadata.xml
71 new file mode 100644
72 index 000000000..0ff9a7974
73 --- /dev/null
74 +++ b/dev-python/qiskit-terra/metadata.xml
75 @@ -0,0 +1,16 @@
76 +<?xml version="1.0" encoding="UTF-8"?>
77 +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
78 +<pkgmetadata>
79 + <!-- comaintainers-welcomed -->
80 + <maintainer type="person">
81 + <email>gaboroszkar@××××××××××.com</email>
82 + <name>Gábor Oszkár Dénes</name>
83 + </maintainer>
84 + <longdescription>
85 + Qiskit is an open-source framework for working with noisy quantum computers at the level of pulses, circuits, and algorithms.
86 + Qiskit is made up of elements that work together to enable quantum computing. This element is Terra and is the foundation on which the rest of Qiskit is built.
87 + </longdescription>
88 + <use>
89 + <flag name="visualization">Enable visualization modules</flag>
90 + </use>
91 +</pkgmetadata>
92
93 diff --git a/dev-python/qiskit-terra/qiskit-terra-0.19.2.ebuild b/dev-python/qiskit-terra/qiskit-terra-0.19.2.ebuild
94 new file mode 100644
95 index 000000000..1cc6122b7
96 --- /dev/null
97 +++ b/dev-python/qiskit-terra/qiskit-terra-0.19.2.ebuild
98 @@ -0,0 +1,70 @@
99 +# Copyright 2022 Gentoo Authors
100 +# Distributed under the terms of the GNU General Public License v2
101 +
102 +EAPI=8
103 +
104 +DISTUTILS_USE_PEP517=setuptools
105 +PYTHON_COMPAT=( python3_{8..10} )
106 +
107 +inherit distutils-r1
108 +
109 +DESCRIPTION="Terra is the foundation on which Qiskit is built"
110 +HOMEPAGE="https://github.com/Qiskit/qiskit-terra"
111 +SRC_URI="https://github.com/Qiskit/qiskit-terra/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz"
112 +
113 +LICENSE="Apache-2.0"
114 +SLOT="0"
115 +IUSE="+visualization"
116 +KEYWORDS="~amd64"
117 +
118 +BDEPEND=">=dev-python/cython-0.27.1[${PYTHON_USEDEP}]
119 + test? (
120 + >=dev-python/ddt-1.4.4[${PYTHON_USEDEP}]
121 + >=dev-python/hypothesis-4.24.3[${PYTHON_USEDEP}]
122 + >=dev-python/networkx-2.2[${PYTHON_USEDEP}]
123 + app-text/poppler[png]
124 + >=sci-libs/scikit-learn-0.20.0[${PYTHON_USEDEP}]
125 + )"
126 +
127 +RDEPEND="
128 + >=dev-python/retworkx-0.10.1[${PYTHON_USEDEP}]
129 + >=dev-python/numpy-1.17[${PYTHON_USEDEP}]
130 + >=dev-python/ply-3.10[${PYTHON_USEDEP}]
131 + >=dev-python/psutil-5[${PYTHON_USEDEP}]
132 + >=dev-python/scipy-1.5[${PYTHON_USEDEP}]
133 + >=dev-python/sympy-1.3[${PYTHON_USEDEP}]
134 + >=dev-python/dill-0.3[${PYTHON_USEDEP}]
135 + >=dev-python/python-constraint-1.4[${PYTHON_USEDEP}]
136 + >=dev-python/python-dateutil-2.8.0[${PYTHON_USEDEP}]
137 + >=dev-python/stevedore-3.0.0[${PYTHON_USEDEP}]
138 + >=dev-python/symengine-0.8[${PYTHON_USEDEP}]
139 + >=dev-python/tweedledum-1.1[${PYTHON_USEDEP}]
140 + visualization? (
141 + >=dev-python/matplotlib-3.3[${PYTHON_USEDEP}]
142 + >=dev-python/ipywidgets-7.3.0[${PYTHON_USEDEP}]
143 + dev-python/pydot[${PYTHON_USEDEP}]
144 + >=dev-python/pillow-4.2.1[${PYTHON_USEDEP}]
145 + >=dev-python/pylatexenc-1.4[${PYTHON_USEDEP}]
146 + >=dev-python/seaborn-0.9.0[${PYTHON_USEDEP}]
147 + >=dev-python/pygments-2.4[${PYTHON_USEDEP}]
148 + )"
149 +
150 +distutils_enable_tests pytest
151 +
152 +# Small issues with the tests.
153 +# qiskit.Aer module depends on qiskit-terra, it cannot be used,
154 +# and an exact comparison of float switched to approximate comparison.
155 +PATCHES=( "${FILESDIR}/qiskit-terra-0.19.2-test-corrections.patch" )
156 +
157 +python_test() {
158 + # We have to hide the source code directory so tests
159 + # do not use these, but instead the compiled library.
160 + mv qiskit qiskit.hidden || die
161 +
162 + # Some small tests are failing which test optional features.
163 + # Why they fail is still under investigation.
164 + # transpiler_equivalence tests take too long time, they are also skipped.
165 + epytest -k 'not (TestOptions and test_copy) and not TestUnitarySynthesisPlugin and not test_transpiler_equivalence and not (TestPauliSumOp and test_to_instruction)'
166 +
167 + mv qiskit.hidden qiskit || die
168 +}