python-decorator: bump to 5.2.1
authorAlexandru Ardelean <redacted>
Sun, 29 Mar 2026 12:43:37 +0000 (12:43 +0000)
committerAlexandru Ardelean <redacted>
Wed, 1 Apr 2026 07:29:27 +0000 (10:29 +0300)
Changes since 4.4.2:
- v5.x rewrites the implementation using the standard library
  inspect module, dropping the code generation approach
- Signature preservation is now based on functools.wraps internals
- New contextmanager and asynccontextmanager decorator support
- Python 3.8+ required; Python 2 no longer supported

Also add test.sh to verify signature preservation and basic usage.

Link: https://github.com/micheles/decorator/blob/master/CHANGES.md
Signed-off-by: Alexandru Ardelean <redacted>
lang/python/python-decorator/Makefile
lang/python/python-decorator/test.sh [new file with mode: 0755]

index de2a49a189e71d7034f0e0c31626f50629cf3734..d7330a3155bcbbc319be09b909c202eb40a643fe 100644 (file)
@@ -5,13 +5,15 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=python-decorator
-PKG_VERSION:=4.4.2
+PKG_VERSION:=5.2.1
 PKG_RELEASE:=1
 PKG_MAINTAINER:=Josef Schlehofer <pepe.schlehofer@gmail.com> 
 PKG_CPE_ID:=cpe:/a:python:decorator
 
 PYPI_NAME:=decorator
-PKG_HASH:=e3a62f0520172440ca0dcc823749319382e377f37f140a0b99ef45fecb84bfe7
+PKG_HASH:=65f266143752f734b0a7cc83c46f4618af75b8c5911b00ccb61d0ac9b6da0360
+
+PKG_BUILD_DEPENDS:=python-setuptools/host
 
 include ../pypi.mk
 include $(INCLUDE_DIR)/package.mk
diff --git a/lang/python/python-decorator/test.sh b/lang/python/python-decorator/test.sh
new file mode 100755 (executable)
index 0000000..c53e5d0
--- /dev/null
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+[ "$1" = "python3-decorator" ] || exit 0
+
+python3 - << EOF
+import sys
+import decorator
+
+if decorator.__version__ != "$2":
+    print("Wrong version: " + decorator.__version__)
+    sys.exit(1)
+
+from decorator import decorator as dec, decorate
+
+# Basic usage: preserve function signature
+@dec
+def trace(f, *args, **kw):
+    result = f(*args, **kw)
+    return result
+
+def greet(name, greeting="Hello"):
+    return f"{greeting}, {name}"
+
+traced = trace(greet)
+assert traced("Alice") == "Hello, Alice"
+assert traced("Bob", greeting="Hi") == "Hi, Bob"
+
+# Signature is preserved
+import inspect
+sig = inspect.signature(traced)
+assert "name" in sig.parameters
+assert "greeting" in sig.parameters
+
+# Works with classes (dispatch-style)
+@dec
+def noop(f, *args, **kw):
+    return f(*args, **kw)
+
+class MyClass:
+    @noop
+    def method(self, x):
+        return x * 2
+
+obj = MyClass()
+assert obj.method(3) == 6
+
+sys.exit(0)
+EOF
git clone https://git.99rst.org/PROJECT