Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python-jsonschema: Test PR with AUTOREMOVE enabled #14

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/multi-arch-test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ jobs:
echo "$EOF" >> $GITHUB_ENV

- name: Build
uses: openwrt/gh-action-sdk@v5
uses: jefferyto/openwrt-gh-action-sdk@autoremove
env:
ARCH: ${{ matrix.arch }}-${{ env.BRANCH }}
FEEDNAME: packages_ci
Expand Down
45 changes: 45 additions & 0 deletions lang/python/python-jsonschema-specifications/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#
# Copyright (C) 2023 Jeffery To
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=python-jsonschema-specifications
PKG_VERSION:=2023.7.1
PKG_RELEASE:=1

PYPI_NAME:=jsonschema-specifications
PYPI_SOURCE_NAME:=jsonschema_specifications
PKG_HASH:=c91a50404e88a1f6ba40636778e2ee08f6e24c5613fe4c53ac24578a5a7f72bb

PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=COPYING
PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com>

PKG_BUILD_DEPENDS:=python-hatchling/host python-hatch-vcs/host

include ../pypi.mk
include $(INCLUDE_DIR)/package.mk
include ../python3-package.mk

define Package/python3-jsonschema-specifications
SECTION:=lang
CATEGORY:=Languages
SUBMENU:=Python
TITLE:=JSON Schema meta-schemas and vocabularies
URL:=https://github.com/python-jsonschema/jsonschema-specifications
DEPENDS:=+python3-light +python3-referencing
endef

define Package/python3-jsonschema-specifications/description
JSON support files from the JSON Schema Specifications (metaschemas,
vocabularies, etc.), packaged for runtime access from Python as a
referencing-based Schema Registry.
endef

$(eval $(call Py3Package,python3-jsonschema-specifications))
$(eval $(call BuildPackage,python3-jsonschema-specifications))
$(eval $(call BuildPackage,python3-jsonschema-specifications-src))
12 changes: 12 additions & 0 deletions lang/python/python-jsonschema-specifications/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

[ "$1" = python3-jsonschema-specifications ] || exit 0

python3 - << 'EOF'

from jsonschema_specifications import REGISTRY as SPECIFICATIONS

DRAFT202012_DIALECT_URI = "https://json-schema.org/draft/2020-12/schema"
assert SPECIFICATIONS.contents(DRAFT202012_DIALECT_URI) != ""

EOF
19 changes: 13 additions & 6 deletions lang/python/python-jsonschema/Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=python-jsonschema
PKG_VERSION:=4.17.3
PKG_RELEASE:=3
PKG_VERSION:=4.19.1
PKG_RELEASE:=1

PYPI_NAME:=jsonschema
PKG_HASH:=0f864437ab8b6076ba6707453ef8f98a6a0d512a80e93f8abdb676f737ecb60d
PKG_HASH:=ec84cc37cfa703ef7cd4928db24f9cb31428a5d0fa77747b8b51a847458e0bbf

PKG_MAINTAINER:=Javier Marcet <javier@marcet.info>
PKG_LICENSE:=MIT
Expand All @@ -22,9 +22,16 @@ define Package/python3-jsonschema
CATEGORY:=Languages
SUBMENU:=Python
TITLE:=An implementation of JSON Schema validation
URL:=https://github.com/Julian/jsonschema
DEPENDS:=+python3-light +python3-attrs +python3-urllib \
+python3-six +python3-pyrsistent +python3-setuptools
URL:=https://github.com/python-jsonschema/jsonschema
DEPENDS:= \
+python3-light \
+python3-decimal \
+python3-urllib \
+python3-uuid \
+python3-attrs \
+python3-jsonschema-specifications \
+python3-referencing \
+python3-rpds-py
endef

define Package/python3-jsonschema/description
Expand Down
21 changes: 21 additions & 0 deletions lang/python/python-jsonschema/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/sh

[ "$1" = python3-jsonschema ] || exit 0

python3 - << 'EOF'

from jsonschema import validate

# A sample schema, like what we'd get from json.load()
schema = {
"type" : "object",
"properties" : {
"price" : {"type" : "number"},
"name" : {"type" : "string"},
},
}

# If no exception is raised by validate(), the instance is valid.
validate(instance={"name" : "Eggs", "price" : 34.99}, schema=schema)

