mirror of
https://github.com/openwrt/packages.git
synced 2026-06-17 14:50:07 +04:00
python-decorator: drop package
No longer needed by any package in the feed; jsonpath-ng was the last consumer and no longer imports it. Signed-off-by: Alexandru Ardelean <alex@shruggie.ro>
This commit is contained in:
committed by
Alexandru Ardelean
parent
06c1e146e2
commit
491f1df066
@@ -1,33 +0,0 @@
|
|||||||
# This is free software, licensed under the GNU General Public License v2.
|
|
||||||
# See /LICENSE for more information.
|
|
||||||
#
|
|
||||||
|
|
||||||
include $(TOPDIR)/rules.mk
|
|
||||||
|
|
||||||
PKG_NAME:=python-decorator
|
|
||||||
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:=65f266143752f734b0a7cc83c46f4618af75b8c5911b00ccb61d0ac9b6da0360
|
|
||||||
|
|
||||||
PKG_BUILD_DEPENDS:=python-setuptools/host
|
|
||||||
|
|
||||||
include ../pypi.mk
|
|
||||||
include $(INCLUDE_DIR)/package.mk
|
|
||||||
include ../python3-package.mk
|
|
||||||
|
|
||||||
define Package/python3-decorator
|
|
||||||
SECTION:=lang
|
|
||||||
CATEGORY:=Languages
|
|
||||||
SUBMENU:=Python
|
|
||||||
URL:=https://github.com/micheles/decorator
|
|
||||||
TITLE:=python3-decodator
|
|
||||||
DEPENDS:=+python3-light
|
|
||||||
endef
|
|
||||||
|
|
||||||
$(eval $(call Py3Package,python3-decorator))
|
|
||||||
$(eval $(call BuildPackage,python3-decorator))
|
|
||||||
$(eval $(call BuildPackage,python3-decorator-src))
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
#!/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
|
|
||||||
Reference in New Issue
Block a user