diff mbox series

[v1,2/7] package/python-threadpoolctl: new package

Message ID 20220816143943.16142-2-guillaume.bressaix@gmail.com
State Changes Requested
Headers show
Series [v1,1/7] package/python-joblib: new package | expand

Commit Message

Guillaume Bres Aug. 16, 2022, 2:39 p.m. UTC
package/python-scikitlearn needs python-threadpoolctl as a
runtime dependency.

Signed-off-by: Guillaume W. Bres <guillaume.bressaix@gmail.com>
---
python-threadpoolctl originally builds with "flit", whose
build process merely consists in copying threadpoolctl.py to
the /usr/lib python pool. As we have no knowledge of "flit",
I simply used the buildroot infra to recreate this behavior.
Let me know of any suggestion
---
 DEVELOPERS                                    |  1 +
 package/Config.in                             |  1 +
 package/python-threadpoolctl/Config.in        | 10 +++++++++
 .../python-threadpoolctl.hash                 |  3 +++
 .../python-threadpoolctl.mk                   | 22 +++++++++++++++++++
 5 files changed, 37 insertions(+)
 create mode 100644 package/python-threadpoolctl/Config.in
 create mode 100644 package/python-threadpoolctl/python-threadpoolctl.hash
 create mode 100644 package/python-threadpoolctl/python-threadpoolctl.mk
diff mbox series

Patch

diff --git a/DEVELOPERS b/DEVELOPERS
index 2c4f9ed76e..21a35cf9d1 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1195,6 +1195,7 @@  F:	package/python-joblib/
 F:	package/python-pybind/
 F:	package/python-pythran/
 F:	package/python-scipy/
+F:	package/python-threadpoolctl/
 F:	package/reaver/
 F:	support/testing/tests/package/br2-external/python-pybind
 F:	support/testing/tests/package/sample_python_pybind.py
diff --git a/package/Config.in b/package/Config.in
index 7f017c92e9..876d7309eb 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1274,6 +1274,7 @@  menu "External python modules"
 	source "package/python-termcolor/Config.in"
 	source "package/python-terminaltables/Config.in"
 	source "package/python-texttable/Config.in"
+	source "package/python-threadpoolctl/Config.in"
 	source "package/python-thrift/Config.in"
 	source "package/python-tinycss2/Config.in"
 	source "package/python-tinyrpc/Config.in"
diff --git a/package/python-threadpoolctl/Config.in b/package/python-threadpoolctl/Config.in
new file mode 100644
index 0000000000..127de3bc39
--- /dev/null
+++ b/package/python-threadpoolctl/Config.in
@@ -0,0 +1,10 @@ 
+config BR2_PACKAGE_PYTHON_THREADPOOLCTL
+	bool "python-threadpoolctl"
+	depends on BR2_PACKAGE_PYTHON3
+	help
+	  Python helpers to limit the number of threads
+	  used in the threadpool-backed of common native
+	  libraries used for scientific computing and
+	  data science (e.g. BLAS and OpenMP).
+
+	  https://github.com/joblib/threadpoolctl
diff --git a/package/python-threadpoolctl/python-threadpoolctl.hash b/package/python-threadpoolctl/python-threadpoolctl.hash
new file mode 100644
index 0000000000..6b6fa72443
--- /dev/null
+++ b/package/python-threadpoolctl/python-threadpoolctl.hash
@@ -0,0 +1,3 @@ 
+# Locally calculated
+sha256  449b806f9147a3cf28ed7ec6389dbff9c450331d695873ab75dea79fe661f1e7  python-threadpoolctl-3.1.0.tar.gz
+sha256  81ac619075248b06e53660b652d10e485f4675f5d0ae0f97ea22370da1f7e23b  LICENSE
diff --git a/package/python-threadpoolctl/python-threadpoolctl.mk b/package/python-threadpoolctl/python-threadpoolctl.mk
new file mode 100644
index 0000000000..50f77b1b1f
--- /dev/null
+++ b/package/python-threadpoolctl/python-threadpoolctl.mk
@@ -0,0 +1,22 @@ 
+################################################################################
+#
+# python-threadpoolctl
+#
+################################################################################
+
+PYTHON_THREADPOOLCTL_VERSION = 3.1.0
+PYTHON_THREADPOOLCTL_SITE = $(call github,joblib,threadpoolctl,$(PYTHON_THREADPOOLCTL_VERSION),$(PYTHON_THREADPOOLCTL_VERSION).tar.gz)
+PYTHON_THREADPOOLCTL_LICENSE = BSD-3-Clause
+PYTHON_THREADPOOLCTL_LICENSE_FILES = LICENSE
+
+# threadpoolctl is originally built using 'flit' which
+# simply symlinks $(@D)/threadpoolctl.py to site-packages
+define PYTHON_THREADPOOLCTL_BUILD_CMDS
+endef
+
+define PYTHON_THREADPOOLCTL_INSTALL_TARGET_CMDS
+	cp $(@D)/threadpoolctl.py \
+		$(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)
+endef
+
+$(eval $(generic-package))