]>
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.6.2 | |
13 | Release: 2 | |
14 | License: BSD | |
15 | Group: Libraries/Python | |
16 | # until 4.6.1 | |
17 | #Source0: https://lxml.de/files/%{module}-%{version}.tgz | |
18 | #Source0Download: https://pypi.org/simple/lxml/ | |
19 | Source0: https://files.pythonhosted.org/packages/source/l/lxml/%{module}-%{version}.tar.gz | |
20 | # Source0-md5: 2e39c6e17d61f61e5be68fd328ba6a51 | |
21 | URL: https://lxml.de/ | |
22 | BuildRequires: libxml2-devel >= 1:2.9.2 | |
23 | BuildRequires: libxslt-devel >= 1.1.28 | |
24 | BuildRequires: pkgconfig | |
25 | %if %{with python2} | |
26 | BuildRequires: python-Cython >= 0.29.7 | |
27 | BuildRequires: python-devel >= 1:2.7 | |
28 | BuildRequires: python-modules >= 1:2.7 | |
29 | BuildRequires: python-setuptools | |
30 | %endif | |
31 | %if %{with python3} | |
32 | BuildRequires: python3-Cython >= 0.29.7 | |
33 | BuildRequires: python3-devel >= 1:3.5 | |
34 | BuildRequires: python3-modules >= 1:3.5 | |
35 | BuildRequires: python3-setuptools | |
36 | %endif | |
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 | %{?noarchpackage} | |
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 | ||
73 | %build | |
74 | %if %{with python2} | |
75 | %py_build | |
76 | ||
77 | %if %{with tests} | |
78 | install -d testdir-2/src/lxml | |
79 | cd testdir-2/src/lxml | |
80 | ln -snf ../../../build-2/lib.linux-*/lxml/* ../../../src/lxml/tests . | |
81 | cd ../.. | |
82 | ln -snf ../doc ../samples ../test.py . | |
83 | LC_ALL=C.UTF-8 \ | |
84 | %{__python} test.py -v | |
85 | cd .. | |
86 | %endif | |
87 | %endif | |
88 | ||
89 | %if %{with python3} | |
90 | %py3_build | |
91 | ||
92 | %if %{with tests} | |
93 | install -d testdir-3/src/lxml | |
94 | cd testdir-3/src/lxml | |
95 | ln -snf ../../../build-3/lib.linux-*/lxml/* ../../../src/lxml/tests . | |
96 | cd ../.. | |
97 | ln -snf ../doc ../samples ../test.py . | |
98 | %{__python3} test.py -v | |
99 | cd .. | |
100 | %endif | |
101 | %endif | |
102 | ||
103 | %if %{with apidocs} | |
104 | # as of 4.4.2, python3 is not supported in mkhtml.py | |
105 | PYTHONPATH=$(echo $(pwd)/build-2/lib.linux-*) \ | |
106 | %{__python} doc/mkhtml.py doc/html $(pwd) %{version} | |
107 | %endif | |
108 | ||
109 | %install | |
110 | rm -rf $RPM_BUILD_ROOT | |
111 | ||
112 | %if %{with python2} | |
113 | %py_install | |
114 | ||
115 | %py_postclean | |
116 | %endif | |
117 | ||
118 | %if %{with python3} | |
119 | %py3_install | |
120 | %endif | |
121 | ||
122 | %clean | |
123 | rm -rf $RPM_BUILD_ROOT | |
124 | ||
125 | %if %{with python2} | |
126 | %files | |
127 | %defattr(644,root,root,755) | |
128 | %doc CHANGES.txt CREDITS.txt LICENSES.txt README.rst TODO.txt doc/licenses/{BSD,ZopePublicLicense,elementtree}.txt | |
129 | %dir %{py_sitedir}/lxml | |
130 | %{py_sitedir}/lxml/*.py[co] | |
131 | %{py_sitedir}/lxml/etree*.h | |
132 | %{py_sitedir}/lxml/lxml.etree*.h | |
133 | %{py_sitedir}/lxml/includes | |
134 | %{py_sitedir}/lxml/isoschematron | |
135 | %attr(755,root,root) %{py_sitedir}/lxml/_elementpath.so | |
136 | %attr(755,root,root) %{py_sitedir}/lxml/builder.so | |
137 | %attr(755,root,root) %{py_sitedir}/lxml/etree.so | |
138 | %attr(755,root,root) %{py_sitedir}/lxml/objectify.so | |
139 | %attr(755,root,root) %{py_sitedir}/lxml/sax.so | |
140 | %dir %{py_sitedir}/lxml/html | |
141 | %{py_sitedir}/lxml/html/*.py[co] | |
142 | %attr(755,root,root) %{py_sitedir}/lxml/html/clean.so | |
143 | %attr(755,root,root) %{py_sitedir}/lxml/html/diff.so | |
144 | %{py_sitedir}/lxml-%{version}-py*.egg-info | |
145 | %endif | |
146 | ||
147 | %if %{with python3} | |
148 | %files -n python3-%{module} | |
149 | %defattr(644,root,root,755) | |
150 | %doc CHANGES.txt CREDITS.txt LICENSES.txt README.rst TODO.txt doc/licenses/{BSD,ZopePublicLicense,elementtree}.txt | |
151 | %dir %{py3_sitedir}/lxml | |
152 | %attr(755,root,root) %{py3_sitedir}/lxml/_elementpath.cpython-*.so | |
153 | %attr(755,root,root) %{py3_sitedir}/lxml/builder.cpython-*.so | |
154 | %attr(755,root,root) %{py3_sitedir}/lxml/etree.cpython-*.so | |
155 | %attr(755,root,root) %{py3_sitedir}/lxml/objectify.cpython-*.so | |
156 | %attr(755,root,root) %{py3_sitedir}/lxml/sax.cpython-*.so | |
157 | %{py3_sitedir}/lxml/*.py | |
158 | %{py3_sitedir}/lxml/__pycache__ | |
159 | %{py3_sitedir}/lxml/etree*.h | |
160 | %{py3_sitedir}/lxml/lxml.etree*.h | |
161 | %{py3_sitedir}/lxml/includes | |
162 | %{py3_sitedir}/lxml/isoschematron | |
163 | %dir %{py3_sitedir}/lxml/html | |
164 | %{py3_sitedir}/lxml/html/*.py | |
165 | %{py3_sitedir}/lxml/html/__pycache__ | |
166 | %attr(755,root,root) %{py3_sitedir}/lxml/html/clean.cpython-*.so | |
167 | %attr(755,root,root) %{py3_sitedir}/lxml/html/diff.cpython-*.so | |
168 | %{py3_sitedir}/lxml-%{version}-py*.egg-info | |
169 | %endif | |
170 | ||
171 | %if %{with apidocs} | |
172 | %files apidocs | |
173 | %defattr(644,root,root,755) | |
174 | %doc doc/html/* | |
175 | %endif |