dev-python/openapi-spec-validator: add 0.5.0

Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
This commit is contained in:
Arthur Zamarin
2022-09-02 18:14:36 +03:00
parent e3c331fefc
commit af33e532bd
3 changed files with 107 additions and 0 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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
}