From: Alexandru Ardelean Date: Thu, 16 Apr 2026 16:41:01 +0000 (+0300) Subject: python-lru-dict: update to 1.4.1; add test.sh X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=30535ff1a9c4ab2cb9acf21d705155a04688e3e9;p=openwrt-packages.git python-lru-dict: update to 1.4.1; add test.sh Add PYPI_SOURCE_NAME:=lru_dict as the sdist tarball filename uses underscores while PYPI_NAME uses hyphens. Signed-off-by: Alexandru Ardelean --- diff --git a/lang/python/python-lru-dict/Makefile b/lang/python/python-lru-dict/Makefile index a5171d6e0..70db77e65 100644 --- a/lang/python/python-lru-dict/Makefile +++ b/lang/python/python-lru-dict/Makefile @@ -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 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 index 000000000..1ce0164e2 --- /dev/null +++ b/lang/python/python-lru-dict/patches/001-unpin-setuptools.patch @@ -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 index 000000000..63c596fcc --- /dev/null +++ b/lang/python/python-lru-dict/test.sh @@ -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