mirror of
https://github.com/openwrt/packages.git
synced 2026-05-31 15:02:01 +08:00
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 <alex@shruggie.ro>
This commit is contained in:
committed by
Alexandru Ardelean
parent
baf4673b6a
commit
30535ff1a9
@@ -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
|
||||
|
||||
@@ -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]
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user