%{!?python_sitearch: %global python_sitearch %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)" 2>/dev/null)}
%{?!pybasever: %global pybasever %(python -c "import sys; print sys.version[:3]" 2>/dev/null || echo 0.0)}

Name:		python-twisted-runner
Version:	11.1.0
Release:	2.0.cf%{?dist}
Summary:	Process management
Group:		Development/Libraries
License:	MIT
URL:		http://twistedmatrix.com/trac/wiki/TwistedRunner
Source0:	http://twistedmatrix.com/Releases/Runner/11.1/TwistedRunner-%{version}.tar.bz2
BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(id -nu)
BuildRequires:	python-twisted-core >= 11.1.0, python2-devel >= 2.4
Requires:	python-twisted-core >= 11.1.0

# Don't want provides for python shared objects
%{?filter_provides_in: %filter_provides_in %{python_sitearch}/twisted/runner/.*\.so}
%{?filter_setup}

%description
Twisted is an event-based framework for Internet applications.

Twisted Runner contains code useful for persistent process management
with Python and Twisted, and has an almost full replacement for inetd.

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

%build
CFLAGS="%{optflags}" python setup.py build

%install
rm -rf %{buildroot}
python setup.py install -O1 --skip-build --root %{buildroot}

# Don't package C files
rm %{buildroot}%{python_sitearch}/twisted/runner/portmap.c

# Fix permissions of shared objects to pacify rpmlint
chmod 755 %{buildroot}%{python_sitearch}/twisted/runner/portmap.so

# See if there's any egg-info
if [ -f %{buildroot}%{python_sitearch}/Twisted_Runner-%{version}-py%{pybasever}.egg-info ]; then
	echo %{python_sitearch}/Twisted_Runner-%{version}-py%{pybasever}.egg-info
fi > egg-info

%clean
rm -rf %{buildroot}

%post
if [ -x %{_libexecdir}/twisted-dropin-cache ]; then
	%{_libexecdir}/twisted-dropin-cache || :
fi

%postun
if [ -x %{_libexecdir}/twisted-dropin-cache ]; then
	%{_libexecdir}/twisted-dropin-cache || :
fi

%files -f egg-info
%defattr(-,root,root,-)
%doc LICENSE NEWS README
%{python_sitearch}/twisted/runner/
%{python_sitearch}/twisted/plugins/twisted_runner.py*

%changelog
* Mon Jan  9 2012 Paul Howarth <paul@city-fan.org> 11.1.0-2.0.cf
- rebuilt for gcc-4.7 in Rawhide

* Fri Nov 18 2011 Paul Howarth <paul@city-fan.org> 11.1.0-1.0.cf
- update to 11.1.0 (no significant changes have been made for this release)
- upstream source distribution has moved to twistedmatrix.com

* Mon Apr  4 2011 Paul Howarth <paul@city-fan.org> 11.0.0-1.0.cf
- update to 11.0.0 (no significant changes have been made for this release)
- nobody else likes macros for commands

* Tue Nov 30 2010 Paul Howarth <paul@city-fan.org> 10.2.0-1.0.cf
- update to 10.2.0 (no significant changes have been made for this release)
- BR: python2-devel rather than just python-devel

* Wed Jul 28 2010 Paul Howarth <paul@city-fan.org> 10.1.0-1.1.cf
- rebuild for python 2.7 in Rawhide

* Mon Jul  5 2010 Paul Howarth <paul@city-fan.org> 10.1.0-1.0.cf
- update to 10.1.0 (see NEWS for details)
- Twisted now requires python >= 2.4
- package %%{python_sitearch}/twisted/plugins/twisted_runner.py*
- filter provides for python shared objects

* Thu Mar  4 2010 Paul Howarth <paul@city-fan.org> 10.0.0-1.0.cf
- update to 10.0.0 (see NEWS for details)

* Wed Nov 25 2009 Paul Howarth <paul@city-fan.org> 9.0.0-1.0.cf
- update to 9.0.0

* Fri Aug  7 2009 Paul Howarth <paul@city-fan.org> 8.2.0-3.0.cf
- define RPM macros in global scope
- tidy up egg-info handling

* Sun Jul 26 2009 Paul Howarth <paul@city-fan.org> 8.2.0-2.0.cf
- rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Fri Jan 16 2009 Paul Howarth <paul@city-fan.org> 8.2.0-1.0.CF
- update to 8.2.0
- add scriptlets to update the plugin cache

* Tue Apr  1 2008 Paul Howarth <paul@city-fan.org> 8.0.0-1
- update to 8.0.0
- handle egg-info if present
- make sure shared objects have rpmlint-friendly permissions

* Thu Jan  4 2007 Paul Howarth <paul@city-fan.org> 0.2.0-4
- don't include source file portmap.c in package

* Tue Dec 12 2006 Paul Howarth <paul@city-fan.org> 0.2.0-3
- reinstate tabs

* Mon Sep  4 2006 Paul Howarth <paul@city-fan.org> 0.2.0-2
- don't ghost .pyo files

* Wed May 31 2006 Paul Howarth <paul@city-fan.org> 0.2.0-1
- update to 0.2.0
- update URL
- add doc files LICENSE and NEWS

* Tue May  9 2006 Paul Howarth <paul@city-fan.org> 0.1.0-3
- import from PyVault Repository
- rewrite in Fedora Extras style

* Tue Aug 23 2005 Jeff Pitman <symbiont+pyvault@berlios.de> 0.1.0-2
- disttag

* Fri Mar 25 2005 Jeff Pitman <symbiont+pyvault@berlios.de> 0.1.0-1
- final release

* Wed Mar 16 2005 Jeff Pitman <symbiont+pyvault@berlios.de> 0.1.0-0.1.a3
- upstream release

* Sat Mar 12 2005 Jeff Pitman <symbiont+pyvault@berlios.de> 0.1.0-0.1.a2
- prerelease; FE versioning

* Mon Feb 07 2005 Jeff Pitman <symbiont+pyvault@berlios.de> 0.1.0-1
- prep for split