%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
Name: pcapy
Version: 0.10.5
Release: 1%{?_dist_release}
Summary: A Python interface to libpcap
Summary(ja): libpcap の python インタフェース

Group: Development/Languages
License: ASL 1.1
URL: http://oss.coresecurity.com/projects/pcapy.html
Source0: http://oss.coresecurity.com/repo/pcapy-0.10.5.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: python-devel, libpcap-devel

%description
Pcapy is a Python extension module that interfaces with the libpcap
packet capture library. Pcapy enables python scripts to capture packets
on the network. Pcapy is highly effective when used in conjunction with 
a packet-handling package such as Impacket, which is a collection of 
Python classes for constructing and dissecting network packets.

%prep
%setup -q

%build
CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build

#fix encodings
sed -i 's/\r//' LICENSE
sed -i 's/\r//' README
sed -i 's/\r//' pcapy.html
iconv -f IBM850 -t UTF8 pcapy.html > pcapy.html.tmp
mv pcapy.html.tmp pcapy.html


%install
rm -rf %{buildroot}
%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT

rm -rf $RPM_BUILD_ROOT/usr/share/doc/pcapy

%clean
rm -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root,-)
%doc LICENSE README pcapy.html
%attr(0755,root,root) %{python_sitearch}/*

%changelog
* Thu Apr 05 2012 Daisuke SUZUKI <daisuke@linux.or.jp> 0.10.5-1
- initial build for Vine Linux

* Tue Jan 17 2012 Jon Ciesla <limburgher@gmail.com> - 0.10.5-10
- Fixed file listing.

* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.10.5-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.10.5-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Wed Jul 21 2010 David Malcolm <dmalcolm@redhat.com> - 0.10.5-7
- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild

* Sat Jul 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.10.5-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Thu Feb 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.10.5-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Sat Nov 29 2008 Ignacio Vazquez-Abrams <ivazqueznet+rpm@gmail.com> - 0.10.5-4
- Rebuild for Python 2.6

* Fri Feb 08 2008 Jon Ciesla <limb@jcomserv.net> - 0.10.5-3
- GCC 4.3 rebuild.

* Thu Jan 03 2008 Jon Ciesla <limb@jcomserv.net> - 0.10.5-2
- Fixed file listing.

* Thu Nov 29 2007 Jon Ciesla <limb@jcomserv.net> - 0.10.5-1
- create.
