Skip to contentSkip to conversation

package/python-diskcache: new package

PATCH In review Marcus Hoffmann via buildroot 1 participant 2 messages Feb 26, 2025 – Oct 16, 2025

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 package/python-diskcache: new package

The package imports itself in setup.py to get the package-name and version number. This doesn't work during the buildroot build, so we replace this by the hardcoded package-name and the version number stored in buildroot.

---

Changes v2: remove accidentally commited .swp file Chanegs v3: fix python-diskcache.mk lint errors

 DEVELOPERS                                    |  3 +++
 package/Config.in                             |  1 +
 package/python-diskcache/Config.in            |  8 ++++++++
 .../python-diskcache/python-diskcache.hash    |  5 +++++
 package/python-diskcache/python-diskcache.mk  | 20 +++++++++++++++++++
 .../tests/package/sample_python_diskcache.py  |  9 +++++++++
 .../tests/package/test_python_diskcache.py    | 12 +++++++++++
 7 files changed, 58 insertions(+)
 create mode 100644 package/python-diskcache/Config.in
 create mode 100644 package/python-diskcache/python-diskcache.hash
 create mode 100644 package/python-diskcache/python-diskcache.mk
 create mode 100644 support/testing/tests/package/sample_python_diskcache.py
 create mode 100644 support/testing/tests/package/test_python_diskcache.py
DEVELOPERS +3 -0
index c07837e431..6676f2cf31 100644
@@ -2257,13 +2257,16 @@ N:	Marcus Hoffmann <[email protected]>
 F:	package/nethogs/
 F:	package/pico-sdk/
 F:	package/picotool/
+F:	package/python-diskcache/
 F:	package/python-immutabledict/
 F:	package/python-jc/
 F:	package/python-ruamel-yaml-clib/
 F:	package/python-waitress/
+F:	support/testing/tests/package/test_python_diskcache.py
 F:	support/testing/tests/package/test_python_fastapi.py
 F:	support/testing/tests/package/test_python_ruamel_yaml.py
 F:	support/testing/tests/package/test_python_waitress.py
+F:	support/testing/tests/package/sample_python_diskcache.py
 F:	support/testing/tests/package/sample_python_fastapi.py
 F:	support/testing/tests/package/sample_python_ruamel_yaml.py
 
package/Config.in +1 -0
index 4a81a62ec4..7e9ba87e30 100644
@@ -1084,6 +1084,7 @@ menu "External python modules"
 	source "package/python-dictdiffer/Config.in"
 	source "package/python-dicttoxml/Config.in"
 	source "package/python-dicttoxml2/Config.in"
+	source "package/python-diskcache/Config.in"
 	source "package/python-distro/Config.in"
 	source "package/python-django/Config.in"
 	source "package/python-django-enumfields/Config.in"
