+%global with_python3 1
+
Summary: Library providing XML and HTML support
Name: libxml2
Version: @VERSION@
-Release: 1%{?dist}%{?extra_release}
+Release: 0rc1%{?dist}%{?extra_release}
License: MIT
Group: Development/Libraries
-Source: ftp://xmlsoft.org/libxml2/libxml2-%{version}.tar.gz
+Source: ftp://xmlsoft.org/libxml2/libxml2-%{version}-rc1.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-root
-BuildRequires: python python-devel zlib-devel pkgconfig xz-devel
+BuildRequires: python-devel
+%if 0%{?with_python3}
+BuildRequires: python3-devel
+%endif # with_python3
+BuildRequires: zlib-devel
+BuildRequires: pkgconfig
+BuildRequires: xz-devel
URL: http://xmlsoft.org/
%description
Static library for libxml2 provided for specific uses or shaving a few
microseconds when parsing, do not link to them for generic purpose packages.
-%package python
+%package -n python-%{name}
+%{?python_provide:%python_provide python-%{name}}
Summary: Python bindings for the libxml2 library
Group: Development/Libraries
Requires: libxml2 = %{version}-%{release}
+Obsoletes: %{name}-python < %{version}-%{release}
+Provides: %{name}-python = %{version}-%{release}
-%description python
-The libxml2-python package contains a module that permits applications
-written in the Python programming language to use the interface
+%description -n python-%{name}
+The libxml2-python package contains a Python 2 module that permits applications
+written in the Python programming language, version 2, to use the interface
supplied by the libxml2 library to manipulate XML files.
This library allows to manipulate XML files. It includes support
this includes parsing and validation even with complex DTDs, either
at parse time or later once the document has been modified.
+%if 0%{?with_python3}
+%package -n python3-%{name}
+Summary: Python 3 bindings for the libxml2 library
+Group: Development/Libraries
+Requires: libxml2 = %{version}-%{release}
+Obsoletes: %{name}-python3 < %{version}-%{release}
+Provides: %{name}-python3 = %{version}-%{release}
+
+%description -n python3-%{name}
+The libxml2-python3 package contains a Python 3 module that permits
+applications written in the Python programming language, version 3, to use the
+interface supplied by the libxml2 library to manipulate XML files.
+
+This library allows to manipulate XML files. It includes support
+to read, modify and write XML and HTML files. There is DTDs support
+this includes parsing and validation even with complex DTDs, either
+at parse time or later once the document has been modified.
+%endif # with_python3
+
%prep
%setup -q
+mkdir py3doc
+cp doc/*.py py3doc
+sed -i 's|#!/usr/bin/python |#!%{__python3} |' py3doc/*.py
+
%build
%configure
make %{_smp_mflags}
+find doc -type f -exec chmod 0644 \{\} \;
+
%install
rm -fr %{buildroot}
make install DESTDIR=%{buildroot}
+%if 0%{?with_python3}
+make clean
+%configure --with-python=%{__python3}
+make install DESTDIR=%{buildroot}
+%endif # with_python3
+
+
rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
rm -f $RPM_BUILD_ROOT%{_libdir}/python*/site-packages/*.a
rm -f $RPM_BUILD_ROOT%{_libdir}/python*/site-packages/*.la
%{_bindir}/xml2-config
%{_datadir}/aclocal/libxml.m4
%{_libdir}/pkgconfig/libxml-2.0.pc
+%{_libdir}/cmake/libxml2/libxml2-config.cmake
%files static
%defattr(-, root, root)
%{_libdir}/*a
-%files python
+%files -n python-%{name}
%defattr(-, root, root)
-%{_libdir}/python*/site-packages/libxml2.py*
-%{_libdir}/python*/site-packages/drv_libxml2.py*
-%{_libdir}/python*/site-packages/libxml2mod*
+%{_libdir}/python2*/site-packages/libxml2.py*
+%{_libdir}/python2*/site-packages/drv_libxml2.py*
+%{_libdir}/python2*/site-packages/libxml2mod*
%doc python/TODO
%doc python/libxml2class.txt
%doc python/tests/*.py
%doc doc/*.py
%doc doc/python.html
+%if 0%{?with_python3}
+%files -n python3-%{name}
+%defattr(-, root, root)
+
+%{_libdir}/python3*/site-packages/libxml2.py*
+%{_libdir}/python3*/site-packages/drv_libxml2.py*
+%{_libdir}/python3*/site-packages/__pycache__/*py*
+%{_libdir}/python3*/site-packages/libxml2mod*
+%doc python/TODO
+%doc python/libxml2class.txt
+%doc py3doc/*.py
+%doc doc/python.html
+%endif # with_python3
+
%changelog
* @RELDATE@ Daniel Veillard <veillard@redhat.com>
- upstream release @VERSION@ see http://xmlsoft.org/news.html