[Buildroot] [PATCH 2/2] package/python-sympy: new package
Julien Olivain
ju.o at free.fr
Sat Apr 27 15:30:45 UTC 2024
SymPy is a Python library for symbolic mathematics. It aims
to become a full-featured computer algebra system (CAS)
while keeping the code as simple as possible in order to be
comprehensible and easily extensible. SymPy is written
entirely in Python.
https://www.sympy.org/
Signed-off-by: Julien Olivain <ju.o at free.fr>
---
Patch series tested on branch master at commit db37b0e with commands:
make check-package
...
0 warnings generated
support/testing/run-tests \
-d dl -o output_folder \
tests.package.test_python_mpmath
...
OK
support/testing/run-tests \
-d dl -o output_folder \
tests.package.test_python_sympy
...
OK
cat > python-sympy.config <<EOF
BR2_PACKAGE_PYTHON3=y
BR2_PACKAGE_PYTHON_SYMPY=y
EOF
utils/test-pkg -a -c python-sympy.config -p python-sympy
...
42 builds, 6 skipped, 0 build failed, 0 legal-info failed, 0 show-info failed
---
DEVELOPERS | 2 ++
package/Config.in | 1 +
package/python-sympy/Config.in | 11 +++++++++++
package/python-sympy/python-sympy.hash | 7 +++++++
package/python-sympy/python-sympy.mk | 14 ++++++++++++++
.../testing/tests/package/sample_python_sympy.py | 15 +++++++++++++++
.../testing/tests/package/test_python_sympy.py | 13 +++++++++++++
7 files changed, 63 insertions(+)
create mode 100644 package/python-sympy/Config.in
create mode 100644 package/python-sympy/python-sympy.hash
create mode 100644 package/python-sympy/python-sympy.mk
create mode 100644 support/testing/tests/package/sample_python_sympy.py
create mode 100644 support/testing/tests/package/test_python_sympy.py
diff --git a/DEVELOPERS b/DEVELOPERS
index e44a7298822..5ad71778d6c 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1769,6 +1769,7 @@ F: support/testing/tests/package/sample_python_ml_dtypes.py
F: support/testing/tests/package/sample_python_mpmath.py
F: support/testing/tests/package/sample_python_pyalsa.py
F: support/testing/tests/package/sample_python_spake2.py
+F: support/testing/tests/package/sample_python_sympy.py
F: support/testing/tests/package/test_acl.py
F: support/testing/tests/package/test_acpica.py
F: support/testing/tests/package/test_acpica/
@@ -1855,6 +1856,7 @@ F: support/testing/tests/package/test_python_ml_dtypes.py
F: support/testing/tests/package/test_python_mpmath.py
F: support/testing/tests/package/test_python_pyalsa.py
F: support/testing/tests/package/test_python_spake2.py
+F: support/testing/tests/package/test_python_sympy.py
F: support/testing/tests/package/test_rdma_core.py
F: support/testing/tests/package/test_rdma_core/
F: support/testing/tests/package/test_screen.py
diff --git a/package/Config.in b/package/Config.in
index 09e8b47a3c7..7b90a7080e6 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1370,6 +1370,7 @@ menu "External python modules"
source "package/python-sqlparse/Config.in"
source "package/python-stack-data/Config.in"
source "package/python-starlette/Config.in"
+ source "package/python-sympy/Config.in"
source "package/python-systemd/Config.in"
source "package/python-tabledata/Config.in"
source "package/python-tcolorpy/Config.in"
diff --git a/package/python-sympy/Config.in b/package/python-sympy/Config.in
new file mode 100644
index 00000000000..1ee26222dcf
--- /dev/null
+++ b/package/python-sympy/Config.in
@@ -0,0 +1,11 @@
+config BR2_PACKAGE_PYTHON_SYMPY
+ bool "python-sympy"
+ select BR2_PACKAGE_PYTHON_MPMATH # runtime
+ help
+ SymPy is a Python library for symbolic mathematics. It aims
+ to become a full-featured computer algebra system (CAS)
+ while keeping the code as simple as possible in order to be
+ comprehensible and easily extensible. SymPy is written
+ entirely in Python.
+
+ https://www.sympy.org/
diff --git a/package/python-sympy/python-sympy.hash b/package/python-sympy/python-sympy.hash
new file mode 100644
index 00000000000..947edfd4e08
--- /dev/null
+++ b/package/python-sympy/python-sympy.hash
@@ -0,0 +1,7 @@
+# md5, sha256 from https://pypi.org/pypi/sympy/json
+md5 3e0033109352d7303ea97b9216e16645 sympy-1.12.tar.gz
+sha256 ebf595c8dac3e0fdc4152c51878b498396ec7f30e7a914d6071e674d49420fb8 sympy-1.12.tar.gz
+# Locally computed sha256 checksums
+sha256 07a5e9819f727b4986ad2829c7a29a6320d42575f720eb24d71b7fef573a0286 LICENSE
+sha256 596639d3681fdb67bb2f05a9fcd2503d88bc549471a89b2e500cd9759ae2a3fa data/TeXmacs/LICENSE
+sha256 007bc30a58fa40a996e772047120de4eaf31f5110e4f9c3b5f93fcdfbe2eaca1 sympy/parsing/latex/LICENSE.txt
diff --git a/package/python-sympy/python-sympy.mk b/package/python-sympy/python-sympy.mk
new file mode 100644
index 00000000000..0f160649ad4
--- /dev/null
+++ b/package/python-sympy/python-sympy.mk
@@ -0,0 +1,14 @@
+################################################################################
+#
+# python-sympy
+#
+################################################################################
+
+PYTHON_SYMPY_VERSION = 1.12
+PYTHON_SYMPY_SOURCE = sympy-$(PYTHON_SYMPY_VERSION).tar.gz
+PYTHON_SYMPY_SITE = https://github.com/sympy/sympy/releases/download/sympy-$(PYTHON_SYMPY_VERSION)
+PYTHON_SYMPY_SETUP_TYPE = setuptools
+PYTHON_SYMPY_LICENSE = BSD-3-Clause
+PYTHON_SYMPY_LICENSE_FILES = LICENSE data/TeXmacs/LICENSE sympy/parsing/latex/LICENSE.txt
+
+$(eval $(python-package))
diff --git a/support/testing/tests/package/sample_python_sympy.py b/support/testing/tests/package/sample_python_sympy.py
new file mode 100644
index 00000000000..2734e9b4feb
--- /dev/null
+++ b/support/testing/tests/package/sample_python_sympy.py
@@ -0,0 +1,15 @@
+#! /usr/bin/env python3
+
+from sympy import symbols, expand, factor
+
+x, y = symbols('x y')
+
+expr = x + 2*y
+
+expanded_expr = expand(x*expr)
+print(expanded_expr)
+assert str(expanded_expr) == "x**2 + 2*x*y"
+
+factored_expr = factor(expanded_expr)
+print(factored_expr)
+assert str(factored_expr) == "x*(x + 2*y)"
diff --git a/support/testing/tests/package/test_python_sympy.py b/support/testing/tests/package/test_python_sympy.py
new file mode 100644
index 00000000000..e2106eb49ab
--- /dev/null
+++ b/support/testing/tests/package/test_python_sympy.py
@@ -0,0 +1,13 @@
+from tests.package.test_python import TestPythonPackageBase
+
+
+class TestPythonPy3SymPy(TestPythonPackageBase):
+ __test__ = True
+
+ config = TestPythonPackageBase.config + \
+ """
+ BR2_PACKAGE_PYTHON3=y
+ BR2_PACKAGE_PYTHON_SYMPY=y
+ """
+ sample_scripts = ["tests/package/sample_python_sympy.py"]
+ timeout = 20
--
2.44.0
More information about the buildroot
mailing list