## START: Set by rpmautospec
## (rpmautospec version 0.3.0)
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 6;
    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 geoplot

%bcond_with network

Name:           python-%{srcname}
Version:        0.5.1
Release:        %autorelease
Summary:        High-level geospatial plotting for Python

License:        MIT
URL:            https://github.com/ResidentMario/geoplot
# PyPI tarball does not include tests.
Source0:        https://github.com/ResidentMario/%{srcname}/archive/%{version}/%{srcname}-%{version}.tar.gz
# Fedora specific
Patch:          0001-Remove-some-unavailable-test-dependencies.patch
# https://github.com/ResidentMario/geoplot/pull/286
Patch:          0002-Fix-tests-with-Matplotlib-3.7.patch
# Accommodate UserWarning not in geopandas 0.11
# https://github.com/ResidentMario/geoplot/pull/285
#   Fixes:
# Tests fail with geopandas 0.11
# https://github.com/ResidentMario/geoplot/issues/283
# https://bugzilla.redhat.com/show_bug.cgi?id=2148633
Patch:          https://github.com/ResidentMario/%{srcname}/pull/285.patch

BuildArch:      noarch
 
%global _description \
geoplot is a high-level Python geospatial plotting library. It's an extension \
to cartopy and matplotlib which makes mapping easy: like seaborn for \
geospatial.

%description %{_description}

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

%description -n python3-%{srcname} %{_description}

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

%generate_buildrequires
%pyproject_buildrequires -rx develop

%build
%pyproject_wheel

%install
%pyproject_install
%pyproject_save_files %{srcname}

%check
# Skip tests that use the network.
MPLBACKEND=Agg \
%if %{with network}
    %{pytest} tests/*tests.py
%else
    %{pytest} tests/*tests.py -k 'not webmap'
%endif

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

%changelog
* Wed Mar 01 2023 Elliott Sales de Andrade <quantum.analyst@gmail.com> 0.5.1-6
- Fix tests with Matplotlib 3.7

* Sun Feb 12 2023 Benjamin A. Beasley <code@musicinmybrain.net> 0.5.1-5
- Accommodate UserWarning not in geopandas 0.11 (fix RHBZ#2148633)

* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> 0.5.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> 0.5.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

* Wed Jun 29 2022 Elliott Sales de Andrade <quantum.analyst@gmail.com> 0.5.1-2
- Rebuilt for Python 3.11

* Sun Mar 20 2022 Elliott Sales de Andrade <quantum.analyst@gmail.com> 0.5.1-1
- Update to latest version (#2059013)

* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> 0.4.4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

* Sat Sep 11 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> 0.4.4-1
- Update to latest version (#2003298)

* Sat Sep 11 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> 0.4.3-5
- Switch to latest Python macros

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

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

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

* Thu Jun 17 2021 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.4.1-5
- Remove descartes dependency

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

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

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

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

* Sun May 17 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.4.1-1
- Update to latest version

* Fri May 01 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.4.0-2
- Fix contextily dependency (#1830383)

* Sat Feb 22 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.4.0-1
- Update to latest version

* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.4-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild

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

* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.4-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild

* Sun Mar 17 2019 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.2.4-2
- Update to latest version

* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.3-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Tue Jan 15 2019 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.2.3-2
- Enable python dependency generator

* Sun Jan 13 2019 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.2.3-1
- Update to latest version

* Mon Jul 23 2018 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.2.0-2
- Enable all tests

* Sun Jul 15 2018 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.2.0-1
- Initial package.