%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
Name: python-xlrd
Version: 0.9.2
Release: 5%{?dist}
Summary: Library to extract data from Microsoft Excel (TM) spreadsheet files
Group: Development/Languages
License: BSD
URL: http://www.python-excel.org/
Source0: http://pypi.python.org/packages/source/x/xlrd/xlrd-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
BuildRequires: python-devel, python3-devel, dos2unix
%description
Extract data from Excel spreadsheets (.xls and .xlsx, versions 2.0 onwards)
on any platform. Pure Python (2.6, 2.7, 3.2+). Strong support for Excel
dates. Unicode-aware.
%package -n python3-xlrd
Summary: Library to extract data from Microsoft Excel (TM) spreadsheet files
Group: Development/Languages
%description -n python3-xlrd
Extract data from Excel spreadsheets (.xls and .xlsx, versions 2.0 onwards)
on any platform. Pure Python (2.6, 2.7, 3.2+). Strong support for Excel
dates. Unicode-aware.
%prep
%setup -q -n xlrd-%{version}
# fix CRLF to LF
for i in */*.py *.html xlrd/doc/* xlrd/examples/*; do
# ignore missing files, they was may be only removed by mistake
dos2unix $i || :
done
for i in xlrd/doc/* xlrd/examples/xlrdnameAPIdemo.py; do
iconv -f iso8859-1 -t UTF-8 $i > $i.tmp
mv -f $i.tmp $i
done
# py3
rm -rf %{py3dir}
cp -a . %{py3dir}
%build
%{__python} setup.py build
pushd %{py3dir}
CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build
popd
%install
rm -rf $RPM_BUILD_ROOT
pushd %{py3dir}
%{__python3} setup.py install --skip-build --root $RPM_BUILD_ROOT
popd
%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
# add shebang and remove .py extension
(
echo '#!%{__python}'
cat $RPM_BUILD_ROOT%{_bindir}/runxlrd.py
) >> $RPM_BUILD_ROOT%{_bindir}/runxlrd
rm -rf $RPM_BUILD_ROOT%{_bindir}/runxlrd.py* \
$RPM_BUILD_ROOT/%{python_sitelib}/xlrd/doc \
$RPM_BUILD_ROOT/%{python_sitelib}/xlrd/examples \
$RPM_BUILD_ROOT/%{python3_sitelib}/xlrd/doc \
$RPM_BUILD_ROOT/%{python3_sitelib}/xlrd/examples
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%doc xlrd/doc/* xlrd/examples
%attr(755,root,root) %dir %{python_sitelib}/xlrd
%{python_sitelib}/xlrd/*
%if 0%{fedora} > 8
%{python_sitelib}/*egg-info
%endif
%attr(755,root,root) %{_bindir}/*
%files -n python3-xlrd
%defattr(-,root,root,-)
%doc xlrd/doc/* xlrd/examples
%attr(755,root,root) %dir %{python3_sitelib}/xlrd
%{python3_sitelib}/xlrd/*
%if 0%{fedora} > 8
%{python3_sitelib}/*egg-info
%endif
%changelog
* Sun Jun 08 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.2-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Wed May 28 2014 Kalev Lember <kalevlember@gmail.com> - 0.9.2-4
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4
* Tue Aug 27 2013 Ján ONDREJ (SAL) <ondrejj(at)salstar.sk> - 0.9.2-3
- add py3 support (bz#995971)
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Tue Apr 23 2013 Ján ONDREJ (SAL) <ondrejj(at)salstar.sk> - 0.9.2-1
- Update to upstream.
- Updated URL and description.
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.8.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
* Sun Oct 07 2012 Ján ONDREJ (SAL) <ondrejj(at)salstar.sk> - 0.8.0-1
- Update to upstream.
* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.7.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.7.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.7.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
* Mon Aug 23 2010 Ján ONDREJ (SAL) <ondrejj(at)salstar.sk> - 0.7.1-1
- new version
- fixed summary spelling
- fixed egg-info condition
- fixed source URL for new version
* Thu Jul 22 2010 David Malcolm <dmalcolm@redhat.com> - 0.6.1-10
- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild
* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.6.1-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
* Thu Feb 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.6.1-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
* Sat Nov 29 2008 Ignacio Vazquez-Abrams <ivazqueznet+rpm@gmail.com> - 0.6.1-7
- Rebuild for Python 2.6
* Mon Jun 2 2008 Jan ONDREJ (SAL) <ondrejj(at)salstar.sk> - 0.6.1-5
- removed "" for fedora macro
* Tue Jan 1 2008 Jan ONDREJ (SAL) <ondrejj(at)salstar.sk> - 0.6.1-4
- added eggs for Fedora >= 9
* Fri Sep 14 2007 Jan ONDREJ (SAL) <ondrejj(at)salstar.sk> 0.6.1-3
- doc files converted to UTF-8
- removed HISTORY.html README.html because they are also in xlrd/doc/
* Fri Sep 7 2007 Jan ONDREJ (SAL) <ondrejj(at)salstar.sk> - 0.6.1-2
- namewithoutprefix removed, too complicated and not required
- added directory xlrd
- permissions for python scripts set to 644
- files converted from DOS line-feeds to UNIX format
- "#!/usr/bin/env python" added to beginning runxlrd script
- removed doc and examples from site-packages/xlrd directory
* Tue Jun 12 2007 Sean Reifschneider <jafo@tummy.com> - 0.6.1-1
- Initial RPM spec file.