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