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