## START: Set by rpmautospec
## (rpmautospec version 0.3.0)
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 2;
    base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
    print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec

%global srcname visidata

Name:           %{srcname}
Version:        2.10.2
Release:        %autorelease
Summary:        Terminal interface for exploring and arranging tabular data

License:        GPLv3
URL:            https://visidata.org
Source0:        %pypi_source
# https://github.com/saulpw/visidata/pull/269
Patch0001:      0001-Remove-extra-copy-of-man-page.patch

BuildArch:      noarch

# https://fedoraproject.org/wiki/Changes/EncourageI686LeafRemoval
ExcludeArch: %{ix86}

BuildRequires:  python3-devel
BuildRequires:  python3dist(setuptools)
BuildRequires:  python3dist(pytest)

Requires:       python3-%{srcname} = %{version}-%{release}

%description
VisiData is an interactive multitool for tabular data. It combines the clarity
of a spreadsheet, the efficiency of the terminal, and the power of Python, into
a lightweight utility which can handle millions of rows with ease.


%package -n     python3-%{srcname}
Summary:        %{summary}

# Optional dependencies
Recommends: python3dist(PyYAML)
Recommends: python3dist(datapackage)
Recommends: python3dist(dnslib)
Recommends: python3dist(dpkt)
Recommends: python3dist(fonttools)
Recommends: python3dist(h5py)
Recommends: python3dist(lxml)
Recommends: python3dist(mapbox-vector-tile)
Recommends: python3dist(namestand)
Recommends: python3dist(numpy)
Recommends: python3dist(openpyxl)
Recommends: python3dist(pandas) >= 0.19.2
Recommends: python3dist(pdfminer-six)
Recommends: python3dist(psycopg2)
Recommends: python3dist(pypng)
Recommends: python3dist(pyshp)
Recommends: python3dist(requests)
Recommends: python3dist(sas7bdat)
Recommends: python3dist(savReaderWriter)
Recommends: python3dist(tabulate)
Recommends: python3dist(vobject)
Recommends: python3dist(wcwidth)
Recommends: python3dist(xlrd)
Recommends: python3dist(xport)

%description -n python3-%{srcname}
VisiData is an interactive multitool for tabular data. It combines the clarity
of a spreadsheet, the efficiency of the terminal, and the power of Python, into
a lightweight utility which can handle millions of rows with ease.


%prep
%autosetup -n %{srcname}-%{version} -p1

%generate_buildrequires
%pyproject_buildrequires

%build
%pyproject_wheel

%install
%pyproject_install
%pyproject_save_files %{srcname}

%check
mkdir HOME
touch HOME/.visidatarc  # Needed for TestCommands.test_baseCommands
export HOME=$PWD/HOME
%{pytest}

%files
%{_bindir}/visidata
%{_bindir}/vd
%{_mandir}/man1/vd.1*
%{_mandir}/man1/visidata.1*

%files -n python3-%{srcname} -f %{pyproject_files}
%doc README.md
%license LICENSE.gpl3

%changelog
* Mon Dec 19 2022 Elliott Sales de Andrade <quantum.analyst@gmail.com> 2.10.2-2
- Drop support for i686

* Sun Nov 27 2022 Elliott Sales de Andrade <quantum.analyst@gmail.com> 2.10.2-1
- Update to latest version (#2109366)

* Sat Jul 23 2022 Fedora Release Engineering <releng@fedoraproject.org> 2.8-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

* Mon Jun 13 2022 Python Maint <python-maint@redhat.com> 2.8-3
- Rebuilt for Python 3.11

* Sat Jan 22 2022 Fedora Release Engineering <releng@fedoraproject.org> 2.8-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

* Mon Dec 20 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> 2.8-1
- Update to latest version (#2023168)

* Mon Dec 20 2021 Miro Hrončok <miro@hroncok.cz> 2.6.1-2
- Use PEP 503 names for Recommends

* Sat Oct 09 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> 2.6.1-1
- Update to latest version (#2008763)

* Wed Sep 22 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> 2.6-1
- Update to latest version (#2005758)

* Wed Sep 22 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> 2.5-4
- Update to latest Python macros

* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.5-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

* Sun Jul 11 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 2.5-1
- Update to latest version (#1980629)

* Fri Jun 04 2021 Python Maint <python-maint@redhat.com> - 2.4-2
- Rebuilt for Python 3.10

* Mon Apr 12 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 2.4-1
- Update to latest version (#1948367)

* Mon Apr 05 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 2.3-1
- Update to latest version (#1946138)

* Mon Feb 08 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 2.2.1-1
- Update to latest version
- Fixes rhbz#1926052

* Sat Feb 06 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 2.2-1
- Update to latest version
- Fixes rhbz#1922737

* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

* Mon Jan 11 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 2.1.1-1
- Update to latest version (#1912222)

* Sat Dec 12 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 2.1-1
- Update to latest version (#1904920)

* Mon Oct 12 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 2.0.1-1
- Update to latest version (#1887632)

* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.2-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild

* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 1.5.2-7
- Rebuilt for Python 3.9

* Fri Jan 31 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.2-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild

* Thu Oct 03 2019 Miro Hrončok <mhroncok@redhat.com> - 1.5.2-5
- Rebuilt for Python 3.8.0rc1 (#1748018)

* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 1.5.2-4
- Rebuilt for Python 3.8

* Sat Jul 27 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild

* Wed Mar 27 2019 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1.5.2-2
- Fix issues from review

* Tue Mar 26 2019 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1.5.2-1
- Initial package.