1 |
commit: af33e532bd06946842cd02ea464fa0bff5b93fcd |
2 |
Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Sep 2 15:14:36 2022 +0000 |
4 |
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Sep 2 15:17:09 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=af33e532 |
7 |
|
8 |
dev-python/openapi-spec-validator: add 0.5.0 |
9 |
|
10 |
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org> |
11 |
|
12 |
dev-python/openapi-spec-validator/Manifest | 1 + |
13 |
...penapi-spec-validator-0.5.0-std-importlib.patch | 43 +++++++++++++++ |
14 |
.../openapi-spec-validator-0.5.0.ebuild | 63 ++++++++++++++++++++++ |
15 |
3 files changed, 107 insertions(+) |
16 |
|
17 |
diff --git a/dev-python/openapi-spec-validator/Manifest b/dev-python/openapi-spec-validator/Manifest |
18 |
index 61acc3985143..4da007f3f5e7 100644 |
19 |
--- a/dev-python/openapi-spec-validator/Manifest |
20 |
+++ b/dev-python/openapi-spec-validator/Manifest |
21 |
@@ -1 +1,2 @@ |
22 |
DIST openapi-spec-validator-0.4.0.gh.tar.gz 46051 BLAKE2B 43a1458ab1801700261f750e49d45b0cb4d02f1c17a16943b5232836061e0e1466fc973343bbd4bf7a8669b682bd6761cb905fdfb3b80c0b9720253cc2d5a926 SHA512 d2eaf22c75e72eb5061a916eb37b13179a5ba65eb8a00ec42e81c6b4168239bc8613388f2d77ce35113d260385b175280d8863a3deedf18ea5aa93a79f058419 |
23 |
+DIST openapi-spec-validator-0.5.0.gh.tar.gz 39173 BLAKE2B 0c9ac1617423b2f1983e1036b5bfddba3388ace454bb3df743d9d5fe62708fabd54ff4373b77901fc78e7e761d0cc059132a557e73bf5095618fd6f1f074bcfe SHA512 728f600962b493a0e6914d5ac662cda107929630e26b95fb3d5749579d90d278073f5b5d69445cbe90e4c3edbc2ee5de34045f34003a8c75a3d5a33df52cb1fc |
24 |
|
25 |
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 |
26 |
new file mode 100644 |
27 |
index 000000000000..ac794b49cd9a |
28 |
--- /dev/null |
29 |
+++ b/dev-python/openapi-spec-validator/files/openapi-spec-validator-0.5.0-std-importlib.patch |
30 |
@@ -0,0 +1,43 @@ |
31 |
+From: Arthur Zamarin <arthurzam@g.o> |
32 |
+Date: Fri, 2 Sep 2022 18:11:35 +0300 |
33 |
+Subject: [PATCH] Use stdlib importlib.resources on python >= 3.9 |
34 |
+ |
35 |
+https://github.com/p1c2u/openapi-spec-validator/pull/174 |
36 |
+ |
37 |
+--- a/openapi_spec_validator/schemas/utils.py |
38 |
++++ b/openapi_spec_validator/schemas/utils.py |
39 |
+@@ -5,14 +5,17 @@ from typing import Hashable |
40 |
+ from typing import Mapping |
41 |
+ from typing import Tuple |
42 |
+ |
43 |
+-import importlib_resources |
44 |
++try: |
45 |
++ from importlib.resources import as_file, files |
46 |
++except ImportError: |
47 |
++ from importlib_resources import as_file, files |
48 |
+ from jsonschema_spec.readers import FilePathReader |
49 |
+ |
50 |
+ |
51 |
+ def get_schema(version: str) -> Tuple[Mapping[Hashable, Any], str]: |
52 |
+ schema_path = f"resources/schemas/v{version}/schema.json" |
53 |
+- ref = importlib_resources.files("openapi_spec_validator") / schema_path |
54 |
+- with importlib_resources.as_file(ref) as resource_path: |
55 |
++ ref = files("openapi_spec_validator") / schema_path |
56 |
++ with as_file(ref) as resource_path: |
57 |
+ schema_path_full = path.join(path.dirname(__file__), resource_path) |
58 |
+ return FilePathReader(schema_path_full).read() |
59 |
+ |
60 |
+--- a/pyproject.toml |
61 |
++++ b/pyproject.toml |
62 |
+@@ -49,7 +49,7 @@ openapi-schema-validator = "^0.3.2" |
63 |
+ python = "^3.7.0" |
64 |
+ PyYAML = ">=5.1" |
65 |
+ requests = {version = "*", optional = true} |
66 |
+-importlib-resources = "^5.8.0" |
67 |
++importlib-resources = {version = "^5.8.0", python = "<3.9" } |
68 |
+ jsonschema-spec = "^0.1.1" |
69 |
+ lazy-object-proxy = "^1.7.1" |
70 |
+ |
71 |
+-- |
72 |
+2.37.3 |
73 |
+ |
74 |
|
75 |
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 |
76 |
new file mode 100644 |
77 |
index 000000000000..290eab373178 |
78 |
--- /dev/null |
79 |
+++ b/dev-python/openapi-spec-validator/openapi-spec-validator-0.5.0.ebuild |
80 |
@@ -0,0 +1,63 @@ |
81 |
+# Copyright 2022 Gentoo Authors |
82 |
+# Distributed under the terms of the GNU General Public License v2 |
83 |
+ |
84 |
+EAPI=8 |
85 |
+ |
86 |
+DISTUTILS_USE_PEP517=poetry |
87 |
+PYTHON_COMPAT=( pypy3 python3_{8..11} ) |
88 |
+ |
89 |
+inherit distutils-r1 |
90 |
+ |
91 |
+DESCRIPTION="OpenAPI 2.0 (aka Swagger) and OpenAPI 3.0 spec validator" |
92 |
+HOMEPAGE=" |
93 |
+ https://github.com/p1c2u/openapi-spec-validator/ |
94 |
+ https://pypi.org/project/openapi-spec-validator/ |
95 |
+" |
96 |
+SRC_URI=" |
97 |
+ https://github.com/p1c2u/openapi-spec-validator/archive/${PV}.tar.gz |
98 |
+ -> ${P}.gh.tar.gz |
99 |
+" |
100 |
+ |
101 |
+LICENSE="BSD" |
102 |
+SLOT="0" |
103 |
+KEYWORDS="~amd64" |
104 |
+ |
105 |
+RDEPEND=" |
106 |
+ >=dev-python/jsonschema-3.2.0[${PYTHON_USEDEP}] |
107 |
+ dev-python/jsonschema-spec[${PYTHON_USEDEP}] |
108 |
+ >=dev-python/openapi-schema-validator-0.2.0[${PYTHON_USEDEP}] |
109 |
+ >=dev-python/pyyaml-5.1[${PYTHON_USEDEP}] |
110 |
+ dev-python/requests[${PYTHON_USEDEP}] |
111 |
+ dev-python/setuptools[${PYTHON_USEDEP}] |
112 |
+ $(python_gen_cond_dep ' |
113 |
+ dev-python/importlib_resources[${PYTHON_USEDEP}] |
114 |
+ ' 3.8) |
115 |
+" |
116 |
+ |
117 |
+PATCHES=( |
118 |
+ # https://github.com/p1c2u/openapi-spec-validator/pull/174 |
119 |
+ "${FILESDIR}/${P}-std-importlib.patch" |
120 |
+) |
121 |
+ |
122 |
+distutils_enable_tests pytest |
123 |
+ |
124 |
+EPYTEST_DESELECT=( |
125 |
+ # Internet |
126 |
+ tests/integration/test_shortcuts.py::TestPetstoreV2Example |
127 |
+ tests/integration/test_shortcuts.py::TestApiV2WithExampe |
128 |
+ tests/integration/test_shortcuts.py::TestPetstoreV2ExpandedExample |
129 |
+ tests/integration/test_shortcuts.py::TestPetstoreExample |
130 |
+ tests/integration/test_shortcuts.py::TestRemoteValidatev2SpecUrl |
131 |
+ tests/integration/test_shortcuts.py::TestRemoteValidatev30SpecUrl |
132 |
+ tests/integration/test_shortcuts.py::TestApiWithExample |
133 |
+ tests/integration/test_shortcuts.py::TestPetstoreExpandedExample |
134 |
+ tests/integration/test_validate.py::TestPetstoreExample |
135 |
+ tests/integration/test_validate.py::TestApiWithExample |
136 |
+ tests/integration/test_validate.py::TestPetstoreExpandedExample |
137 |
+ tests/integration/validation/test_validators.py |
138 |
+) |
139 |
+ |
140 |
+src_prepare() { |
141 |
+ sed -i -e '/--cov/d' pyproject.toml || die |
142 |
+ distutils-r1_src_prepare |
143 |
+} |