python-lru-dict: update to 1.4.1; add test.sh
authorAlexandru Ardelean <redacted>
Thu, 16 Apr 2026 16:41:01 +0000 (19:41 +0300)
committerAlexandru Ardelean <redacted>
Fri, 17 Apr 2026 10:46:59 +0000 (13:46 +0300)
Add PYPI_SOURCE_NAME:=lru_dict as the sdist tarball filename
uses underscores while PYPI_NAME uses hyphens.

Signed-off-by: Alexandru Ardelean <redacted>
lang/python/python-lru-dict/Makefile
lang/python/python-lru-dict/patches/001-unpin-setuptools.patch [new file with mode: 0644]
lang/python/python-lru-dict/test.sh [new file with mode: 0644]

index a5171d6e0a850e165981352c360f18fd71f62608..70db77e65b187e2b446882ce009f8596bef5d022 100644 (file)
@@ -1,11 +1,14 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=python-lru-dict
-PKG_VERSION:=1.3.0
+PKG_VERSION:=1.4.1
 PKG_RELEASE:=1
 
 PYPI_NAME:=lru-dict
-PKG_HASH:=54fd1966d6bd1fcde781596cb86068214edeebff1db13a2cea11079e3fd07b6b
+PYPI_SOURCE_NAME:=lru_dict
+PKG_HASH:=cc518ff2d38cc7a8ab56f9a6ae557f91e2e1524b57ed8e598e97f45a2bd708fc
+
+PKG_BUILD_DEPENDS:=python-setuptools/host
 
 PKG_MAINTAINER:=Timothy Ace <openwrt@timothyace.com>
 PKG_LICENSE:=MIT
diff --git a/lang/python/python-lru-dict/patches/001-unpin-setuptools.patch b/lang/python/python-lru-dict/patches/001-unpin-setuptools.patch
new file mode 100644 (file)
index 0000000..1ce0164
--- /dev/null
@@ -0,0 +1,9 @@
+--- a/pyproject.toml
++++ b/pyproject.toml
+@@ -1,5 +1,5 @@
+ [build-system]
+-requires = ["setuptools==80.9.0"]
++requires = ["setuptools"]
+ build-backend = "setuptools.build_meta"
+ [project]
diff --git a/lang/python/python-lru-dict/test.sh b/lang/python/python-lru-dict/test.sh
new file mode 100644 (file)
index 0000000..63c596f
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+[ "$1" = python3-lru-dict ] || exit 0
+
+python3 - << 'EOF'
+from lru import LRU
+
+cache = LRU(3)
+cache["a"] = 1
+cache["b"] = 2
+cache["c"] = 3
+assert len(cache) == 3
+
+# Adding a 4th item evicts the least-recently-used entry ("a")
+cache["d"] = 4
+assert len(cache) == 3
+assert "a" not in cache
+assert "d" in cache
+
+# Access "b" to make it recently used, then "c" becomes LRU
+_ = cache["b"]
+cache["e"] = 5
+assert "b" in cache
+assert "c" not in cache
+
+# Test LRU capacity can be changed at runtime
+cache.set_size(5)
+assert cache.get_size() == 5
+
+print("python3-lru-dict OK")
+EOF
git clone https://git.99rst.org/PROJECT