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