]>
Commit | Line | Data |
---|---|---|
d0daa539 JB |
1 | # TODO: use system html5lib |
2 | # | |
3 | # Conditional build: | |
4 | %bcond_without doc # Sphinx documentation | |
5 | %bcond_without tests # unit tests | |
6 | %bcond_without python2 # CPython 2.x module | |
b288807e | 7 | %bcond_with python3 # CPython 3.x module (built from python3-bleach.spec) |
d0daa539 JB |
8 | |
9 | Summary: An easy safelist-based HTML-sanitizing tool | |
10 | Summary(pl.UTF-8): Proste, oparte na liście elementów bezpiecznych, narzędzie do porządkowania HTML-a | |
11 | Name: python-bleach | |
0730390f JB |
12 | # keep 3.x here for python2 support |
13 | Version: 3.3.1 | |
14 | Release: 1 | |
d0daa539 JB |
15 | License: Apache v2.0 |
16 | Group: Libraries/Python | |
17 | #Source0Download: https://pypi.org/simple/bleach/ | |
18 | Source0: https://files.pythonhosted.org/packages/source/b/bleach/bleach-%{version}.tar.gz | |
0730390f | 19 | # Source0-md5: b4c1b8f27289f9e5d73792daed4c0879 |
d0daa539 JB |
20 | URL: https://pypi.org/project/bleach/ |
21 | BuildRequires: rpm-pythonprov | |
22 | BuildRequires: rpmbuild(macros) >= 1.714 | |
23 | %if %{with python2} | |
24 | BuildRequires: python-modules >= 1:2.7 | |
25 | BuildRequires: python-setuptools | |
26 | %if %{with tests} | |
27 | BuildRequires: python-pytest >= 3.0.0 | |
d0daa539 JB |
28 | BuildRequires: python-six >= 1.9.0 |
29 | BuildRequires: python-webencodings | |
30 | %endif | |
31 | %endif | |
32 | %if %{with python3} | |
0730390f | 33 | BuildRequires: python3-modules >= 1:3.5 |
d0daa539 JB |
34 | BuildRequires: python3-setuptools |
35 | %if %{with tests} | |
36 | BuildRequires: python3-pytest >= 3.0.0 | |
d0daa539 JB |
37 | BuildRequires: python3-six >= 1.9.0 |
38 | BuildRequires: python3-webencodings | |
39 | %endif | |
40 | %endif | |
41 | %if %{with doc} | |
b288807e | 42 | BuildRequires: sphinx-pdg-2 |
d0daa539 JB |
43 | %endif |
44 | Requires: python-modules >= 1:2.7 | |
45 | BuildArch: noarch | |
46 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
47 | ||
48 | %description | |
49 | Bleach is an allowed-list-based HTML sanitizing library that escapes | |
50 | or strips markup and attributes. | |
51 | ||
52 | %description -l pl.UTF-8 | |
53 | Bleach to oparta na liście elementów dozwolonych biblioteka | |
54 | zabezpieczająca lub usuwająca znaczniki i atrybuty. | |
55 | ||
56 | %package -n python3-bleach | |
57 | Summary: An easy safelist-based HTML-sanitizing tool | |
58 | Summary(pl.UTF-8): Proste, oparte na liście elementów bezpiecznych, narzędzie do porządkowania HTML-a | |
59 | Group: Libraries/Python | |
0730390f | 60 | Requires: python3-modules >= 1:3.5 |
d0daa539 JB |
61 | |
62 | %description -n python3-bleach | |
63 | Bleach is an allowed-list-based HTML sanitizing library that escapes | |
64 | or strips markup and attributes. | |
65 | ||
66 | %description -n python3-bleach -l pl.UTF-8 | |
67 | Bleach to oparta na liście elementów dozwolonych biblioteka | |
68 | zabezpieczająca lub usuwająca znaczniki i atrybuty. | |
69 | ||
70 | %package apidocs | |
71 | Summary: API documentation for Python bleach module | |
72 | Summary(pl.UTF-8): Dokumentacja API modułu Pythona bleach | |
73 | Group: Documentation | |
74 | ||
75 | %description apidocs | |
76 | API documentation for Python bleach module. | |
77 | ||
78 | %description apidocs -l pl.UTF-8 | |
79 | Dokumentacja API modułu Pythona bleach. | |
80 | ||
81 | %prep | |
82 | %setup -q -n bleach-%{version} | |
d0daa539 JB |
83 | |
84 | %build | |
85 | %if %{with python2} | |
0730390f JB |
86 | %py_build |
87 | ||
88 | %if %{with tests} | |
89 | PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \ | |
90 | %{__python} -m pytest tests | |
91 | %endif | |
d0daa539 JB |
92 | %endif |
93 | ||
94 | %if %{with python3} | |
0730390f JB |
95 | %py3_build |
96 | ||
97 | %if %{with tests} | |
98 | PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \ | |
99 | %{__python3} -m pytest tests | |
100 | %endif | |
d0daa539 JB |
101 | %endif |
102 | ||
103 | %if %{with doc} | |
b288807e JB |
104 | %{__make} -C docs html \ |
105 | SPHINXBUILD=sphinx-build-2 | |
d0daa539 JB |
106 | %endif |
107 | ||
108 | %install | |
109 | rm -rf $RPM_BUILD_ROOT | |
110 | ||
111 | %if %{with python2} | |
112 | %py_install | |
113 | ||
114 | %py_postclean | |
115 | %endif | |
116 | ||
117 | %if %{with python3} | |
118 | %py3_install | |
119 | %endif | |
120 | ||
121 | %clean | |
122 | rm -rf $RPM_BUILD_ROOT | |
123 | ||
124 | %if %{with python2} | |
125 | %files | |
126 | %defattr(644,root,root,755) | |
127 | %doc CHANGES CONTRIBUTORS LICENSE README.rst | |
128 | %{py_sitescriptdir}/bleach | |
129 | %{py_sitescriptdir}/bleach-%{version}-py*.egg-info | |
130 | %endif | |
131 | ||
132 | %if %{with python3} | |
133 | %files -n python3-bleach | |
134 | %defattr(644,root,root,755) | |
135 | %doc CHANGES CONTRIBUTORS LICENSE README.rst | |
136 | %{py3_sitescriptdir}/bleach | |
137 | %{py3_sitescriptdir}/bleach-%{version}-py*.egg-info | |
138 | %endif | |
139 | ||
140 | %if %{with doc} | |
141 | %files apidocs | |
142 | %defattr(644,root,root,755) | |
143 | %doc docs/_build/html/{_modules,_static,*.html,*.js} | |
144 | %endif |