All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/2] package/python-mpmath: new package
@ 2024-04-27 15:30 Julien Olivain
  2024-04-27 15:30 ` [Buildroot] [PATCH 2/2] package/python-sympy: " Julien Olivain
  2024-05-09 20:30 ` [Buildroot] [PATCH 1/2] package/python-mpmath: " Thomas Petazzoni via buildroot
  0 siblings, 2 replies; 3+ messages in thread
From: Julien Olivain @ 2024-04-27 15:30 UTC (permalink / raw)
  To: buildroot; +Cc: Julien Olivain, James Hilliard, Asaf Kahlon, Thomas Petazzoni

mpmath is a free (BSD licensed) Python library for real and
complex floating-point arithmetic with arbitrary precision.

https://mpmath.org/

Signed-off-by: Julien Olivain <ju.o@free.fr>
---
 DEVELOPERS                                       |  2 ++
 package/Config.in                                |  1 +
 package/python-mpmath/Config.in                  |  7 +++++++
 package/python-mpmath/python-mpmath.hash         |  3 +++
 package/python-mpmath/python-mpmath.mk           | 14 ++++++++++++++
 .../tests/package/sample_python_mpmath.py        | 16 ++++++++++++++++
 .../testing/tests/package/test_python_mpmath.py  | 12 ++++++++++++
 7 files changed, 55 insertions(+)
 create mode 100644 package/python-mpmath/Config.in
 create mode 100644 package/python-mpmath/python-mpmath.hash
 create mode 100644 package/python-mpmath/python-mpmath.mk
 create mode 100644 support/testing/tests/package/sample_python_mpmath.py
 create mode 100644 support/testing/tests/package/test_python_mpmath.py

diff --git a/DEVELOPERS b/DEVELOPERS
index 399b2931ff3..e44a7298822 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1766,6 +1766,7 @@ F:	support/testing/tests/package/sample_python_gnupg.py
 F:	support/testing/tests/package/sample_python_hwdata.py
 F:	support/testing/tests/package/sample_python_midiutil.py
 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/test_acl.py
@@ -1851,6 +1852,7 @@ F:	support/testing/tests/package/test_python_hwdata.py
 F:	support/testing/tests/package/test_python_magic_wormhole.py
 F:	support/testing/tests/package/test_python_midiutil.py
 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_rdma_core.py
diff --git a/package/Config.in b/package/Config.in
index 1935077f0f4..09e8b47a3c7 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1197,6 +1197,7 @@ menu "External python modules"
 	source "package/python-modbus-tk/Config.in"
 	source "package/python-more-itertools/Config.in"
 	source "package/python-mpd2/Config.in"
+	source "package/python-mpmath/Config.in"
 	source "package/python-msgfy/Config.in"
 	source "package/python-msgpack/Config.in"
 	source "package/python-multidict/Config.in"
diff --git a/package/python-mpmath/Config.in b/package/python-mpmath/Config.in
new file mode 100644
index 00000000000..497b7d2ae3d
--- /dev/null
+++ b/package/python-mpmath/Config.in
@@ -0,0 +1,7 @@
+config BR2_PACKAGE_PYTHON_MPMATH
+	bool "python-mpmath"
+	help
+	  mpmath is a free (BSD licensed) Python library for real and
+	  complex floating-point arithmetic with arbitrary precision.
+
+	  https://mpmath.org/
diff --git a/package/python-mpmath/python-mpmath.hash b/package/python-mpmath/python-mpmath.hash
new file mode 100644
index 00000000000..1b263c925f7
--- /dev/null
+++ b/package/python-mpmath/python-mpmath.hash
@@ -0,0 +1,3 @@
+# Locally computed sha256 checksums
+sha256  7a28eb2a9774d00c7bc92411c19a89209d5da7c4c9a9e227be8330a23a25b91f  mpmath-1.3.0.tar.gz
+sha256  c26cae81da4508e5e249985777a33821f183223ebb74d7f8cfbf90fe7eef2fb7  LICENSE
diff --git a/package/python-mpmath/python-mpmath.mk b/package/python-mpmath/python-mpmath.mk
new file mode 100644
index 00000000000..caa64929619
--- /dev/null
+++ b/package/python-mpmath/python-mpmath.mk
@@ -0,0 +1,14 @@
+################################################################################
+#
+# python-mpmath
+#
+################################################################################
+
+PYTHON_MPMATH_VERSION = 1.3.0
+PYTHON_MPMATH_SOURCE = mpmath-$(PYTHON_MPMATH_VERSION).tar.gz
+PYTHON_MPMATH_SITE = https://mpmath.org/files
+PYTHON_MPMATH_SETUP_TYPE = setuptools
+PYTHON_MPMATH_LICENSE = BSD-3-Clause
+PYTHON_MPMATH_LICENSE_FILES = LICENSE
+
+$(eval $(python-package))
diff --git a/support/testing/tests/package/sample_python_mpmath.py b/support/testing/tests/package/sample_python_mpmath.py
new file mode 100644
index 00000000000..5e3d9ad1c24
--- /dev/null
+++ b/support/testing/tests/package/sample_python_mpmath.py
@@ -0,0 +1,16 @@
+#! /usr/bin/env python3
+
+# Test inspired from example published on the project page:
+# https://mpmath.org/
+
+from mpmath import mp
+
+mp.dps = 50
+
+result = mp.quad(lambda x: mp.exp(-x**2), [-mp.inf, mp.inf]) ** 2
+
+# Pi digits can be cross-checked here:
+# https://www.angio.net/pi/digits.html
+expected_result = "3.1415926535897932384626433832795028841971693993751"
+
+assert str(result) == expected_result
diff --git a/support/testing/tests/package/test_python_mpmath.py b/support/testing/tests/package/test_python_mpmath.py
new file mode 100644
index 00000000000..c20c910fbec
--- /dev/null
+++ b/support/testing/tests/package/test_python_mpmath.py
@@ -0,0 +1,12 @@
+from tests.package.test_python import TestPythonPackageBase
+
+
+class TestPythonPy3MpMath(TestPythonPackageBase):
+    __test__ = True
+
+    config = TestPythonPackageBase.config + \
+        """
+        BR2_PACKAGE_PYTHON3=y
+        BR2_PACKAGE_PYTHON_MPMATH=y
+        """
+    sample_scripts = ["tests/package/sample_python_mpmath.py"]
-- 
2.44.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-05-09 20:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-27 15:30 [Buildroot] [PATCH 1/2] package/python-mpmath: new package Julien Olivain
2024-04-27 15:30 ` [Buildroot] [PATCH 2/2] package/python-sympy: " Julien Olivain
2024-05-09 20:30 ` [Buildroot] [PATCH 1/2] package/python-mpmath: " Thomas Petazzoni via buildroot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.