package/python-diskcache/Config.in new file +8 -0
new file mode 100644
index 0000000000..4bf6c57406
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_PYTHON_DISKCACHE
+	bool "python-diskcache"
+	select BR2_PACKAGE_PYTHON3_SQLITE # runtime
+	select BR2_PACKAGE_PYTHON3_ZLIB # runtime
+	help
+	  Disk Cache -- Disk and file backed persistent cache.
+
+	  http://www.grantjenks.com/docs/diskcache/
package/python-diskcache/python-diskcache.hash new file +5 -0
new file mode 100644
index 0000000000..4befb40a4e
@@ -0,0 +1,5 @@
+# md5, sha256 from https://pypi.org/pypi/diskcache/json
+md5  d92b4afa944bb70ed38c84a622f7abb5  diskcache-5.6.3.tar.gz
+sha256  2c3a3fa2743d8535d832ec61c2054a1641f41775aa7c556758a109941e33e4fc  diskcache-5.6.3.tar.gz
+# Locally computed sha256 checksums
+sha256  583546baa3fd93607d845126570677a401f508e228b5044fefbc3949af179672  LICENSE
package/python-diskcache/python-diskcache.mk new file +20 -0
new file mode 100644
index 0000000000..327d076779
@@ -0,0 +1,20 @@
+################################################################################
+#
+# python-diskcache
+#
+################################################################################
+
+PYTHON_DISKCACHE_VERSION = 5.6.3
+PYTHON_DISKCACHE_SOURCE = diskcache-$(PYTHON_DISKCACHE_VERSION).tar.gz
+PYTHON_DISKCACHE_SITE = https://files.pythonhosted.org/packages/3f/21/1c1ffc1a039ddcc459db43cc108658f32c57d271d7289a2794e401d0fdb6
+PYTHON_DISKCACHE_SETUP_TYPE = setuptools
+PYTHON_DISKCACHE_LICENSE = Apache-2.0
+PYTHON_DISKCACHE_LICENSE_FILES = LICENSE
+
+define PYTHON_DISKCACHE_REMOVE_SELF_IMPORT
+	sed -i -e '/import diskcache/d' -e 's/diskcache.__title__/"diskcache"/' -e 's/diskcache.__version__/"$(PYTHON_DISKCACHE_VERSION)"/' $(@D)/setup.py
+endef
+
+PYTHON_DISKCACHE_POST_PATCH_HOOKS += PYTHON_DISKCACHE_REMOVE_SELF_IMPORT
+
+$(eval $(python-package))
support/testing/tests/package/sample_python_diskcache.py new file +9 -0
new file mode 100644
index 0000000000..8ba34daf6e
@@ -0,0 +1,9 @@
+from diskcache import Cache
+
+cache = Cache()
+
+cache['test'] = 123
+assert cache['test'] == 123
+del cache['test']
+assert 'test' not in cache
+cache.close()
support/testing/tests/package/test_python_diskcache.py new file +12 -0
new file mode 100644
index 0000000000..d8618c1681
@@ -0,0 +1,12 @@
+from tests.package.test_python import TestPythonPackageBase
+
+
+class TestPythonPy3DiskCache(TestPythonPackageBase):
+    __test__ = True
+    config = TestPythonPackageBase.config + \
+        """
+        BR2_PACKAGE_PYTHON3=y
+        BR2_PACKAGE_PYTHON_DISKCACHE=y
+        """
+    sample_scripts = ["tests/package/sample_python_diskcache.py"]
+    timeout = 10
Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

Hi,

Quoted 6 lines · Marcus Hoffmann via buildroot

The package imports itself in setup.py to get the package-name and version number. This doesn't work during the buildroot build, so we replace this by the hardcoded package-name and the version number stored in buildroot.

I wanted to ask if there's anything I can do to help getting this reviewed/merged. This has unfortunately been setting for almost 8 months now, while later python packages I submitted have long been merged.

Quoted 126 lines

---

Changes v2: remove accidentally commited .swp file Chanegs v3: fix python-diskcache.mk lint errors

  DEVELOPERS                                    |  3 +++
  package/Config.in                             |  1 +
  package/python-diskcache/Config.in            |  8 ++++++++
  .../python-diskcache/python-diskcache.hash    |  5 +++++
  package/python-diskcache/python-diskcache.mk  | 20 +++++++++++++++++++
  .../tests/package/sample_python_diskcache.py  |  9 +++++++++
  .../tests/package/test_python_diskcache.py    | 12 +++++++++++
  7 files changed, 58 insertions(+)

create mode 100644 package/python-diskcache/Config.in
create mode 100644 package/python-diskcache/python-diskcache.hash create mode 100644 package/python-diskcache/python-diskcache.mk create mode 100644 support/testing/tests/package/sample_python_diskcache.py create mode 100644 support/testing/tests/package/test_python_diskcache.py

DEVELOPERS +3 -0
index c07837e431..6676f2cf31 100644
@@ -2257,13 +2257,16 @@ N:	Marcus Hoffmann <[email protected]>
  F:	package/nethogs/
  F:	package/pico-sdk/
  F:	package/picotool/
+F:	package/python-diskcache/
  F:	package/python-immutabledict/
  F:	package/python-jc/
  F:	package/python-ruamel-yaml-clib/
  F:	package/python-waitress/
+F:	support/testing/tests/package/test_python_diskcache.py
  F:	support/testing/tests/package/test_python_fastapi.py
  F:	support/testing/tests/package/test_python_ruamel_yaml.py
  F:	support/testing/tests/package/test_python_waitress.py
+F:	support/testing/tests/package/sample_python_diskcache.py
  F:	support/testing/tests/package/sample_python_fastapi.py
  F:	support/testing/tests/package/sample_python_ruamel_yaml.py
 
