source: spec/trunk/SPECS/python-lxml.spec@ 613

Last change on this file since 613 was 613, checked in by dmik, 10 years ago

spec: python-lxml: Initial release 3.5.0-1.

File size: 4.3 KB
Line 
1# Note: this .spec is borrowed from python-lxml-3.4.4-2.fc24.src.rpm
2
3%if 0%{?fedora} > 12
4%global with_python3 1
5%endif
6
7%if 0%{?fedora} >= 20
8%global with_python3_cssselect 1
9%endif
10
11%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
12
13Name: python-lxml
14Version: 3.5.0
15Release: 1%{?dist}
16Summary: ElementTree-like Python bindings for libxml2 and libxslt
17
18Group: Development/Libraries
19License: BSD
20URL: http://lxml.de
21Source0: http://lxml.de/files/lxml-%{version}.tgz
22#Source1: http://lxml.de/files/lxml-%{version}.tgz.asc
23
24BuildRequires: libxslt-devel
25
26BuildRequires: python-devel
27#BuildRequires: python-setuptools
28#BuildRequires: python-cssselect
29#BuildRequires: Cython >= 0.20
30
31#Requires: python-cssselect
32
33%if 0%{?with_python3}
34BuildRequires: python3-devel
35BuildRequires: python3-setuptools
36%if 0%{?with_python3_cssselect}
37BuildRequires: python3-cssselect
38%endif
39%endif
40
41%description
42lxml provides a Python binding to the libxslt and libxml2 libraries.
43It follows the ElementTree API as much as possible in order to provide
44a more Pythonic interface to libxml2 and libxslt than the default
45bindings. In particular, lxml deals with Python Unicode strings
46rather than encoded UTF-8 and handles memory management automatically,
47unlike the default bindings.
48
49%package docs
50Summary: Documentation for %{name}
51Group: Documentation
52BuildArch: noarch
53%description docs
54This package provides the documentation for %{name}, e.g. the API as html.
55
56
57%if 0%{?with_python3}
58%package -n python3-lxml
59Summary: ElementTree-like Python 3 bindings for libxml2 and libxslt
60Group: Development/Libraries
61%if 0%{?with_python3_cssselect}
62Requires: python3-cssselect
63%endif
64
65%description -n python3-lxml
66lxml provides a Python 3 binding to the libxslt and libxml2 libraries.
67It follows the ElementTree API as much as possible in order to provide
68a more Pythonic interface to libxml2 and libxslt than the default
69bindings. In particular, lxml deals with Python 3 Unicode strings
70rather than encoded UTF-8 and handles memory management automatically,
71unlike the default bindings.
72%endif
73
74%prep
75%setup -q -n lxml-%{version}
76
77## remove the C extension so that it will be rebuilt using the latest Cython
78#rm -f src/lxml/lxml.etree.c
79#rm -f src/lxml/lxml.etree.h
80#rm -f src/lxml/lxml.etree_api.h
81#rm -f src/lxml/lxml.objectify.c
82
83chmod a-x doc/rest2html.py
84sed -i 's/\r//' doc/s5/ui/default/print.css \
85 doc/s5/ep2008/atom.rng \
86 doc/s5/ui/default/iepngfix.htc
87
88%if 0%{?with_python3}
89rm -rf %{py3dir}
90cp -r . %{py3dir}
91%endif
92
93%build
94CFLAGS="%{optflags}" %{__python} setup.py build
95#--with-cython
96
97%if 0%{?with_python3}
98cp src/lxml/lxml.etree.c %{py3dir}/src/lxml
99cp src/lxml/lxml.etree.h %{py3dir}/src/lxml
100cp src/lxml/lxml.etree_api.h %{py3dir}/src/lxml
101cp src/lxml/lxml.objectify.c %{py3dir}/src/lxml
102
103pushd %{py3dir}
104CFLAGS="%{optflags}" %{__python3} setup.py build --with-cython
105popd
106%endif
107
108%install
109%{__python} setup.py install --skip-build --no-compile --root %{buildroot}
110#--with-cython
111
112%if 0%{?with_python3}
113pushd %{py3dir}
114%{__python3} setup.py install --skip-build --no-compile --with-cython --root %{buildroot}
115popd
116%endif
117
118%check
119# @todo enable once we got python-unittest
120#BUILD_LIB_DIR=$(find $(pwd) -name "*.pyd" | head -n 1 | xargs dirname)
121#cp $BUILD_LIB_DIR/*.pyd src/lxml
122#export LANG=en_US.utf8
123#%{__python} test.py -p -v
124#export PYTHONPATH=src
125#%{__python} selftest.py
126#%{__python} selftest2.py
127
128%if 0%{?with_python3}
129pushd %{py3dir}
130
131BUILD_LIB_DIR=$(find $(pwd) -name "*.pyd" | head -n 1 | xargs dirname)
132cp $BUILD_LIB_DIR/*.pyd src/lxml
133export LANG=en_US.utf8
134%{__python3} test.py -p -v
135export PYTHONPATH=src
136%{__python3} selftest.py
137%{__python3} selftest2.py
138
139popd
140%endif
141
142
143%files
144%{!?_licensedir:%global license %%doc}
145%license LICENSES.txt
146%doc PKG-INFO CREDITS.txt CHANGES.txt
147%{python_sitearch}/lxml
148%{python_sitearch}/lxml-*.egg-info
149
150%files docs
151%doc doc/*
152
153%if 0%{?with_python3}
154%files -n python3-lxml
155%license LICENSES.txt
156%doc PKG-INFO CREDITS.txt CHANGES.txt
157%{python3_sitearch}/lxml-*.egg-info
158%{python3_sitearch}/lxml
159%endif
160
161%changelog
162* Thu Dec 12 2015 Dmitriy Kuminov <coding@dmik.org> 3.5.0-1
163- Initial package for version 3.5.0.
Note: See TracBrowser for help on using the repository browser.