]>
Commit | Line | Data |
---|---|---|
2b091471 ER |
1 | # |
2 | # Conditional build: | |
3 | %bcond_without tests # do not perform "make test" | |
4 | %bcond_without python2 # CPython 2.x module | |
5 | %bcond_without python3 # CPython 3.x module | |
6 | ||
7 | %define module jsonschema | |
8 | Summary: An implementation of JSON Schema validation for Python | |
9 | Name: python-%{module} | |
10 | Version: 2.4.0 | |
11 | Release: 1 | |
12 | License: MIT | |
13 | Group: Libraries/Python | |
14 | Source0: http://pypi.python.org/packages/source/j/jsonschema/%{module}-%{version}.tar.gz | |
15 | # Source0-md5: 661f85c3d23094afbb9ac3c0673840bf | |
16 | URL: http://pypi.python.org/pypi/jsonschema | |
03800fb9 | 17 | BuildRequires: rpm-pythonprov |
2b091471 ER |
18 | %if %{with python2} |
19 | BuildRequires: python-argparse | |
2b091471 | 20 | BuildRequires: python-mock |
03800fb9 | 21 | BuildRequires: python-modules |
2b091471 | 22 | BuildRequires: python-nose |
03800fb9 ER |
23 | BuildRequires: python-setuptools |
24 | %endif | |
2b091471 | 25 | %if %{with python3} |
2b091471 | 26 | BuildRequires: python3-nose |
03800fb9 | 27 | BuildRequires: python3-setuptools |
2b091471 | 28 | %endif |
03800fb9 | 29 | BuildArch: noarch |
2b091471 ER |
30 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
31 | ||
32 | %description | |
33 | jsonschema is JSON Schema validator currently based on | |
34 | <http://tools.ietf.org/html/draft-zyp-json-schema-03>. | |
35 | ||
36 | %package -n python3-%{module} | |
37 | Summary: An implementation of JSON Schema validation for Python | |
38 | Group: Libraries/Python | |
39 | ||
40 | %description -n python3-%{module} | |
41 | jsonschema is JSON Schema validator currently based on | |
42 | <http://tools.ietf.org/html/draft-zyp-json-schema-03>. | |
43 | ||
44 | %prep | |
45 | %setup -q -n %{module}-%{version} | |
46 | ||
47 | set -- * | |
48 | install -d py3 | |
49 | cp -a "$@" py3 | |
50 | find py3 -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|' | |
51 | ||
52 | %build | |
53 | %if %{with python3} | |
54 | cd py3 | |
55 | %{__python3} setup.py build | |
56 | cd .. | |
57 | %endif | |
58 | %{__python} setup.py build | |
59 | ||
60 | %if %{with tests} | |
61 | %if %{with python3} | |
62 | cd py3 | |
63 | %{_bindir}/nosetests-%{py3_ver} -v | |
64 | cd .. | |
65 | %endif | |
66 | %{_bindir}/nosetests-%{py_ver} -v | |
67 | %endif | |
68 | ||
69 | %install | |
70 | rm -rf $RPM_BUILD_ROOT | |
71 | %if %{with python3} | |
72 | cd py3 | |
73 | %{__python3} setup.py install --skip-build \ | |
74 | --optimize=2 \ | |
75 | --root=$RPM_BUILD_ROOT | |
76 | cd .. | |
77 | %endif | |
78 | ||
79 | %if %{with python2} | |
80 | %{__python} setup.py install --skip-build \ | |
81 | --optimize=2 \ | |
82 | --root=$RPM_BUILD_ROOT | |
83 | ||
84 | %py_postclean | |
85 | %endif | |
86 | ||
87 | %clean | |
88 | rm -rf $RPM_BUILD_ROOT | |
89 | ||
90 | %if %{with python2} | |
91 | %files | |
92 | %defattr(644,root,root,755) | |
93 | %doc README.rst COPYING | |
94 | %attr(755,root,root) %{_bindir}/jsonschema | |
95 | %{py_sitescriptdir}/%{module} | |
96 | %{py_sitescriptdir}/%{module}-%{version}-py*.egg-info | |
97 | %endif | |
98 | ||
99 | %if %{with python3} | |
100 | %files -n python3-%{module} | |
101 | %defattr(644,root,root,755) | |
102 | %doc README.rst COPYING | |
103 | %{py3_sitescriptdir}/%{module} | |
104 | %{py3_sitescriptdir}/%{module}-%{version}-py*.egg-info | |
105 | %endif |