summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Zamarin <arthurzam@gentoo.org>2022-09-02 18:14:36 +0300
committerArthur Zamarin <arthurzam@gentoo.org>2022-09-02 18:17:09 +0300
commitaf33e532bd06946842cd02ea464fa0bff5b93fcd (patch)
treed5bc0e30187f6ec1adbddab2de9a5bf03471149e
parentdev-python/jsonschema-spec: new package, add 0.1.1 (diff)
downloadgentoo-af33e532.tar.gz
gentoo-af33e532.tar.bz2
gentoo-af33e532.zip
dev-python/openapi-spec-validator: add 0.5.0
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
-rw-r--r--dev-python/openapi-spec-validator/Manifest1
-rw-r--r--dev-python/openapi-spec-validator/files/openapi-spec-validator-0.5.0-std-importlib.patch43
-rw-r--r--dev-python/openapi-spec-validator/openapi-spec-validator-0.5.0.ebuild63
3 files changed, 107 insertions, 0 deletions
diff --git a/dev-python/openapi-spec-validator/Manifest b/dev-python/openapi-spec-validator/Manifest
index 61acc3985143..4da007f3f5e7 100644
--- a/dev-python/openapi-spec-validator/Manifest
+++ b/dev-python/openapi-spec-validator/Manifest
@@ -1 +1,2 @@
DIST openapi-spec-validator-0.4.0.gh.tar.gz 46051 BLAKE2B 43a1458ab1801700261f750e49d45b0cb4d02f1c17a16943b5232836061e0e1466fc973343bbd4bf7a8669b682bd6761cb905fdfb3b80c0b9720253cc2d5a926 SHA512 d2eaf22c75e72eb5061a916eb37b13179a5ba65eb8a00ec42e81c6b4168239bc8613388f2d77ce35113d260385b175280d8863a3deedf18ea5aa93a79f058419
+DIST openapi-spec-validator-0.5.0.gh.tar.gz 39173 BLAKE2B 0c9ac1617423b2f1983e1036b5bfddba3388ace454bb3df743d9d5fe62708fabd54ff4373b77901fc78e7e761d0cc059132a557e73bf5095618fd6f1f074bcfe SHA512 728f600962b493a0e6914d5ac662cda107929630e26b95fb3d5749579d90d278073f5b5d69445cbe90e4c3edbc2ee5de34045f34003a8c75a3d5a33df52cb1fc
diff --git a/dev-python/openapi-spec-validator/files/openapi-spec-validator-0.5.0-std-importlib.patch b/dev-python/openapi-spec-validator/files/openapi-spec-validator-0.5.0-std-importlib.patch
new file mode 100644
index 000000000000..ac794b49cd9a
--- /dev/null
+++ b/dev-python/openapi-spec-validator/files/openapi-spec-validator-0.5.0-std-importlib.patch
@@ -0,0 +1,43 @@
+From: Arthur Zamarin <arthurzam@gentoo.org>
+Date: Fri, 2 Sep 2022 18:11:35 +0300
+Subject: [PATCH] Use stdlib importlib.resources on python >= 3.9
+
+https://github.com/p1c2u/openapi-spec-validator/pull/174
+
+--- a/openapi_spec_validator/schemas/utils.py
++++ b/openapi_spec_validator/schemas/utils.py
+@@ -5,14 +5,17 @@ from typing import Hashable
+ from typing import Mapping
+ from typing import Tuple
+
+-import importlib_resources
++try:
++ from importlib.resources import as_file, files
++except ImportError:
++ from importlib_resources import as_file, files
+ from jsonschema_spec.readers import FilePathReader
+
+
+ def get_schema(version: str) -> Tuple[Mapping[Hashable, Any], str]:
+ schema_path = f"resources/schemas/v{version}/schema.json"
+- ref = importlib_resources.files("openapi_spec_validator") / schema_path
+- with importlib_resources.as_file(ref) as resource_path:
++ ref = files("openapi_spec_validator") / schema_path
++ with as_file(ref) as resource_path:
+ schema_path_full = path.join(path.dirname(__file__), resource_path)
+ return FilePathReader(schema_path_full).read()
+
+--- a/pyproject.toml
++++ b/pyproject.toml
+@@ -49,7 +49,7 @@ openapi-schema-validator = "^0.3.2"
+ python = "^3.7.0"
+ PyYAML = ">=5.1"
+ requests = {version = "*", optional = true}
+-importlib-resources = "^5.8.0"
++importlib-resources = {version = "^5.8.0", python = "<3.9" }
+ jsonschema-spec = "^0.1.1"
+ lazy-object-proxy = "^1.7.1"
+
+--
+2.37.3
+
diff --git a/dev-python/openapi-spec-validator/openapi-spec-validator-0.5.0.ebuild b/dev-python/openapi-spec-validator/openapi-spec-validator-0.5.0.ebuild
new file mode 100644
index 000000000000..290eab373178
--- /dev/null
+++ b/dev-python/openapi-spec-validator/openapi-spec-validator-0.5.0.ebuild
@@ -0,0 +1,63 @@
+# Copyright 2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=poetry
+PYTHON_COMPAT=( pypy3 python3_{8..11} )
+
+inherit distutils-r1
+
+DESCRIPTION="OpenAPI 2.0 (aka Swagger) and OpenAPI 3.0 spec validator"
+HOMEPAGE="
+ https://github.com/p1c2u/openapi-spec-validator/
+ https://pypi.org/project/openapi-spec-validator/
+"
+SRC_URI="
+ https://github.com/p1c2u/openapi-spec-validator/archive/${PV}.tar.gz
+ -> ${P}.gh.tar.gz
+"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64"
+
+RDEPEND="
+ >=dev-python/jsonschema-3.2.0[${PYTHON_USEDEP}]
+ dev-python/jsonschema-spec[${PYTHON_USEDEP}]
+ >=dev-python/openapi-schema-validator-0.2.0[${PYTHON_USEDEP}]
+ >=dev-python/pyyaml-5.1[${PYTHON_USEDEP}]
+ dev-python/requests[${PYTHON_USEDEP}]
+ dev-python/setuptools[${PYTHON_USEDEP}]
+ $(python_gen_cond_dep '
+ dev-python/importlib_resources[${PYTHON_USEDEP}]
+ ' 3.8)
+"
+
+PATCHES=(
+ # https://github.com/p1c2u/openapi-spec-validator/pull/174
+ "${FILESDIR}/${P}-std-importlib.patch"
+)
+
+distutils_enable_tests pytest
+
+EPYTEST_DESELECT=(
+ # Internet
+ tests/integration/test_shortcuts.py::TestPetstoreV2Example
+ tests/integration/test_shortcuts.py::TestApiV2WithExampe
+ tests/integration/test_shortcuts.py::TestPetstoreV2ExpandedExample
+ tests/integration/test_shortcuts.py::TestPetstoreExample
+ tests/integration/test_shortcuts.py::TestRemoteValidatev2SpecUrl
+ tests/integration/test_shortcuts.py::TestRemoteValidatev30SpecUrl
+ tests/integration/test_shortcuts.py::TestApiWithExample
+ tests/integration/test_shortcuts.py::TestPetstoreExpandedExample
+ tests/integration/test_validate.py::TestPetstoreExample
+ tests/integration/test_validate.py::TestApiWithExample
+ tests/integration/test_validate.py::TestPetstoreExpandedExample
+ tests/integration/validation/test_validators.py
+)
+
+src_prepare() {
+ sed -i -e '/--cov/d' pyproject.toml || die
+ distutils-r1_src_prepare
+}