]>
Commit | Line | Data |
---|---|---|
1 | # | |
2 | # Conditional build: | |
3 | %bcond_without apidocs # API documentation | |
4 | %bcond_without python2 # Python 2 package | |
5 | %bcond_without python3 # Python 3 package | |
6 | %bcond_without tests # unit tests | |
7 | ||
8 | %define module lxml | |
9 | Summary: Python 2 binding for the libxml2 and libxslt libraries | |
10 | Summary(pl.UTF-8): Wiązanie Pythona 2 do bibliotek libxml2 i libxslt | |
11 | Name: python-%{module} | |
12 | Version: 4.9.3 | |
13 | Release: 1 | |
14 | License: BSD | |
15 | Group: Libraries/Python | |
16 | #Source0Download: https://pypi.org/simple/lxml/ | |
17 | Source0: https://files.pythonhosted.org/packages/source/l/lxml/%{module}-%{version}.tar.gz | |
18 | # Source0-md5: 7298fdca14b10e7b71547ed02b894b25 | |
19 | Patch0: lxml-Skip-failing-test-test_html_prefix_nsmap.patch | |
20 | URL: https://lxml.de/ | |
21 | BuildRequires: libxml2-devel >= 1:2.9.2 | |
22 | BuildRequires: libxslt-devel >= 1.1.28 | |
23 | BuildRequires: pkgconfig | |
24 | %if %{with python2} | |
25 | BuildRequires: python-Cython >= 0.29.36-2 | |
26 | BuildRequires: python-devel >= 1:2.7 | |
27 | BuildRequires: python-modules >= 1:2.7 | |
28 | BuildRequires: python-setuptools | |
29 | %endif | |
30 | %if %{with python3} | |
31 | BuildRequires: python3-Cython >= 0.29.36-2 | |
32 | BuildRequires: python3-devel >= 1:3.5 | |
33 | BuildRequires: python3-modules >= 1:3.5 | |
34 | BuildRequires: python3-setuptools | |
35 | %endif | |
36 | BuildRequires: rpm-build >= 4.6 | |
37 | BuildRequires: rpm-pythonprov | |
38 | BuildRequires: rpmbuild(macros) >= 1.752 | |
39 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
40 | ||
41 | %description | |
42 | lxml is a Pythonic binding for the libxml2 and libxslt libraries. | |
43 | ||
44 | %description -l pl.UTF-8 | |
45 | lxml to pythonowe wiązanie do bibliotek libxml2 i libxslt. | |
46 | ||
47 | %package -n python3-%{module} | |
48 | Summary: Python 3 binding for the libxml2 and libxslt libraries | |
49 | Summary(pl.UTF-8): Wiązanie Pythona 3 do bibliotek libxml2 i libxslt | |
50 | Group: Libraries/Python | |
51 | ||
52 | %description -n python3-%{module} | |
53 | lxml is a Pythonic binding for the libxml2 and libxslt libraries. | |
54 | ||
55 | %description -n python3-%{module} -l pl.UTF-8 | |
56 | lxml to pythonowe wiązanie do bibliotek libxml2 i libxslt. | |
57 | ||
58 | %package apidocs | |
59 | Summary: lxml API documentation | |
60 | Summary(pl.UTF-8): Dokumentacja API modułu lxml | |
61 | Group: Documentation | |
62 | BuildArch: noarch | |
63 | ||
64 | %description apidocs | |
65 | lxml API documentation. | |
66 | ||
67 | %description apidocs -l pl.UT8-8 | |
68 | Dokumentacja API modułu lxml. | |
69 | ||
70 | %prep | |
71 | %setup -q -n %{module}-%{version} | |
72 | %patch0 -p1 | |
73 | ||
74 | # force cython regeneration | |
75 | %{__rm} src/lxml/{_elementpath.c,builder.c,etree.c,etree.h,etree_api.h,lxml.etree.h,lxml.etree_api.h,objectify.c,sax.c} | |
76 | ||
77 | %build | |
78 | %if %{with python2} | |
79 | %py_build | |
80 | ||
81 | %if %{with tests} | |
82 | install -d testdir-2/src/lxml | |
83 | cd testdir-2/src/lxml | |
84 | ln -snf ../../../build-2/lib.linux-*/lxml/* ../../../src/lxml/tests . | |
85 | cd ../.. | |
86 | ln -snf ../doc ../samples ../test.py . | |
87 | LC_ALL=C.UTF-8 \ | |
88 | %{__python} test.py -v | |
89 | cd .. | |
90 | %endif | |
91 | %endif | |
92 | ||
93 | %if %{with python3} | |
94 | %py3_build | |
95 | ||
96 | %if %{with tests} | |
97 | install -d testdir-3/src/lxml | |
98 | cd testdir-3/src/lxml | |
99 | ln -snf ../../../build-3/lib.linux-*/lxml/* ../../../src/lxml/tests . | |
100 | cd ../.. | |
101 | ln -snf ../doc ../samples ../test.py . | |
102 | %{__python3} test.py -v | |
103 | cd .. | |
104 | %endif | |
105 | %endif | |
106 | ||
107 | %if %{with apidocs} | |
108 | # as of 4.4.2, python3 is not supported in mkhtml.py | |
109 | PYTHONPATH=$(echo $(pwd)/build-2/lib.linux-*) \ | |
110 | %{__python} doc/mkhtml.py doc/html $(pwd) %{version} | |
111 | %endif | |
112 | ||
113 | %install | |
114 | rm -rf $RPM_BUILD_ROOT | |
115 | ||
116 | %if %{with python2} | |
117 | %py_install | |
118 | ||
119 | %py_postclean | |
120 | %endif | |
121 | ||
122 | %if %{with python3} | |
123 | %py3_install | |
124 | %endif | |
125 | ||
126 | %clean | |
127 | rm -rf $RPM_BUILD_ROOT | |
128 | ||
129 | %if %{with python2} | |
130 | %files | |
131 | %defattr(644,root,root,755) | |
132 | %doc CHANGES.txt CREDITS.txt LICENSE.txt LICENSES.txt README.rst TODO.txt doc/licenses/{BSD,elementtree}.txt | |
133 | %dir %{py_sitedir}/lxml | |
134 | %{py_sitedir}/lxml/*.pxi | |
135 | %{py_sitedir}/lxml/*.py[co] | |
136 | %{py_sitedir}/lxml/etree.pyx | |
137 | %{py_sitedir}/lxml/objectify.pyx | |
138 | %{py_sitedir}/lxml/etree*.h | |
139 | %{py_sitedir}/lxml/lxml.etree*.h | |
140 | %{py_sitedir}/lxml/includes | |
141 | %{py_sitedir}/lxml/isoschematron | |
142 | %attr(755,root,root) %{py_sitedir}/lxml/_elementpath.so | |
143 | %attr(755,root,root) %{py_sitedir}/lxml/builder.so | |
144 | %attr(755,root,root) %{py_sitedir}/lxml/etree.so | |
145 | %attr(755,root,root) %{py_sitedir}/lxml/objectify.so | |
146 | %attr(755,root,root) %{py_sitedir}/lxml/sax.so | |
147 | %dir %{py_sitedir}/lxml/html | |
148 | %{py_sitedir}/lxml/html/*.py[co] | |
149 | %attr(755,root,root) %{py_sitedir}/lxml/html/clean.so | |
150 | %attr(755,root,root) %{py_sitedir}/lxml/html/diff.so | |
151 | %{py_sitedir}/lxml-%{version}-py*.egg-info | |
152 | %endif | |
153 | ||
154 | %if %{with python3} | |
155 | %files -n python3-%{module} | |
156 | %defattr(644,root,root,755) | |
157 | %doc CHANGES.txt CREDITS.txt LICENSE.txt LICENSES.txt README.rst TODO.txt doc/licenses/{BSD,elementtree}.txt | |
158 | %dir %{py3_sitedir}/lxml | |
159 | %attr(755,root,root) %{py3_sitedir}/lxml/_elementpath.cpython-*.so | |
160 | %attr(755,root,root) %{py3_sitedir}/lxml/builder.cpython-*.so | |
161 | %attr(755,root,root) %{py3_sitedir}/lxml/etree.cpython-*.so | |
162 | %attr(755,root,root) %{py3_sitedir}/lxml/objectify.cpython-*.so | |
163 | %attr(755,root,root) %{py3_sitedir}/lxml/sax.cpython-*.so | |
164 | %{py3_sitedir}/lxml/*.pxi | |
165 | %{py3_sitedir}/lxml/*.py | |
166 | %{py3_sitedir}/lxml/__pycache__ | |
167 | %{py3_sitedir}/lxml/etree.pyx | |
168 | %{py3_sitedir}/lxml/objectify.pyx | |
169 | %{py3_sitedir}/lxml/etree*.h | |
170 | %{py3_sitedir}/lxml/lxml.etree*.h | |
171 | %{py3_sitedir}/lxml/includes | |
172 | %{py3_sitedir}/lxml/isoschematron | |
173 | %dir %{py3_sitedir}/lxml/html | |
174 | %{py3_sitedir}/lxml/html/*.py | |
175 | %{py3_sitedir}/lxml/html/__pycache__ | |
176 | %attr(755,root,root) %{py3_sitedir}/lxml/html/clean.cpython-*.so | |
177 | %attr(755,root,root) %{py3_sitedir}/lxml/html/diff.cpython-*.so | |
178 | %{py3_sitedir}/lxml-%{version}-py*.egg-info | |
179 | %endif | |
180 | ||
181 | %if %{with apidocs} | |
182 | %files apidocs | |
183 | %defattr(644,root,root,755) | |
184 | %doc doc/html/* | |
185 | %endif |