Blob Blame Raw
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}

Name:           python-wifi
Version:        0.5.0
Release:        2%{?dist}
Summary:        Python binding for the wireless extensions

Group:          Development/Libraries
#python-wifi is licensed under LGPLv2+, however, the examples
#(e.g. iwconfig.py and iwlist.py) are licensed under GPLv2+
License:        LGPLv2+ and GPLv2+
URL:            https://developer.berlios.de/projects/pythonwifi/
Source0:        http://download.berlios.de/pythonwifi/%{name}-%{version}.tar.bz2
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch:      noarch

BuildRequires:  python-devel
BuildRequires:  python-setuptools


%description
Python-Wifi is a Python library that provides access to information about a
W-LAN card's capabilities, like the wireless extensions written in C.


%prep
%setup -q
#Remove shebang
sed -i -e '/^#!\//, 1d' {tests/output_diff.sh,examples/*.py}
#Fix permissions
chmod -x {tests/output_diff.sh,examples/*.py}
# Convert to utf-8
for file in docs/AUTHORS; do
    mv $file timestamp
    iconv -f ISO-8859-1 -t UTF-8 -o $file timestamp
    touch -r timestamp $file
done

%build
%{__python} setup.py build


%install
rm -rf %{buildroot}
%{__python} setup.py install --skip-build --root="%{buildroot}"
#Delete the doc files, wrong location
rm %{buildroot}/usr/{INSTALL,README}
rm %{buildroot}/usr/docs/{AUTHORS,BUGS,ChangeLog,DEVEL.txt,LICENSE*,NEWS,ROADMAP,TODO,VERSION}
#Move the examples
mkdir -p %{buildroot}%{_defaultdocdir}/%{name}-%{version}/examples/
mv %{buildroot}/usr/examples/{iwconfig.py,iwlist.py} \
    %{buildroot}%{_defaultdocdir}/%{name}-%{version}/examples/
#Move the man pages
mkdir -p %{buildroot}%{_mandir}/man8/
mv %{buildroot}/usr/man/man8/iw*  %{buildroot}%{_mandir}/man8/
#Move the doc files to the right directory
mv %{buildroot}/usr/docs/*.txt %{buildroot}%{_defaultdocdir}/%{name}-%{version}/
#Delete the logos
rm %{buildroot}/usr/docs/logos/*


%clean
rm -rf %{buildroot}


%files
%defattr(-,root,root,-)
%doc README docs/AUTHORS docs/BUGS docs/ChangeLog
%doc docs/LICENSE* docs/NEWS docs/ROADMAP docs/TODO docs/VERSION 
%doc examples/ tests/
%{_mandir}/man*/iw*.*
%{python_sitelib}/pythonwifi/
%{python_sitelib}/python_wifi*.egg-info


%changelog
* Thu Dec 24 2009 Fabian Affolter <fabian@bernewireless.net> - 0.5.0-2
- Updated the convert to utf-8 part
- Fixed permissions
- Added license for examples
- Fixed tarball URL
- Added man pages

* Wed Dec 23 2009 Fabian Affolter <fabian@bernewireless.net> - 0.5.0-1
- Updated docs
- Updated BR
- Updated to new upstream version 0.5.0

* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Wed Feb 18 2009 Fabian Affolter <fabian@bernewireless.net> - 0.3.1-2
- Changes acc. to bug #478300

* Sat Dec 27 2008 Fabian Affolter <fabian@bernewireless.net> - 0.3.1-1
- Initial spec for Fedora