]>
Commit | Line | Data |
---|---|---|
2b091471 ER |
1 | # |
2 | # Conditional build: | |
50f85cbe | 3 | %bcond_without tests # nose tests |
2b091471 ER |
4 | %bcond_without python2 # CPython 2.x module |
5 | %bcond_without python3 # CPython 3.x module | |
6 | ||
7 | %define module jsonschema | |
50f85cbe JB |
8 | Summary: An implementation of JSON Schema validation for Python 2 |
9 | Summary(pl.UTF-8): Implementacja sprawdzania poprawności schematu JSON dla Pythona 2 | |
2b091471 | 10 | Name: python-%{module} |
500d3386 | 11 | Version: 2.6.0 |
c9c1ef40 | 12 | Release: 3 |
2b091471 ER |
13 | License: MIT |
14 | Group: Libraries/Python | |
50f85cbe | 15 | #Source0Download: https://pypi.python.org/simple/jsonschema/ |
500d3386 JB |
16 | Source0: https://files.pythonhosted.org/packages/source/j/jsonschema/%{module}-%{version}.tar.gz |
17 | # Source0-md5: 50c6b69a373a8b55ff1e0ec6e78f13f4 | |
50f85cbe | 18 | URL: https://pypi.python.org/pypi/jsonschema |
2b091471 | 19 | %if %{with python2} |
50f85cbe | 20 | BuildRequires: python-functools32 |
500d3386 | 21 | BuildRequires: python-modules >= 1:2.7 |
03800fb9 | 22 | BuildRequires: python-setuptools |
500d3386 JB |
23 | BuildRequires: python-vcversioner >= 2.16.0.0 |
24 | %if %{with tests} | |
d400802d JB |
25 | BuildRequires: python-mock |
26 | BuildRequires: python-nose | |
500d3386 JB |
27 | BuildRequires: python-rfc3987 |
28 | # optional, but tests fail if python-isodate is installed and strict_rfc3339 isn't | |
29 | BuildRequires: python-strict_rfc3339 | |
30 | BuildRequires: python-webcolors | |
d400802d | 31 | %endif |
03800fb9 | 32 | %endif |
2b091471 | 33 | %if %{with python3} |
500d3386 | 34 | BuildRequires: python3-modules >= 1:3.5 |
03800fb9 | 35 | BuildRequires: python3-setuptools |
500d3386 | 36 | BuildRequires: python3-vcversioner >= 2.16.0.0 |
d400802d JB |
37 | %if %{with tests} |
38 | BuildRequires: python3-nose | |
500d3386 JB |
39 | BuildRequires: python3-rfc3987 |
40 | # optional, but tests fail if python3-isodate is installed and strict_rfc3339 isn't | |
41 | BuildRequires: python3-strict_rfc3339 | |
42 | BuildRequires: python3-webcolors | |
d400802d | 43 | %endif |
2b091471 | 44 | %endif |
500d3386 JB |
45 | BuildRequires: rpm-pythonprov |
46 | BuildRequires: rpmbuild(macros) >= 1.714 | |
47 | Requires: python-modules >= 1:2.7 | |
03800fb9 | 48 | BuildArch: noarch |
2b091471 ER |
49 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
50 | ||
51 | %description | |
52 | jsonschema is JSON Schema validator currently based on | |
53 | <http://tools.ietf.org/html/draft-zyp-json-schema-03>. | |
54 | ||
50f85cbe JB |
55 | %description -l pl.UTF-8 |
56 | jsonschema to walidator schematów JSON oparty na dokumencie | |
57 | <http://tools.ietf.org/html/draft-zyp-json-schema-03>. | |
58 | ||
2b091471 | 59 | %package -n python3-%{module} |
50f85cbe JB |
60 | Summary: An implementation of JSON Schema validation for Python 3 |
61 | Summary(pl.UTF-8): Implementacja sprawdzania poprawności schematu JSON dla Pythona 3 | |
2b091471 | 62 | Group: Libraries/Python |
500d3386 | 63 | Requires: python3-modules >= 1:3.5 |
2b091471 ER |
64 | |
65 | %description -n python3-%{module} | |
66 | jsonschema is JSON Schema validator currently based on | |
67 | <http://tools.ietf.org/html/draft-zyp-json-schema-03>. | |
68 | ||
50f85cbe JB |
69 | %description -n python3-%{module} -l pl.UTF-8 |
70 | jsonschema to walidator schematów JSON oparty na dokumencie | |
71 | <http://tools.ietf.org/html/draft-zyp-json-schema-03>. | |
72 | ||
2b091471 ER |
73 | %prep |
74 | %setup -q -n %{module}-%{version} | |
75 | ||
2b091471 | 76 | %build |
d400802d | 77 | %if %{with python2} |
50f85cbe JB |
78 | %py_build |
79 | ||
f72979fe | 80 | %if %{with tests} |
50f85cbe JB |
81 | %{_bindir}/nosetests-%{py_ver} -v |
82 | %endif | |
f72979fe | 83 | %endif |
50f85cbe | 84 | |
2b091471 | 85 | %if %{with python3} |
ffbb9fa8 | 86 | %py3_build |
2b091471 ER |
87 | |
88 | %if %{with tests} | |
2b091471 | 89 | %{_bindir}/nosetests-%{py3_ver} -v |
2b091471 | 90 | %endif |
2b091471 ER |
91 | %endif |
92 | ||
93 | %install | |
94 | rm -rf $RPM_BUILD_ROOT | |
50f85cbe | 95 | |
2b091471 | 96 | %if %{with python3} |
ffbb9fa8 | 97 | %py3_install |
50f85cbe JB |
98 | |
99 | %{__mv} $RPM_BUILD_ROOT%{_bindir}/jsonschema{,-3} | |
100 | ||
101 | # pythonegg dependency generator resolves conditionals for requires() based on | |
102 | # python version that runs the generator, not the version egg is targeted; | |
103 | # avoid generation of python3egg(functools32) dependency for python 3 | |
500d3386 | 104 | %{__sed} -i -e "/^\\[:python_version=='2.7']/,/^$/d" $RPM_BUILD_ROOT%{py3_sitescriptdir}/jsonschema-%{version}-py*.egg-info/requires.txt |
2b091471 ER |
105 | %endif |
106 | ||
107 | %if %{with python2} | |
ffbb9fa8 | 108 | %py_install |
2b091471 ER |
109 | |
110 | %py_postclean | |
50f85cbe JB |
111 | |
112 | %{__mv} $RPM_BUILD_ROOT%{_bindir}/jsonschema{,-2} | |
113 | ln -sf jsonschema-2 $RPM_BUILD_ROOT%{_bindir}/jsonschema | |
2b091471 ER |
114 | %endif |
115 | ||
116 | %clean | |
117 | rm -rf $RPM_BUILD_ROOT | |
118 | ||
119 | %if %{with python2} | |
120 | %files | |
121 | %defattr(644,root,root,755) | |
50f85cbe | 122 | %doc CHANGELOG.rst COPYING README.rst |
2b091471 | 123 | %attr(755,root,root) %{_bindir}/jsonschema |
50f85cbe JB |
124 | %attr(755,root,root) %{_bindir}/jsonschema-2 |
125 | %{py_sitescriptdir}/jsonschema | |
126 | %{py_sitescriptdir}/jsonschema-%{version}-py*.egg-info | |
2b091471 ER |
127 | %endif |
128 | ||
129 | %if %{with python3} | |
130 | %files -n python3-%{module} | |
131 | %defattr(644,root,root,755) | |
50f85cbe JB |
132 | %doc CHANGELOG.rst COPYING README.rst |
133 | %attr(755,root,root) %{_bindir}/jsonschema-3 | |
134 | %{py3_sitescriptdir}/jsonschema | |
135 | %{py3_sitescriptdir}/jsonschema-%{version}-py*.egg-info | |
2b091471 | 136 | %endif |