EOF
47 changes: 47 additions & 0 deletions lang/python/python-referencing/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#
# Copyright (C) 2023 Jeffery To
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=python-referencing
PKG_VERSION:=0.30.2
PKG_RELEASE:=1

PYPI_NAME:=referencing
PKG_HASH:=794ad8003c65938edcdbc027f1933215e0d0ccc0291e3ce20a4d87432b59efc0

PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=COPYING
PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com>

PKG_BUILD_DEPENDS:=python-hatchling/host python-hatch-vcs/host

include ../pypi.mk
include $(INCLUDE_DIR)/package.mk
include ../python3-package.mk

define Package/python3-referencing
SECTION:=lang
CATEGORY:=Languages
SUBMENU:=Python
TITLE:=JSON Referencing + Python
URL:=https://github.com/python-jsonschema/referencing
DEPENDS:= \
+python3-light \
+python3-email \
+python3-urllib \
+python3-attrs \
+python3-rpds-py
endef

define Package/python3-referencing/description
An implementation-agnostic implementation of JSON reference resolution.
endef

$(eval $(call Py3Package,python3-referencing))
$(eval $(call BuildPackage,python3-referencing))
$(eval $(call BuildPackage,python3-referencing-src))
35 changes: 35 additions & 0 deletions lang/python/python-referencing/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/sh

[ "$1" = python3-referencing ] || exit 0

python3 - << 'EOF'

from referencing import Registry, Resource
import referencing.jsonschema

schema = Resource.from_contents( # Parse some contents into a 2020-12 JSON Schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "urn:example:a-202012-schema",
"$defs": {
"nonNegativeInteger": {
"$anchor": "nonNegativeInteger",
"type": "integer",
"minimum": 0,
},
},
}
)
registry = schema @ Registry() # Add the resource to a new registry

# From here forward, this would usually be done within a library wrapping this one,
# like a JSON Schema implementation
resolver = registry.resolver()
resolved = resolver.lookup("urn:example:a-202012-schema#nonNegativeInteger")
assert resolved.contents == {
"$anchor": "nonNegativeInteger",
"type": "integer",
"minimum": 0,
}

EOF
43 changes: 43 additions & 0 deletions lang/python/python-rpds-py/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#
# Copyright (C) 2023 Jeffery To
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=python-rpds-py
PKG_VERSION:=0.10.6
PKG_RELEASE:=1

PYPI_NAME:=rpds-py
PYPI_SOURCE_NAME:=rpds_py
PKG_HASH:=4ce5a708d65a8dbf3748d2474b580d606b1b9f91b5c6ab2a316e0b0cf7a4ba50

PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com>

PKG_BUILD_DEPENDS:=python-maturin/host

include ../pypi.mk
include $(INCLUDE_DIR)/package.mk
include ../python3-package.mk

define Package/python3-rpds-py
SECTION:=lang
CATEGORY:=Languages
SUBMENU:=Python
TITLE:=Bindings to Rust's persistent data structures
URL:=https://github.com/crate-py/rpds
DEPENDS:=+python3-light $(RUST_ARCH_DEPENDS)
endef

define Package/python3-rpds-py/description
Python bindings to the Rust rpds crate for persistent data structures.
endef

$(eval $(call Py3Package,python3-rpds-py))
$(eval $(call BuildPackage,python3-rpds-py))
$(eval $(call BuildPackage,python3-rpds-py-src))
21 changes: 21 additions & 0 deletions lang/python/python-rpds-py/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/sh

[ "$1" = python3-rpds-py ] || exit 0

python3 - << 'EOF'

from rpds import HashTrieMap, HashTrieSet, List

m = HashTrieMap({"foo": "bar", "baz": "quux"})
assert m.insert("spam", 37) == HashTrieMap({"foo": "bar", "baz": "quux", "spam": 37})
assert m.remove("foo") == HashTrieMap({"baz": "quux"})

s = HashTrieSet({"foo", "bar", "baz", "quux"})
assert s.insert("spam") == HashTrieSet({"foo", "bar", "baz", "quux", "spam"})
assert s.remove("foo") == HashTrieSet({"bar", "baz", "quux"})

L = List([1, 3, 5])
assert L.push_front(-1) == List([-1, 1, 3, 5])
assert L.rest == List([3, 5])

EOF
Loading