summaryrefslogtreecommitdiff
path: root/dev-python
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2022-05-03 01:49:40 +0100
committerSam James <sam@gentoo.org>2022-05-03 01:49:40 +0100
commitda3446bb7624729eb9d057fa17a10cdc46ff9d25 (patch)
treee815354ebb5c25799a4471daf57e812f79089dce /dev-python
parent8bbbe5e4ec96f6c8b2d2858f9c23fa8a24a797f2 (diff)
downloadgentoo-da3446bb7624729eb9d057fa17a10cdc46ff9d25.tar.gz
gentoo-da3446bb7624729eb9d057fa17a10cdc46ff9d25.tar.bz2
gentoo-da3446bb7624729eb9d057fa17a10cdc46ff9d25.zip
dev-python/symengine: fix build with >=setuptools-61; wheel duplication
Closes: https://bugs.gentoo.org/836599 Thanks-to: Michał Górny <mgorny@gentoo.org> Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'dev-python')
-rw-r--r--dev-python/symengine/files/symengine-0.9.2-cmake-setuptools.patch84
-rw-r--r--dev-python/symengine/files/symengine-0.9.2-setuptools-61.patch17
-rw-r--r--dev-python/symengine/symengine-0.9.2-r1.ebuild56
3 files changed, 157 insertions, 0 deletions
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
new file mode 100644
index 000000000000..3b930c998d99
--- /dev/null
+++ b/dev-python/symengine/files/symengine-0.9.2-cmake-setuptools.patch
@@ -0,0 +1,84 @@
+https://github.com/symengine/symengine.py/pull/402
+https://bugs.gentoo.org/836599
+
+From bc84086d60de038eb381c9e37c8b552a6c246ab5 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Mon, 2 May 2022 09:24:45 +0200
+Subject: [PATCH] Fix build to avoid duplicate files in wheel
+
+Fix the build system to package pure Python files
+via distutils/setuptools, and limit CMake to installing the compiled
+extension.
+
+The prior logic has installed some of the .py files both via setuptools
+and via CMake, to different build directories. As a result,
+the resulting wheel contained duplicate files, e.g.:
+
+ 2170 05-02-2022 07:08 symengine/__init__.py
+ 2170 05-02-2022 07:08 symengine-0.9.2.data/purelib/symengine/__init__.py
+
+Duplicate files cause the wheel to be rejected by the installer package.
+
+After the change, a correct wheel is generated. Installation works
+both via PEP517/wheel and via legacy `setup.py install`.
+--- a/setup.py
++++ b/setup.py
+@@ -226,7 +226,7 @@ def finalize_options(self):
+ url="https://github.com/symengine/symengine.py",
+ python_requires='>=3.7,<4',
+ zip_safe=False,
+- packages=['symengine'],
++ packages=['symengine', 'symengine.lib', 'symengine.tests'],
+ cmdclass = cmdclass,
+ classifiers=[
+ 'License :: OSI Approved :: MIT License',
+--- a/symengine/CMakeLists.txt
++++ b/symengine/CMakeLists.txt
+@@ -1,7 +1 @@
+ add_subdirectory(lib)
+-add_subdirectory(tests)
+-
+-set(PY_PATH ${PYTHON_INSTALL_PATH}/symengine)
+-install(FILES __init__.py utilities.py sympy_compat.py functions.py printing.py
+- DESTINATION ${PY_PATH}
+- )
+--- a/symengine/lib/CMakeLists.txt
++++ b/symengine/lib/CMakeLists.txt
+@@ -28,7 +28,7 @@ install(TARGETS symengine_wrapper
+ ARCHIVE DESTINATION ${PY_PATH}
+ LIBRARY DESTINATION ${PY_PATH}
+ )
+-install(FILES __init__.py
++install(FILES
+ ${CMAKE_CURRENT_BINARY_DIR}/config.pxi
+ symengine.pxd
+ symengine_wrapper.pxd
+--- a/symengine/tests/CMakeLists.txt
++++ /dev/null
+@@ -1,25 +0,0 @@
+-set(PY_PATH ${PYTHON_INSTALL_PATH}/symengine/tests)
+-install(FILES __init__.py
+- test_arit.py
+- test_dict_basic.py
+- test_eval.py
+- test_expr.py
+- test_functions.py
+- test_number.py
+- test_matrices.py
+- test_ntheory.py
+- test_printing.py
+- test_sage.py
+- test_series_expansion.py
+- test_sets.py
+- test_solve.py
+- test_subs.py
+- test_symbol.py
+- test_sympify.py
+- test_sympy_conv.py
+- test_var.py
+- test_lambdify.py
+- test_sympy_compat.py
+- test_logic.py
+- DESTINATION ${PY_PATH}
+- )
+
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
new file mode 100644
index 000000000000..a8fad4868110
--- /dev/null
+++ b/dev-python/symengine/files/symengine-0.9.2-setuptools-61.patch
@@ -0,0 +1,17 @@
+https://github.com/symengine/symengine.py/commit/987e665e71cf92d1b021d7d573a1b9733408eecf
+https://bugs.gentoo.org/836599
+
+From: Isuru Fernando <isuruf@gmail.com>
+Date: Sat, 2 Apr 2022 15:43:00 -0500
+Subject: [PATCH] Fix for latest setuptools
+
+--- a/setup.py
++++ b/setup.py
+@@ -226,6 +226,7 @@ def finalize_options(self):
+ url="https://github.com/symengine/symengine.py",
+ python_requires='>=3.7,<4',
+ zip_safe=False,
++ packages=['symengine'],
+ cmdclass = cmdclass,
+ classifiers=[
+ 'License :: OSI Approved :: MIT License',
diff --git a/dev-python/symengine/symengine-0.9.2-r1.ebuild b/dev-python/symengine/symengine-0.9.2-r1.ebuild
new file mode 100644
index 000000000000..15e6dd597f46
--- /dev/null
+++ b/dev-python/symengine/symengine-0.9.2-r1.ebuild
@@ -0,0 +1,56 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=setuptools
+PYTHON_COMPAT=( python3_{8..10} )
+
+inherit distutils-r1
+
+MY_P=${PN}.py-${PV}
+DESCRIPTION="Python wrappers to the symengine C++ library"
+HOMEPAGE="https://github.com/symengine/symengine.py/"
+SRC_URI="
+ https://github.com/symengine/symengine.py/archive/v${PV}.tar.gz
+ -> ${MY_P}.tar.gz"
+S="${WORKDIR}/${MY_P}"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~riscv ~x86"
+
+BDEPEND="
+ dev-util/cmake
+ dev-python/cython[${PYTHON_USEDEP}]
+ test? (
+ dev-python/sympy[${PYTHON_USEDEP}]
+ )
+"
+# See bug #786582 for symengine constraint
+# See also https://github.com/symengine/symengine.py/blob/master/symengine_version.txt
+RDEPEND="
+ dev-python/numpy[${PYTHON_USEDEP}]
+ >=sci-libs/symengine-$(ver_cut 1-2):=
+"
+DEPEND="${RDEPEND}"
+
+# the C library installs the same docs
+DOCS=()
+
+PATCHES=(
+ "${FILESDIR}"/${P}-setuptools-61.patch
+ "${FILESDIR}"/${PN}-0.9.2-cmake-setuptools.patch
+)
+
+distutils_enable_tests pytest
+
+python_test() {
+ cd "${BUILD_DIR}/install$(python_get_sitedir)" || die
+ epytest
+}
+
+python_install() {
+ distutils-r1_python_install
+ python_optimize
+}