mirror of
https://github.com/openwrt/packages.git
synced 2026-04-15 19:02:09 +00:00
python-blinker: new package (1.9.0)
Flask 3.x requires blinker for its signal system. Add python-blinker 1.9.0 as a new package. blinker is a pure-Python package (flit-core build backend) with no runtime dependencies. Signed-off-by: Alexandru Ardelean <alex@shruggie.ro>
This commit is contained in:
committed by
Alexandru Ardelean
parent
2dbd1a9bb5
commit
098f975ca3
40
lang/python/python-blinker/Makefile
Normal file
40
lang/python/python-blinker/Makefile
Normal file
@@ -0,0 +1,40 @@
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=python-blinker
|
||||
PKG_VERSION:=1.9.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PYPI_NAME:=blinker
|
||||
PKG_HASH:=b4ce2265a7abece45e7cc896e98dbebe6cead56bcf805a3d23136d145f5445bf
|
||||
|
||||
PKG_MAINTAINER:=Alexandru Ardelean <ardeleanalex@gmail.com>
|
||||
PKG_LICENSE:=MIT
|
||||
PKG_LICENSE_FILES:=LICENSE.txt
|
||||
|
||||
PKG_BUILD_DEPENDS:=python-flit-core/host
|
||||
|
||||
include ../pypi.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include ../python3-package.mk
|
||||
|
||||
define Package/python3-blinker
|
||||
SECTION:=lang
|
||||
CATEGORY:=Languages
|
||||
SUBMENU:=Python
|
||||
TITLE:=Fast, simple object-to-object and broadcast signaling
|
||||
URL:=https://blinker.readthedocs.io/
|
||||
DEPENDS:=+python3-light
|
||||
endef
|
||||
|
||||
define Package/python3-blinker/description
|
||||
Blinker provides fast, simple object-to-object and broadcast signaling
|
||||
for Python objects. It is used by Flask to implement its signal system.
|
||||
endef
|
||||
|
||||
$(eval $(call Py3Package,python3-blinker))
|
||||
$(eval $(call BuildPackage,python3-blinker))
|
||||
$(eval $(call BuildPackage,python3-blinker-src))
|
||||
37
lang/python/python-blinker/test.sh
Normal file
37
lang/python/python-blinker/test.sh
Normal file
@@ -0,0 +1,37 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ "$1" = python3-blinker ] || exit 0
|
||||
|
||||
python3 - <<EOF
|
||||
import sys
|
||||
from blinker import Signal, signal
|
||||
|
||||
# Named signal
|
||||
data_saved = signal("data-saved")
|
||||
results = []
|
||||
cb_named = lambda sender, **kw: results.append((sender, kw))
|
||||
data_saved.connect(cb_named)
|
||||
data_saved.send("db", value=42)
|
||||
assert results == [("db", {"value": 42})], f"Unexpected: {results}"
|
||||
|
||||
# Anonymous signal, multiple subscribers
|
||||
updated = Signal()
|
||||
log = []
|
||||
cb_a = lambda s, **kw: log.append("a")
|
||||
cb_b = lambda s, **kw: log.append("b")
|
||||
updated.connect(cb_a)
|
||||
updated.connect(cb_b)
|
||||
updated.send(None)
|
||||
assert set(log) == {"a", "b"}, f"Unexpected: {log}"
|
||||
|
||||
# Disconnect
|
||||
def handler(sender, **kw):
|
||||
log.append("handler")
|
||||
|
||||
updated.connect(handler)
|
||||
updated.disconnect(handler)
|
||||
updated.send(None)
|
||||
assert "handler" not in log[2:], "handler should have been disconnected"
|
||||
|
||||
print("python-blinker OK")
|
||||
EOF
|
||||
Reference in New Issue
Block a user