1 |
commit: da3446bb7624729eb9d057fa17a10cdc46ff9d25 |
2 |
Author: Sam James <sam <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue May 3 00:49:40 2022 +0000 |
4 |
Commit: Sam James <sam <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue May 3 00:49:40 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=da3446bb |
7 |
|
8 |
dev-python/symengine: fix build with >=setuptools-61; wheel duplication |
9 |
|
10 |
Closes: https://bugs.gentoo.org/836599 |
11 |
Thanks-to: Michał Górny <mgorny <AT> gentoo.org> |
12 |
Signed-off-by: Sam James <sam <AT> gentoo.org> |
13 |
|
14 |
.../files/symengine-0.9.2-cmake-setuptools.patch | 84 ++++++++++++++++++++++ |
15 |
.../files/symengine-0.9.2-setuptools-61.patch | 17 +++++ |
16 |
dev-python/symengine/symengine-0.9.2-r1.ebuild | 56 +++++++++++++++ |
17 |
3 files changed, 157 insertions(+) |
18 |
|
19 |
diff --git a/dev-python/symengine/files/symengine-0.9.2-cmake-setuptools.patch b/dev-python/symengine/files/symengine-0.9.2-cmake-setuptools.patch |
20 |
new file mode 100644 |
21 |
index 000000000000..3b930c998d99 |
22 |
--- /dev/null |
23 |
+++ b/dev-python/symengine/files/symengine-0.9.2-cmake-setuptools.patch |
24 |
@@ -0,0 +1,84 @@ |
25 |
+https://github.com/symengine/symengine.py/pull/402 |
26 |
+https://bugs.gentoo.org/836599 |
27 |
+ |
28 |
+From bc84086d60de038eb381c9e37c8b552a6c246ab5 Mon Sep 17 00:00:00 2001 |
29 |
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@g.o> |
30 |
+Date: Mon, 2 May 2022 09:24:45 +0200 |
31 |
+Subject: [PATCH] Fix build to avoid duplicate files in wheel |
32 |
+ |
33 |
+Fix the build system to package pure Python files |
34 |
+via distutils/setuptools, and limit CMake to installing the compiled |
35 |
+extension. |
36 |
+ |
37 |
+The prior logic has installed some of the .py files both via setuptools |
38 |
+and via CMake, to different build directories. As a result, |
39 |
+the resulting wheel contained duplicate files, e.g.: |
40 |
+ |
41 |
+ 2170 05-02-2022 07:08 symengine/__init__.py |
42 |
+ 2170 05-02-2022 07:08 symengine-0.9.2.data/purelib/symengine/__init__.py |
43 |
+ |
44 |
+Duplicate files cause the wheel to be rejected by the installer package. |
45 |
+ |
46 |
+After the change, a correct wheel is generated. Installation works |
47 |
+both via PEP517/wheel and via legacy `setup.py install`. |
48 |
+--- a/setup.py |
49 |
++++ b/setup.py |
50 |
+@@ -226,7 +226,7 @@ def finalize_options(self): |
51 |
+ url="https://github.com/symengine/symengine.py", |
52 |
+ python_requires='>=3.7,<4', |
53 |
+ zip_safe=False, |
54 |
+- packages=['symengine'], |
55 |
++ packages=['symengine', 'symengine.lib', 'symengine.tests'], |
56 |
+ cmdclass = cmdclass, |
57 |
+ classifiers=[ |
58 |
+ 'License :: OSI Approved :: MIT License', |
59 |
+--- a/symengine/CMakeLists.txt |
60 |
++++ b/symengine/CMakeLists.txt |
61 |
+@@ -1,7 +1 @@ |
62 |
+ add_subdirectory(lib) |
63 |
+-add_subdirectory(tests) |
64 |
+- |
65 |
+-set(PY_PATH ${PYTHON_INSTALL_PATH}/symengine) |
66 |
+-install(FILES __init__.py utilities.py sympy_compat.py functions.py printing.py |
67 |
+- DESTINATION ${PY_PATH} |
68 |
+- ) |
69 |
+--- a/symengine/lib/CMakeLists.txt |
70 |
++++ b/symengine/lib/CMakeLists.txt |
71 |
+@@ -28,7 +28,7 @@ install(TARGETS symengine_wrapper |
72 |
+ ARCHIVE DESTINATION ${PY_PATH} |
73 |
+ LIBRARY DESTINATION ${PY_PATH} |
74 |
+ ) |
75 |
+-install(FILES __init__.py |
76 |
++install(FILES |
77 |
+ ${CMAKE_CURRENT_BINARY_DIR}/config.pxi |
78 |
+ symengine.pxd |
79 |
+ symengine_wrapper.pxd |
80 |
+--- a/symengine/tests/CMakeLists.txt |
81 |
++++ /dev/null |
82 |
+@@ -1,25 +0,0 @@ |
83 |
+-set(PY_PATH ${PYTHON_INSTALL_PATH}/symengine/tests) |
84 |
+-install(FILES __init__.py |
85 |
+- test_arit.py |
86 |
+- test_dict_basic.py |
87 |
+- test_eval.py |
88 |
+- test_expr.py |
89 |
+- test_functions.py |
90 |
+- test_number.py |
91 |
+- test_matrices.py |
92 |
+- test_ntheory.py |
93 |
+- test_printing.py |
94 |
+- test_sage.py |
95 |
+- test_series_expansion.py |
96 |
+- test_sets.py |
97 |
+- test_solve.py |
98 |
+- test_subs.py |
99 |
+- test_symbol.py |
100 |
+- test_sympify.py |
101 |
+- test_sympy_conv.py |
102 |
+- test_var.py |
103 |
+- test_lambdify.py |
104 |
+- test_sympy_compat.py |
105 |
+- test_logic.py |
106 |
+- DESTINATION ${PY_PATH} |
107 |
+- ) |
108 |
+ |
109 |
|
110 |
diff --git a/dev-python/symengine/files/symengine-0.9.2-setuptools-61.patch b/dev-python/symengine/files/symengine-0.9.2-setuptools-61.patch |
111 |
new file mode 100644 |
112 |
index 000000000000..a8fad4868110 |
113 |
--- /dev/null |
114 |
+++ b/dev-python/symengine/files/symengine-0.9.2-setuptools-61.patch |
115 |
@@ -0,0 +1,17 @@ |
116 |
+https://github.com/symengine/symengine.py/commit/987e665e71cf92d1b021d7d573a1b9733408eecf |
117 |
+https://bugs.gentoo.org/836599 |
118 |
+ |
119 |
+From: Isuru Fernando <isuruf@×××××.com> |
120 |
+Date: Sat, 2 Apr 2022 15:43:00 -0500 |
121 |
+Subject: [PATCH] Fix for latest setuptools |
122 |
+ |
123 |
+--- a/setup.py |
124 |
++++ b/setup.py |
125 |
+@@ -226,6 +226,7 @@ def finalize_options(self): |
126 |
+ url="https://github.com/symengine/symengine.py", |
127 |
+ python_requires='>=3.7,<4', |
128 |
+ zip_safe=False, |
129 |
++ packages=['symengine'], |
130 |
+ cmdclass = cmdclass, |
131 |
+ classifiers=[ |
132 |
+ 'License :: OSI Approved :: MIT License', |
133 |
|
134 |
diff --git a/dev-python/symengine/symengine-0.9.2-r1.ebuild b/dev-python/symengine/symengine-0.9.2-r1.ebuild |
135 |
new file mode 100644 |
136 |
index 000000000000..15e6dd597f46 |
137 |
--- /dev/null |
138 |
+++ b/dev-python/symengine/symengine-0.9.2-r1.ebuild |
139 |
@@ -0,0 +1,56 @@ |
140 |
+# Copyright 1999-2022 Gentoo Authors |
141 |
+# Distributed under the terms of the GNU General Public License v2 |
142 |
+ |
143 |
+EAPI=8 |
144 |
+ |
145 |
+DISTUTILS_USE_PEP517=setuptools |
146 |
+PYTHON_COMPAT=( python3_{8..10} ) |
147 |
+ |
148 |
+inherit distutils-r1 |
149 |
+ |
150 |
+MY_P=${PN}.py-${PV} |
151 |
+DESCRIPTION="Python wrappers to the symengine C++ library" |
152 |
+HOMEPAGE="https://github.com/symengine/symengine.py/" |
153 |
+SRC_URI=" |
154 |
+ https://github.com/symengine/symengine.py/archive/v${PV}.tar.gz |
155 |
+ -> ${MY_P}.tar.gz" |
156 |
+S="${WORKDIR}/${MY_P}" |
157 |
+ |
158 |
+LICENSE="MIT" |
159 |
+SLOT="0" |
160 |
+KEYWORDS="~amd64 ~arm ~arm64 ~riscv ~x86" |
161 |
+ |
162 |
+BDEPEND=" |
163 |
+ dev-util/cmake |
164 |
+ dev-python/cython[${PYTHON_USEDEP}] |
165 |
+ test? ( |
166 |
+ dev-python/sympy[${PYTHON_USEDEP}] |
167 |
+ ) |
168 |
+" |
169 |
+# See bug #786582 for symengine constraint |
170 |
+# See also https://github.com/symengine/symengine.py/blob/master/symengine_version.txt |
171 |
+RDEPEND=" |
172 |
+ dev-python/numpy[${PYTHON_USEDEP}] |
173 |
+ >=sci-libs/symengine-$(ver_cut 1-2):= |
174 |
+" |
175 |
+DEPEND="${RDEPEND}" |
176 |
+ |
177 |
+# the C library installs the same docs |
178 |
+DOCS=() |
179 |
+ |
180 |
+PATCHES=( |
181 |
+ "${FILESDIR}"/${P}-setuptools-61.patch |
182 |
+ "${FILESDIR}"/${PN}-0.9.2-cmake-setuptools.patch |
183 |
+) |
184 |
+ |
185 |
+distutils_enable_tests pytest |
186 |
+ |
187 |
+python_test() { |
188 |
+ cd "${BUILD_DIR}/install$(python_get_sitedir)" || die |
189 |
+ epytest |
190 |
+} |
191 |
+ |
192 |
+python_install() { |
193 |
+ distutils-r1_python_install |
194 |
+ python_optimize |
195 |
+} |