%define python_sitelib %(python -c 'from distutils.sysconfig import get_python_lib; print get_python_lib(0)')
%define packagename Pyrex
Name:           python-pyrex
Version:        0.9.9
Release:        2%{?_dist_release}
BuildArch:	noarch
Summary:        A compiler/language for writing Python extension modules.
Group:          Development/Languages
License:        Public Domain
URL:            http://www.cosc.canterbury.ac.nz/~greg/python/%{packagename}/
Source0:        http://www.cosc.canterbury.ac.nz/~greg/python/%{packagename}/%{packagename}-%{version}.tar.gz

BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires:  python-devel 
BuildRequires:  nkf
BuildRequires:  findutils
Requires: python-devel


%description
Pyrex is Python with C types.  It is specially designed to allow you to
write extension modules for Python that have the speed of C and the
simplicity and readability of Python.  You write your code in a Python-like
language with C-typed variables, then use the pyrexc compiler to transform
it into a C representation.  This is useful for speeding up critical sections
of your Python code or wrapping an external library.

Please see the documentation for how to get the best performance from your
code.

%prep
%setup -q -n %{packagename}-%{version}

%build
python setup.py build 
# Remove some Macintosh-isms
find . -name '.DS_Store' -exec rm -f \{\} \;
for i in CHANGES.txt ToDo.txt  Demos/Makefile.nodistutils Tools/*
do
  nkf -Lu --in-place $i
done
find Doc -type f | xargs nkf -Lu --in-place

%install
rm -rf $RPM_BUILD_ROOT
python setup.py install --skip-build --root $RPM_BUILD_ROOT

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root,-)
%doc USAGE.txt README.txt CHANGES.txt ToDo.txt Demos Doc Tools
%{python_sitelib}/Pyrex*
%exclude %{python_sitelib}/Pyrex/Mac
%{_bindir}/pyrexc

%changelog
* Sun Feb 19 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.9.9-2
- rebuild with python-2.7.2

* Sat Dec 25 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.9.9-1
- new upstream release

* Tue Feb 02 2010 Shu KONNO <owa@bg.wakwak.com> 0.9.8.4-2
- rebuild with python-2.6

* Mon Aug 04 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 0.9.8.4
- new upstream release

* Sun Jul 20 2008 Shu KONNO <owa@bg.wakwak.com> 0.9.3-1vl5
- rebuilt with python-2.5.2
- added pythonlib macro
- applied new versioning policy

* Sun Jul 10 2005 Daisuke SUZUKI <daisuke@linux.or.jp> 0.9.3-0vl1
- initial build for Vine Linux

* Tue Mar 22 2005 Jeremy Katz <katzj@redhat.com> - 0.9.3-0
- update to 0.9.3
- add patch to fix generated code to build with gcc4
- require python-abi and python-devel instead of conflicting with 
  newer python-devel

* Mon Nov  8 2004 Jeremy Katz <katzj@redhat.com> - 0:0.9.2.1-3
- rebuild against python 2.4

* Wed Aug 18 2004 John (J5) Palmieri <johnp@redhat.com> - 0:0.9.2.1-2
- Added Steve Grubb's spec file patch (RH Bug #130200)

* Fri Jun 25 2004 John (J5) Palmieri <johnp@redhat.com> - 0:0.9.2.1-1
- New upstream version
- Pyrex-0.9-split-base-types.patch synced for new version

* Tue Jun 15 2004 Elliot Lee <sopwith@redhat.com>
- rebuilt

* Fri Jun 03 2004 John (J5) Palmieri <johnp@redhat.com> - 0:0.9-5
- Built to rawhide

* Wed May 19 2004 Florian La Roche <Florian.LaRoche@redhat.de>
- use rpm macros to determine lib64 usage

* Fri Apr 23 2004 John (J5) Palmieri <johnp@redhat.com> - 0:0.9-3
- Added Pyrex-0.9-split-base-types.patch which fixes 
  long unsigned int bug showing up in dbus python binding
  builds for the x86_64 arch
- Added regex hack to spec to work around a bug in python's
  distutils which would install files into /usr/lib instead of
  /usr/lib64 on 64 bit archs
  
* Mon Apr 19 2004 John (J5) Palmieri <johnp@redhat.com> - 0:0.9-2
- Was informed that the epoch change was not needed so the epoch 
  was reverted back to 0  

* Mon Apr 19 2004 John (J5) Palmieri <johnp@redhat.com> - 1:0.9-1
- Upped the epoch so as to avoid clashes with the Fedora extra package

* Mon Apr 19 2004 John (J5) Palmieri <johnp@redhat.com> - 0:0.9-1
- Transfered to Red Hat Fedora's main tree
- Removed need for LONG_LONG patch 

* Mon Feb 02 2004 Toshio Kuratomi <toshio@tiki-lounge.com> - 0:0.9-0.fdr.4
- Removed the site-packages directory from the directories owned by the
  package

* Mon Feb 02 2004 Toshio Kuratomi <toshio@tiki-lounge.com> - 0:0.9-0.fdr.3
- My mistake: rpm automatically removes %%ghost files, no need to script
  it manually.
- python distutils --record=FILE option doesn't record directories so include
  the site-packages/[directories] manually

* Thu Jan 15 2003 Toshio Kuratomi <toshio@tiki-lounge.com> - 0:0.9-0.fdr.2
- Merge changes from Michel Alexandre Salim <salimma[AT]users.sf.net>
  + Require build system's python version because directories are named
    pythonX.Y
  + Create *.pyo files and %ghost them (Privleged user with python optimize
    turned on may generate them, but they aren't needed for operation.
  + Do not include the Mac Pyrex compiler stuff
  + Change license to Public Domain
- Script to remove any %%ghost files on package removal
- Patch around an incompatible change between python 2.2 and python 2.3's
  definition of LONG_LONG being renamed to PY_LONG_LONG
  
* Fri Jan 09 2003 Toshio Kuratomi <toshio@tiki-lounge.com> - 0:0.9-0.fdr.1
- Initial RPM release.
