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