package/Config.in +1 -0
index 4a81a62ec4..7e9ba87e30 100644
@@ -1084,6 +1084,7 @@ menu "External python modules"
  	source "package/python-dictdiffer/Config.in"
  	source "package/python-dicttoxml/Config.in"
  	source "package/python-dicttoxml2/Config.in"
+	source "package/python-diskcache/Config.in"
  	source "package/python-distro/Config.in"
  	source "package/python-django/Config.in"
  	source "package/python-django-enumfields/Config.in"
package/python-diskcache/Config.in new file +8 -0
new file mode 100644
index 0000000000..4bf6c57406
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_PYTHON_DISKCACHE
+	bool "python-diskcache"
+	select BR2_PACKAGE_PYTHON3_SQLITE # runtime
+	select BR2_PACKAGE_PYTHON3_ZLIB # runtime
+	help
+	  Disk Cache -- Disk and file backed persistent cache.
+
+	  http://www.grantjenks.com/docs/diskcache/
package/python-diskcache/python-diskcache.hash new file +5 -0
new file mode 100644
index 0000000000..4befb40a4e
@@ -0,0 +1,5 @@
+# md5, sha256 from https://pypi.org/pypi/diskcache/json
+md5  d92b4afa944bb70ed38c84a622f7abb5  diskcache-5.6.3.tar.gz
+sha256  2c3a3fa2743d8535d832ec61c2054a1641f41775aa7c556758a109941e33e4fc  diskcache-5.6.3.tar.gz
+# Locally computed sha256 checksums
+sha256  583546baa3fd93607d845126570677a401f508e228b5044fefbc3949af179672  LICENSE
package/python-diskcache/python-diskcache.mk new file +20 -0
new file mode 100644
index 0000000000..327d076779
@@ -0,0 +1,20 @@
+################################################################################
+#
+# python-diskcache
+#
+################################################################################
+
+PYTHON_DISKCACHE_VERSION = 5.6.3
+PYTHON_DISKCACHE_SOURCE = diskcache-$(PYTHON_DISKCACHE_VERSION).tar.gz
+PYTHON_DISKCACHE_SITE = https://files.pythonhosted.org/packages/3f/21/1c1ffc1a039ddcc459db43cc108658f32c57d271d7289a2794e401d0fdb6
+PYTHON_DISKCACHE_SETUP_TYPE = setuptools
+PYTHON_DISKCACHE_LICENSE = Apache-2.0
+PYTHON_DISKCACHE_LICENSE_FILES = LICENSE
+
+define PYTHON_DISKCACHE_REMOVE_SELF_IMPORT
+	sed -i -e '/import diskcache/d' -e 's/diskcache.__title__/"diskcache"/' -e 's/diskcache.__version__/"$(PYTHON_DISKCACHE_VERSION)"/' $(@D)/setup.py
+endef
+
+PYTHON_DISKCACHE_POST_PATCH_HOOKS += PYTHON_DISKCACHE_REMOVE_SELF_IMPORT
+
+$(eval $(python-package))
support/testing/tests/package/sample_python_diskcache.py new file +9 -0
new file mode 100644
index 0000000000..8ba34daf6e
@@ -0,0 +1,9 @@
+from diskcache import Cache
+
+cache = Cache()
+
+cache['test'] = 123
+assert cache['test'] == 123
+del cache['test']
+assert 'test' not in cache
+cache.close()
support/testing/tests/package/test_python_diskcache.py new file +2 -0
new file mode 100644
index 0000000000..d8618c1681
@@ -0,0 +1,12 @@
+from tests.package.test_python import TestPythonPackageBase
+

support/testing/tests/package/test_python_diskcache.py line 12

Quoted 10 lines
support/testing/tests/package/test_python_diskcache.py new file +10 -0
+
+class TestPythonPy3DiskCache(TestPythonPackageBase):
+    __test__ = True
+    config = TestPythonPackageBase.config + \
+        """
+        BR2_PACKAGE_PYTHON3=y
+        BR2_PACKAGE_PYTHON_DISKCACHE=y
+        """
+    sample_scripts = ["tests/package/sample_python_diskcache.py"]
+    timeout = 10

Marcus
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot