Blob Blame History Raw
%global pypi_name csvkit
%global project_owner wireservice
%global github_name csvkit
%global desc csvkit is a suite of utilities for converting to and working with CSV, the king \
of tabular file formats.


Name:           python-%{pypi_name}
Version:        1.0.3
Release:        1%{?dist}
Summary:        Suite of utilities for converting to and working with CSV

License:        MIT
URL:            https://pypi.python.org/pypi/%{pypi_name}
Source0:        https://github.com/%{project_owner}/%{github_name}/archive/%{version}/%{github_name}-%{version}.tar.gz

BuildArch:      noarch

%description
%{desc}

%package -n     python2-%{pypi_name}
BuildRequires:  python2-devel
BuildRequires:  %{py2_dist nose}
BuildRequires:  %{py2_dist unittest2}
BuildRequires:  %{py2_dist agate} >= 1.6.1
BuildRequires:  %{py2_dist agate-excel} >= 0.2.2
BuildRequires:  %{py2_dist agate-dbf} >= 0.2.0
BuildRequires:  %{py2_dist agate-sql} >= 0.5.3
BuildRequires:  %{py2_dist six} >= 1.6.1
Requires:       %{py2_dist agate} >= 1.6.0
Requires:       %{py2_dist agate-excel} >= 0.2.1
Requires:       %{py2_dist agate-dbf} >= 0.2.0
Requires:       %{py2_dist agate-sql} >= 0.5.2
Requires:       %{py2_dist six} >= 1.6.1
Requires:       %{py2_dist future}
Summary:        %{summary}
%{?python_provide:%python_provide python2-%{pypi_name}}

%description -n python2-%{pypi_name}
%{desc}


%package -n     python3-%{pypi_name}
Summary:        %{summary}
BuildRequires:  python3-devel
BuildRequires:  %{py3_dist nose}
BuildRequires:  %{py3_dist agate} >= 1.6.0
BuildRequires:  %{py3_dist agate-excel} >= 0.2.1
BuildRequires:  %{py3_dist agate-dbf} >= 0.2.0
BuildRequires:  %{py3_dist agate-sql} >= 0.5.2
BuildRequires:  %{py3_dist six} >= 1.6.1
Requires:       %{py3_dist agate} >= 1.6.0
Requires:       %{py3_dist agate-excel} >= 0.2.1
Requires:       %{py3_dist agate-dbf} >= 0.2.0
Requires:       %{py3_dist agate-sql} >= 0.5.2
Requires:       %{py3_dist six} >= 1.6.1
Requires:       %{py3_dist future}
%{?python_provide:%python_provide python3-%{pypi_name}}

%description -n python3-%{pypi_name}
%{desc}


%package doc
BuildRequires:  python-sphinx-doc
BuildRequires:  python2-sphinx_rtd_theme
Summary:        %{summary}

%description doc
%{desc}

Documentation package

%prep
%setup -q -n %{github_name}-%{version}
rm -rf *.egg-info
# Fix non-executable-script
find csvkit -name \*.py -type f | xargs sed -i '1{\@^#!/usr/bin/env python@d}'


%build
%py2_build
%py3_build

cd docs
make html
make man


%install
#  install python3 first to have unversioned binaries for python 3
%py3_install
pushd %{buildroot}%{_bindir}  # Enter buildroot bindir to ease symlink creation
bins=($(ls *))
for bin in ${bins[@]}; do
    mv "${bin}" "${bin}-%{python3_version}"
    name=${bin##*/}
    ln -s "${name}-%{python3_version}" "${bin}-3"
done
popd


%py2_install
pushd %{buildroot}%{_bindir}
for bin in ${bins[@]}; do
    name=${bin##*/}
    ln -s "${name}" "${bin}-2"
    ln -s "${name}" "${bin}-%{python2_version}"
done
popd

mkdir -p %{buildroot}%{_mandir}/man1
for file in docs/_build/man/*.1; do
    install -p -m0644 ${file} %{buildroot}%{_mandir}/man1/
done

# Remove useful files in doc
rm docs/_build/html/.buildinfo

# Correct permissions in doc
chmod -x examples/realdata/census_2000/VROUTFSJ.TXt


%check
export LC_ALL='en_US.utf8'
nosetests-%{python2_version} tests -v
nosetests-%{python3_version} tests -v


%files -n python2-%{pypi_name}
%license COPYING
%doc README.rst CHANGELOG.rst AUTHORS.rst
%exclude %{_bindir}/*-3
%exclude %{_bindir}/*-%{python3_version}
%{_bindir}/*
%{_mandir}/man1/*
%{python2_sitelib}/%{pypi_name}-%{version}-py%{python2_version}.egg-info/
%{python2_sitelib}/%{pypi_name}/

%files -n python3-%{pypi_name}
%license COPYING
%doc README.rst CHANGELOG.rst AUTHORS.rst
%{_bindir}/*-3
%{_bindir}/*-%{python3_version}
%{python3_sitelib}/%{pypi_name}-%{version}-py%{python3_version}.egg-info/
%{python3_sitelib}/%{pypi_name}/


%files doc
%license COPYING
%doc README.rst CHANGELOG.rst AUTHORS.rst docs/_build/html examples


%changelog
* Mon Mar 12 2018 Julien Enselme <jujens@jujens.eu> - 1.0.3-1
- Update to 1.0.3

* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.2-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Mon Jan 29 2018 Iryna Shcherbina <ishcherb@redhat.com> - 1.0.2-3
- Update Python 2 dependency declarations to new packaging standards
  (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)

* Tue Jan 16 2018 Julien Enselme <jujens@jujens.eu> - 1.0.2-2
- Add missing dependency

* Sun  Oct 15 2017 Julien Enselme <jujens@jujens.eu> - 1.0.2-1
- Update to 1.0.2
- Use the %%{summary} macro
- Use the %%py2_dist and %%py3_dist macros
- Use the version instead of git tag to fetch the source on github

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.1-11.gitbf18815
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.1-10.gitbf18815
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Mon Dec 26 2016 Julien Enselme <jujens@jujens.eu> - 0.9.1-9.gitbf18815
- Fix XLSX reader

* Mon Dec 19 2016 Miro HronĨok <mhroncok@redhat.com> - 0.9.1-8.gitbf18815
- Rebuild for Python 3.6

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.1-7.gitbf18815
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Mon Jul 11 2016 Julien Enselme <jujens@jujens.eu> - 0.9.1-6.gitbf18815
- Correct typo in comment

* Sat Feb 6 2016 Julien Enselme <jujens@jujens.eu> - 0.9.1-5.gitbf18815
- Correct some rpmlint warnings

* Sun Jan 24 2016 Julien Enselme <jujens@jujens.eu> - 0.9.1-4.gitbf18815
- Correct build on rawhide.

* Sun Jan 24 2016 Julien Enselme <jujens@jujens.eu> - 0.9.1-3.gitbf18815
- Move unversionned binaries to python2 subpackage.

* Wed Nov 25 2015 Julien Enselme <jujens@jujens.eu> - 0.9.1-2.gitbf18815
- Add python-enum34 to the Requires for python 2 subpackage

* Mon Nov 9 2015 Julien Enselme <jujens@jujens.eu> - 0.9.1-1.gitbf18815
- Inital package