- Add option to build a Python 3 subpackage, original patch by David

Malcolm
This commit is contained in:
Jeffrey C. Ollie 2009-11-06 02:01:26 +00:00
parent 0ff08203ec
commit 021d742bf5
1 changed files with 54 additions and 1 deletions

View File

@ -1,8 +1,14 @@
%global with_python3 0
%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
%if %{with_python3}
%{!?python3_sitearch: %define python3_sitearch %(%{__python3} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
%endif
Name: python-lxml
Version: 2.2.3
Release: 1%{?dist}
Release: 2%{?dist}
Summary: ElementTree-like Python bindings for libxml2 and libxslt
Group: Development/Libraries
@ -20,6 +26,12 @@ BuildRequires: python-setuptools-devel
BuildRequires: python-setuptools
%endif
%if %{with_python3}
BuildRequires: python3-devel
BuildRequires: python3-setuptools
%global py3dir ../python3-lxml-%{version}
%endif
%description
lxml provides a Python binding to the libxslt and libxml2 libraries.
It follows the ElementTree API as much as possible in order to provide
@ -28,18 +40,49 @@ bindings. In particular, lxml deals with Python Unicode strings
rather than encoded UTF-8 and handles memory management automatically,
unlike the default bindings.
%if %{with_python3}
%package -n python3-lxml
Summary: ElementTree-like Python 3 bindings for libxml2 and libxslt
Group: Development/Libraries
%description -n python3-lxml
lxml provides a Python 3 binding to the libxslt and libxml2 libraries.
It follows the ElementTree API as much as possible in order to provide
a more Pythonic interface to libxml2 and libxslt than the default
bindings. In particular, lxml deals with Python 3 Unicode strings
rather than encoded UTF-8 and handles memory management automatically,
unlike the default bindings.
%endif
%prep
%setup -q -n lxml-%{version}
chmod a-x doc/rest2html.py
%if %{with_python3}
cp -r . %{py3dir}
chmod a-x %{py3dir}/doc/rest2html.py
%endif
%build
CFLAGS="%{optflags}" %{__python} -c 'import setuptools; execfile("setup.py")' build
%if %{with_python3}
pushd %{py3dir}
CFLAGS="%{optflags}" %{__python3} setup.py build
popd
%endif
%install
rm -rf %{buildroot}
%{__python} -c 'import setuptools; execfile("setup.py")' install --skip-build --root %{buildroot}
%if %{with_python3}
pushd %{py3dir}
%{__python3} setup.py install --skip-build --root %{buildroot}
popd
%endif
%clean
rm -rf %{buildroot}
@ -48,7 +91,17 @@ rm -rf %{buildroot}
%doc README.txt LICENSES.txt PKG-INFO CREDITS.txt CHANGES.txt doc/
%{python_sitearch}/*
%if %{with_python3}
%files -n python3-lxml
%defattr(-,root,root,-)
%doc README.txt LICENSES.txt PKG-INFO CREDITS.txt CHANGES.txt doc/
%{python3_sitearch}/*
%endif
%changelog
* Thu Nov 5 2009 Jeffrey C. Ollie <jeff@ocjtech.us> - 2.2.3-2
- Add option to build a Python 3 subpackage, original patch by David Malcolm
* Fri Oct 30 2009 Jeffrey C. Ollie <jeff@ocjtech.us> - 2.2.3-1
- 2.2.3 (2009-10-30)
- Bugs fixed