]>
Commit | Line | Data |
---|---|---|
2b091471 ER |
1 | # |
2 | # Conditional build: | |
39795331 JB |
3 | %bcond_without doc # Sphinx documentation |
4 | %bcond_without tests # unit tests | |
2b091471 ER |
5 | %bcond_without python2 # CPython 2.x module |
6 | %bcond_without python3 # CPython 3.x module | |
7 | ||
8 | %define module jsonschema | |
50f85cbe JB |
9 | Summary: An implementation of JSON Schema validation for Python 2 |
10 | Summary(pl.UTF-8): Implementacja sprawdzania poprawności schematu JSON dla Pythona 2 | |
2b091471 | 11 | Name: python-%{module} |
39795331 | 12 | Version: 3.2.0 |
e4f60e1f | 13 | Release: 5 |
2b091471 ER |
14 | License: MIT |
15 | Group: Libraries/Python | |
50f85cbe | 16 | #Source0Download: https://pypi.python.org/simple/jsonschema/ |
500d3386 | 17 | Source0: https://files.pythonhosted.org/packages/source/j/jsonschema/%{module}-%{version}.tar.gz |
39795331 | 18 | # Source0-md5: f1a0b5011f05a02a8dee1070cd10a26d |
128fcc92 JB |
19 | # https://json-schema.org/draft-07/json-schema-validation.html (differrent email hashes generated on each download) |
20 | Source1: json-schema-validation.html | |
fd27cec9 | 21 | # Source1-md5: e920693b4c00338d439f0a2240218bcf |
39795331 | 22 | Patch0: %{name}-webcolors.patch |
fd27cec9 | 23 | Patch1: %{name}-nonet.patch |
50f85cbe | 24 | URL: https://pypi.python.org/pypi/jsonschema |
2b091471 | 25 | %if %{with python2} |
50f85cbe | 26 | BuildRequires: python-functools32 |
500d3386 | 27 | BuildRequires: python-modules >= 1:2.7 |
03800fb9 | 28 | BuildRequires: python-setuptools |
39795331 | 29 | BuildRequires: python-setuptools_scm |
500d3386 JB |
30 | BuildRequires: python-vcversioner >= 2.16.0.0 |
31 | %if %{with tests} | |
39795331 JB |
32 | BuildRequires: python-attrs >= 17.4.0 |
33 | BuildRequires: python-idna | |
34 | BuildRequires: python-importlib_metadata | |
35 | BuildRequires: python-jsonpointer >= 1.14 | |
36 | BuildRequires: python-pyrsistent >= 0.14.0 | |
500d3386 | 37 | BuildRequires: python-rfc3987 |
39795331 | 38 | BuildRequires: python-six >= 1.11.0 |
500d3386 | 39 | BuildRequires: python-strict_rfc3339 |
39795331 | 40 | BuildRequires: python-twisted |
500d3386 | 41 | BuildRequires: python-webcolors |
d400802d | 42 | %endif |
03800fb9 | 43 | %endif |
2b091471 | 44 | %if %{with python3} |
500d3386 | 45 | BuildRequires: python3-modules >= 1:3.5 |
03800fb9 | 46 | BuildRequires: python3-setuptools |
39795331 | 47 | BuildRequires: python3-setuptools_scm |
500d3386 | 48 | BuildRequires: python3-vcversioner >= 2.16.0.0 |
d400802d | 49 | %if %{with tests} |
39795331 JB |
50 | BuildRequires: python3-attrs >= 17.4.0 |
51 | BuildRequires: python3-idna | |
52 | %if "%{py3_ver}" < "3.8" | |
53 | BuildRequires: python-importlib_metadata | |
54 | %endif | |
55 | BuildRequires: python3-jsonpointer >= 1.14 | |
56 | BuildRequires: python3-pyrsistent >= 0.14.0 | |
500d3386 | 57 | BuildRequires: python3-rfc3987 |
39795331 | 58 | BuildRequires: python3-six >= 1.11.0 |
500d3386 JB |
59 | # optional, but tests fail if python3-isodate is installed and strict_rfc3339 isn't |
60 | BuildRequires: python3-strict_rfc3339 | |
39795331 | 61 | BuildRequires: python3-twisted |
500d3386 | 62 | BuildRequires: python3-webcolors |
d400802d | 63 | %endif |
2b091471 | 64 | %endif |
500d3386 JB |
65 | BuildRequires: rpm-pythonprov |
66 | BuildRequires: rpmbuild(macros) >= 1.714 | |
39795331 JB |
67 | %if %{with doc} |
68 | BuildRequires: sphinx-pdg-3 | |
69 | BuildRequires: python3-certifi | |
70 | BuildRequires: python3-lxml | |
cdc827bd | 71 | BuildRequires: python3-pyrsistent |
39795331 JB |
72 | BuildRequires: python3-sphinxcontrib-spelling |
73 | %endif | |
500d3386 | 74 | Requires: python-modules >= 1:2.7 |
03800fb9 | 75 | BuildArch: noarch |
2b091471 ER |
76 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
77 | ||
78 | %description | |
39795331 JB |
79 | jsonschema is an implementation of JSON Schema |
80 | (<https://json-schema.org/>) for Python. | |
2b091471 | 81 | |
50f85cbe | 82 | %description -l pl.UTF-8 |
39795331 JB |
83 | jsonschema to implementacja JSON Schema (<https://json-schema.org/>) |
84 | dla Pythona. | |
50f85cbe | 85 | |
2b091471 | 86 | %package -n python3-%{module} |
50f85cbe JB |
87 | Summary: An implementation of JSON Schema validation for Python 3 |
88 | Summary(pl.UTF-8): Implementacja sprawdzania poprawności schematu JSON dla Pythona 3 | |
2b091471 | 89 | Group: Libraries/Python |
500d3386 | 90 | Requires: python3-modules >= 1:3.5 |
2b091471 ER |
91 | |
92 | %description -n python3-%{module} | |
39795331 JB |
93 | jsonschema is an implementation of JSON Schema |
94 | (<https://json-schema.org/>) for Python. | |
2b091471 | 95 | |
50f85cbe | 96 | %description -n python3-%{module} -l pl.UTF-8 |
39795331 JB |
97 | jsonschema to implementacja JSON Schema (<https://json-schema.org/>) |
98 | dla Pythona. | |
50f85cbe | 99 | |
2b091471 ER |
100 | %prep |
101 | %setup -q -n %{module}-%{version} | |
39795331 | 102 | %patch0 -p1 |
fd27cec9 JB |
103 | %patch1 -p1 |
104 | ||
105 | install -d docs/_cache | |
106 | cp -p %{SOURCE1} docs/_cache/spec.html | |
2b091471 | 107 | |
2b091471 | 108 | %build |
d400802d | 109 | %if %{with python2} |
50f85cbe JB |
110 | %py_build |
111 | ||
f72979fe | 112 | %if %{with tests} |
39795331 JB |
113 | PYTHONPATH=$(pwd) \ |
114 | trial-2 jsonschema | |
50f85cbe | 115 | %endif |
f72979fe | 116 | %endif |
50f85cbe | 117 | |
2b091471 | 118 | %if %{with python3} |
ffbb9fa8 | 119 | %py3_build |
2b091471 ER |
120 | |
121 | %if %{with tests} | |
39795331 JB |
122 | PYTHONPATH=$(pwd) \ |
123 | trial-3 jsonschema | |
2b091471 | 124 | %endif |
2b091471 ER |
125 | %endif |
126 | ||
39795331 JB |
127 | %if %{with doc} |
128 | PYTHONPATH=$(pwd) \ | |
129 | %{__make} -C docs html \ | |
130 | PYTHON="%{__python3}" | |
131 | %endif | |
132 | ||
2b091471 ER |
133 | %install |
134 | rm -rf $RPM_BUILD_ROOT | |
50f85cbe | 135 | |
2b091471 | 136 | %if %{with python2} |
ffbb9fa8 | 137 | %py_install |
2b091471 ER |
138 | |
139 | %py_postclean | |
50f85cbe JB |
140 | |
141 | %{__mv} $RPM_BUILD_ROOT%{_bindir}/jsonschema{,-2} | |
39795331 JB |
142 | %endif |
143 | ||
144 | %if %{with python3} | |
145 | %py3_install | |
146 | ||
147 | %{__mv} $RPM_BUILD_ROOT%{_bindir}/jsonschema{,-3} | |
148 | ln -sf jsonschema-3 $RPM_BUILD_ROOT%{_bindir}/jsonschema | |
2b091471 ER |
149 | %endif |
150 | ||
151 | %clean | |
152 | rm -rf $RPM_BUILD_ROOT | |
153 | ||
154 | %if %{with python2} | |
155 | %files | |
156 | %defattr(644,root,root,755) | |
50f85cbe | 157 | %doc CHANGELOG.rst COPYING README.rst |
50f85cbe JB |
158 | %attr(755,root,root) %{_bindir}/jsonschema-2 |
159 | %{py_sitescriptdir}/jsonschema | |
160 | %{py_sitescriptdir}/jsonschema-%{version}-py*.egg-info | |
2b091471 ER |
161 | %endif |
162 | ||
163 | %if %{with python3} | |
164 | %files -n python3-%{module} | |
165 | %defattr(644,root,root,755) | |
50f85cbe | 166 | %doc CHANGELOG.rst COPYING README.rst |
39795331 | 167 | %attr(755,root,root) %{_bindir}/jsonschema |
50f85cbe JB |
168 | %attr(755,root,root) %{_bindir}/jsonschema-3 |
169 | %{py3_sitescriptdir}/jsonschema | |
170 | %{py3_sitescriptdir}/jsonschema-%{version}-py*.egg-info | |
2b091471 | 171 | %endif |