%{!?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-names
Version:	13.2.0
Release:	1.0.cf%{?dist}
Summary:	A Twisted DNS implementation
Group:		Development/Libraries
License:	MIT
URL:		http://twistedmatrix.com/trac/wiki/TwistedNames
Source0:	http://twistedmatrix.com/Releases/Names/13.2/TwistedNames-%{version}.tar.bz2
BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(id -nu)
BuildRequires:	python-twisted-core >= 13.2.0, python2-devel >= 2.6
Requires:	python-twisted-core >= 13.2.0

# a noarch-turned-arch package should not have debuginfo
%global debug_package %{nil}

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

Twisted Names is both a domain name server as well as a client resolver
library. Twisted Names comes with an "out of the box" nameserver that can read
most BIND-syntax zone files as well as a simple Python-based configuration
format. Twisted Names can act as an authoritative server, perform zone
transfers from a master to act as a secondary, act as a caching nameserver, or
any combination of these. Twisted Names' client resolver library provides
functions to query for all commonly-used record types as well as a replacement
for the blocking gethostbyname() function provided by the Python stdlib socket
module.

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

# Fix doc file deps
chmod -x doc/examples/*.py

%build
python setup.py build

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

# See if there's any egg-info
if [ -f %{buildroot}%{python_sitearch}/Twisted_Names-%{version}-py%{pybasever}.egg-info ]; then
	echo %{python_sitearch}/Twisted_Names-%{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
%doc README LICENSE doc/* NEWS
%{python_sitearch}/twisted/names/
%{python_sitearch}/twisted/plugins/twisted_names.py*

%changelog
* Mon Nov 11 2013 Paul Howarth <paul@city-fan.org> 13.2.0-1.0.cf
- update to 13.2.0 (see NEWS for details)

* Tue Jul  2 2013 Paul Howarth <paul@city-fan.org> 13.1.0-1.0.cf
- update to 13.1.0 (no significant changes have been made for this release)

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

* Thu Dec 27 2012 Paul Howarth <paul@city-fan.org> 12.3.0-1.0.cf
- update to 12.3.0 (see NEWS for details)

* Mon Sep  3 2012 Paul Howarth <paul@city-fan.org> 12.2.0-1.0.cf
- update to 12.2.0 (see NEWS for details)

* Wed Jun  6 2012 Paul Howarth <paul@city-fan.org> 12.1.0-1.0.cf
- update to 12.1.0 (see NEWS for details)
- drop %%defattr, redundant since rpm 4.4

* Mon Feb 13 2012 Paul Howarth <paul@city-fan.org> 12.0.0-1.0.cf
- update to 12.0.0
  - twisted.names.dns.Message now sets the `auth` flag on RRHeader instances
    it creates to reflect the authority of the message itself (#5421)
- twisted now requires at least python 2.5

* 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
  - twisted.names.dns.Message now parses records of unknown type into
    instances of a new `UnknownType` class (#4603)
  - twisted.names.dns.Name now detects loops in names it is decoding and
    raises an exception; previously it would follow the loop forever, allowing
    a remote denial of service attack against any twisted.names client or
    server (#5064)
  - twisted.names.hosts.Resolver now supports IPv6 addresses; its lookupAddress
    method now filters them out and its lookupIPV6Address method is now
    implemented (#5098)
- 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
  - twisted.names.server can now serve SPF resource records using
    twisted.names.dns.Record_SPF, and twisted.names.client can query for them
    using lookupSenderPolicy (#3928)
  - twisted.names.common.extractRecords doesn't try to close the transport
    any more in case of recursion, as it's done by the Resolver itself now
    (#3998)
  - tidied up the Twisted Names documentation for easier conversion (#4573)
- 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 (twisted.names.dns.Message now uses a specially constructed
  dictionary for looking up record types, which yields a significant
  performance improvement on PyPy - #4283)
- Twisted now requires python >= 2.4

* 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
- make sure the scriplets never return a non-zero exit status

* Mon May 19 2008 Paul Howarth <paul@city-fan.org> 8.1.0-1
- update to 8.1.0

* Tue Apr  1 2008 Paul Howarth <paul@city-fan.org> 8.0.0-1
- update to 8.0.0
- handle egg-info if present

* Wed Jan 10 2007 Paul Howarth <paul@city-fan.org> 0.4.0-1
- update to 0.4.0
- require python-twisted-core >= 2.5.0
- include NEWS

* Thu Jan  4 2007 Paul Howarth <paul@city-fan.org> 0.3.0-5
- update URL
- include LICENSE
- include %%post and %%postun scriptlets to manage the dropin cache

* Tue Dec 12 2006 Paul Howarth <paul@city-fan.org> 0.3.0-4
- reinstate tabs
- reinstate python-devel buildreq for python 2.5 on Rawhide

* Mon Aug 28 2006 Paul Howarth <paul@city-fan.org> 0.3.0-3
- drop python-twisted-flow dependency
- use more appropriate summary
- don't generate (empty) debuginfo package
- buildreq python-twisted-core >= 2.4.0 but not python-devel
- don't %%ghost .pyo files

* Fri Jun  9 2006 Paul Howarth <paul@city-fan.org> 0.3.0-2
- build as arch-specific package for proper integration with twisted-core
  (see http://www.redhat.com/archives/fedora-extras-list/2006-June/msg00264.html)
- script the python files list generation to clean up the spec

* Sun May 28 2006 Paul Howarth <paul@city-fan.org> 0.3.0-1
- update to 0.3.0

* Thu May 11 2006 Paul Howarth <paul@city-fan.org> 0.2.0-2
- add missing buildreq python-twisted-core

* Wed May 10 2006 Paul Howarth <paul@city-fan.org> 0.2.0-1
- update to 0.2.0

* 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