%if 0%{?fedora} > 12 || 0%{?rhel} > 6
%global with_python3 1
%endif
# Disable python3 for now since this package is in such a strange state.
%global with_python3 0
%global modname tablib
%global raw_version 0.9.11
%global checkout 20120702git752443f
Name: python-tablib
Version: %{raw_version}.%{checkout}
Release: 6%{?dist}
Summary: Format agnostic tabular data library (XLS, JSON, YAML, CSV)
Group: Development/Libraries
License: MIT
URL: http://github.com/kennethreitz/tablib
Source0: %{modname}-%{version}.tar.gz
# https://github.com/kennethreitz/tablib/pull/68
Patch0: 0001-Py3-support.patch
Patch1: 0002-Broken-setup.py.patch
BuildArch: noarch
BuildRequires: python2-devel
Requires: PyYAML
%if 0%{?with_python3}
BuildRequires: python-tools
BuildRequires: python3-devel
%endif
%description
Tablib is a format-agnostic tabular dataset library, written in Python.
Output formats supported:
- Excel (Sets + Books)
- JSON (Sets + Books)
- YAML (Sets + Books)
- HTML (Sets)
- TSV (Sets)
- CSV (Sets)
%if 0%{?with_python3}
%package -n python3-tablib
Summary: Format agnostic tabular data library (XLS, JSON, YAML, CSV)
Group: Development/Libraries
Requires: python3-PyYAML
%description -n python3-tablib
Tablib is a format-agnostic tabular dataset library, written in Python.
Output formats supported:
- Excel (Sets + Books)
- JSON (Sets + Books)
- YAML (Sets + Books)
- HTML (Sets)
- TSV (Sets)
- CSV (Sets)
%endif
%prep
%setup -q -n %{modname}
%patch0 -p1 -b .py3_support
%patch1 -p1 -b .broken_setup_py
# Remove shebangs
for lib in $(find . -name "*.py"); do
sed '/\/usr\/bin\/env/d' $lib > $lib.new &&
touch -r $lib $lib.new &&
mv $lib.new $lib
done
%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
pushd %{py3dir}
sed -i 's/xlwt/xlwt3/' setup.py
sed -i 's/openpyxl/openpyxl3/' setup.py
sed -i 's/\.yaml/.yaml3/' setup.py
rm -rf tablib/packages/odf
rm -rf tablib/packages/openpyxl
rm -rf tablib/packages/xlwt
rm -rf tablib/packages/yaml
find . -name "*.py" | grep -v 3 | xargs 2to3 -w
popd
%endif
%build
%{__python} setup.py build
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif
%install
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install -O1 --skip-build --root=%{buildroot}
popd
%endif
%{__python} setup.py install -O1 --skip-build --root=%{buildroot}
%files
%doc README.rst LICENSE AUTHORS HACKING HISTORY.rst NOTICE TODO.rst
%{python_sitelib}/%{modname}
%{python_sitelib}/%{modname}-%{raw_version}*
%if 0%{?with_python3}
%files -n python3-%{modname}
%doc README.rst LICENSE AUTHORS HACKING HISTORY.rst NOTICE TODO.rst
%{python3_sitelib}/%{modname}
%{python3_sitelib}/%{modname}-%{raw_version}-*
%endif
%changelog
* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.11.20120702git752443f-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Fri Jul 06 2012 Ralph Bean <rbean@redhat.com> - 0.9.11.20120702git752443f-5
- Disable python3 for now since the package is so unstable.
* Fri Jul 06 2012 Ralph Bean <rbean@redhat.com> - 0.9.11.20120702git752443f-4
- Patch to fix broken setup.py
* Wed Jul 04 2012 Ralph Bean <rbean@redhat.com> - 0.9.11.20120702git752443f-3
- Removed shebangs.
* Wed Jul 04 2012 Ralph Bean <rbean@redhat.com> - 0.9.11.20120702git752443f-2
- Added link to upstream bug for patch.
* Thu Jun 28 2012 Ralph Bean <rbean@redhat.com> - 0.9.11.20120702git752443f-1
- Initial package for Fedora