Blob Blame History Raw
%global pypi_name unicodecsv

%if 0%{?fedora}
%global with_python3 1
%endif

%{!?upstream_version: %global upstream_version %{version}%{?milestone}}

Name:           python-%{pypi_name}
Version:        0.14.1
Release:        4%{?dist}
Summary:        Drop-in replacement for Python 2.7's csv module which supports unicode strings
License:        BSD
URL:            https://github.com/jdunck/python-unicodecsv
Source0:        https://pypi.python.org/packages/source/u/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
BuildArch:      noarch

BuildRequires:  python2-devel
BuildRequires:  python-setuptools
BuildRequires:  python-unittest2 >= 0.5.1

Provides:       python2-%{pypi_name} = %{version}-%{release}

%description
The unicodecsv is a drop-in replacement for Python 2.7's
csv module which supports unicode strings without a hassle.
It is NOT a drop-in replacement for Python 3's csv module,
see https://github.com/jdunck/python-unicodecsv/issues/65

%if 0%{?with_python3}
%package -n python3-%{pypi_name}
Summary:        Drop-in replacement for Python 2.7's csv module which supports unicode strings
BuildArch:      noarch

BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
BuildRequires:  python3-unittest2 >= 0.5.1

%description -n python3-%{pypi_name}
The unicodecsv is a drop-in replacement for Python 2.7's
csv module which supports unicode strings without a hassle.

It is NOT a drop-in replacement for Python 3's csv module,
see https://github.com/jdunck/python-unicodecsv/issues/65
%endif


%prep
%setup -qc -n %{pypi_name}-%{upstream_version}
mv %{pypi_name}-%{upstream_version} python2

pushd python2
#TODO ask upstream to add LICENSE file
cp -p README.rst ..
popd

%if 0%{?with_python3}
cp -a python2 python3
%endif


%build
pushd python2
%{__python2} setup.py build
popd
%if 0%{?with_python3}
pushd python3
%{__python3} setup.py build
popd
%endif

%install
%if 0%{?with_python3}
pushd python3
%{__python3} setup.py install --skip-build --root %{buildroot}
popd
%endif

pushd python2
%{__python2} setup.py install --skip-build --root %{buildroot}
popd

%check
pushd python2
unit2 discover
popd
%if 0%{?with_python3}
pushd python3
python3-unit2 discover
popd
%endif


%files
%doc README.rst
%{python2_sitelib}/%{pypi_name}
%{python2_sitelib}/%{pypi_name}-*.egg-info

%if 0%{?with_python3}
%files -n python3-%{pypi_name}
%doc README.rst
%{python3_sitelib}/%{pypi_name}
%{python3_sitelib}/%{pypi_name}-*.egg-info
%endif

%changelog
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.14.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.14.1-3
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5

* Wed Oct 07 2015 Alan Pevec <alan.pevec@redhat.com> - 0.14.1-2
- clarify csv module API compatibility

* Thu Sep 24 2015 Alan Pevec <alan.pevec@redhat.com> - 0.14.1-1
- Update to upstream 0.14.1

* Fri Jul 31 2015 Alan Pevec <apevec@redhat.com> - 0.13.0-1
- Initial package.