Ver Fonte

package/python-sympy: new package

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@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Julien Olivain há 1 ano atrás
pai
commit
d46b0936ce

+ 2 - 0
DEVELOPERS

@@ -1784,6 +1784,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/
@@ -1878,6 +1879,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

+ 1 - 0
package/Config.in

@@ -1371,6 +1371,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"

+ 11 - 0
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/

+ 7 - 0
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

+ 14 - 0
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))

+ 15 - 0
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)"

+ 13 - 0
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