%define module PyXML
#%define pyver %(python -c 'import sys;print(sys.version[0:3])')
#%define pysite %{_libdir}/python%{pyver}/site-packages
%define pyinc %{_includedir}/python%{pyver}
Summary:	XML libraries for python
Summary(ja):	Python XML ライブラリ
Name:		python-pyxml
Version:	0.8.4
Release:	5%{?_dist_release}
URL:		http://pyxml.sourceforge.net/
Source0:	http://prdownloads.sourceforge.net/pyxml/PyXML-%{version}.tar.gz
Patch0: 	PyXML-0.7.1-intern.patch
Patch1: 	PyXML-0.8.4-cvs20041111-python2.4-backport.patch
Patch2: 	PyXML-memmove.patch
Patch3: 	PyXML-0.8.4-python2.6.patch

License:	Apacheish
Group:		Development/Libraries

BuildRoot:	%{_tmppath}/%{name}-%{version}-root
BuildRequires:	python-devel, expat-devel
BuildRequires:	python-setuptools
Requires:	python, libexpat
Obsoletes:	%{module}
Provides:	%{module}

%description
An XML package for Python. The distribution contains a validating XML
parser, an implementation of the SAX and DOM programming interfaces
and an interface to the Expat parser.

%prep
%setup -q -n %{module}-%{version}
%patch0 -p1 -b .intern
%patch1 -p1 -b .python2.4-backport
%patch2 -p1
%patch3 -p1

# iconv to use utf8
for file in CREDITS ANNOUNCE doc/xml-howto.txt doc/xml-ref.txt README; do
  iconv -f iso8859-1 -t utf-8 -o tmp $file
  mv tmp $file
done

%build
CFLAGS="%{optflags}" \
	%{_bindir}/python -c 'import setuptools; execfile("setup.py")' build --with-libexpat=%{_prefix}

%install
%__rm -rf %{buildroot}
%{_bindir}/python -c 'import setuptools; execfile("setup.py")' install --skip-build install --root=%{buildroot}

%{_bindir}/python -O %{_libdir}/python%{pyver}/compileall.py \
	%{buildroot}%{python_sitearch}

%clean
%__rm -rf %{buildroot}

%files
%defattr(-,root,root)
%doc LICENCE ANNOUNCE CREDITS README README.* TODO doc/*
%{_bindir}/*
%{python_sitearch}/*

%changelog
* Sat Jun 06 2009 Shu KONNO <owa@bg.wakwak.com> 0.8.4-5
- rebuilt with python-2.6
- added Patch0-4 from Fedora
  * Wed Dec 24 2008 Johan Cwiklinski <johan AT x-tnd DOT be> - 0.8.4-12
  - Patch for 'as' reserved keyword (bug #477783)
  * Thu Jul 27 2006 Florian La Roche <laroche@redhat.com> - 0.8.4-4
  - don't check memmove
  * Thu Nov 11 2004 Miloslav Trmac <mitr@redhat.com> - 0.8.4-0.cvs20041111.1
  - Backport xml.sax.saxutils fix from Python 2.4b2
  * Fri Jun 28 2002 Trond Eivind Glomsrød <teg@redhat.com>
  - A fix for the expatreader

* Sat Jun 06 2009 Shu KONNO <owa@bg.wakwak.com> 0.8.4-4
- spec in utf-8 properly
- use rpm macros: pyver, python_sitearch

* Sun Jul 20 2008 Shu KONNO <owa@bg.wakwak.com> 0.8.4-3vl5
- rebuilt with python-2.5.2
- applied new versioning policy and spec in utf-8

* Wed Feb 27 2008 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 0.8.4-2vl3
- rebuild with expat-2.0.1

* Mon May  8 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.8.4-2vl2
- fixed Japanese summary
- changed Group:

* Wed Sep 21 2005 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 0.8.4-2vl1
- initial build for Vine Linux

* Wed May  4 2005 Gotz Waschk <waschk@mandriva.org> 0.8.4-2mdk
- use external libexpat
- enable xpath and xslt

* Thu Dec 16 2004 Guillaume Rousse <guillomovitch@mandrake.org> 0.8.4-1mdk
- new version
- changed name

* Sun Dec 05 2004 Michael Scherer <misc@mandrake.org> 0.8.3-4mdk
- Rebuild for new python

* Mon Nov 01 2004 Michael Scherer <misc@mandrake.org> 0.8.3-3mdk
- [DIRM]

* Sat Apr 10 2004 Michael Scherer <misc@mandrake.org> 0.8.3-2mdk 
- [DIRM]

* Wed Aug 20 2003 Austin Acton <aacton@yorku.ca> 0.8.3-1mdk
- 0.8.3

* Tue Aug 12 2003 Per Oyvind Karlsen <peroyvind@linux-mandrake.com> 0.8.2-4mdk
- rebuild for new python

* Sat Mar 29 2003 David Walluck <walluck@linux-mandrake.com> 0.8.2-3mdk
- release

* Tue Mar 25 2003 David Walluck <david@anti-microsoft.org> 0.8.2-2plf
- spec file cleanups

* Sun Jan 26 2003 David Walluck <david@anti-microsoft.org> 0.8.2-1plf
- release