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

%bcond tests 1

%global pypi_name pyunicorn

%global _description %{expand:
pyunicorn (Unified Complex Network and RecurreNce analysis toolbox)
is a fully object-oriented Python package for the advanced
analysis and modeling of complex networks. Above the standard measures
of complex network theory such as degree, betweenness and clustering 
coefficient it provides some uncommon but interesting statistics like 
Newman's random walk betweenness. pyunicorn features novel node-weighted
(node splitting invariant) network statistics as well as measures 
designed for analyzing networks of interacting/interdependent networks.}

Name:           python-%{pypi_name}
Version:        0.8.0
Release:        %{autorelease}
Summary:        Unified complex network and recurrence analysis toolbox

%global forgeurl https://github.com/pik-copan/pyunicorn
%global tag v%{version}
%forgemeta

License:        BSD-3-Clause
URL:            http://www.pik-potsdam.de/~donges/pyunicorn/
Source:         %{forgesource}

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

BuildRequires:  gcc-c++
BuildRequires:  make
BuildRequires:  python3-devel

# The tests extra also specifies linters. Therefore we specify manually.
%if %{with tests}
BuildRequires:  python3-cartopy
BuildRequires:  python3-matplotlib
Buildrequires:  python3-networkx
BuildRequires:  python3-pytest
BuildRequires:  python3-pytest-xdist
%endif

# Required for the import test. It crashes with a ModuleNotFound.
# For that reason we make those Requires instead of Recommends as well.
%if %{without tests}
BuildRequires:  python3-basemap
BuildRequires:  python3-cartopy
%endif

%description %_description


%package -n     python3-%{pypi_name}
Summary:        %{summary}
Obsoletes:      python-%{pypi_name}-doc < 0.8.0

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


%prep
%forgeautosetup -p1

for lib in $(find . -name "*.py"); do
 sed '1{\@^#!/usr/bin/python@d}' $lib > $lib.new &&
 touch -r $lib $lib.new &&
 mv $lib.new $lib
done

%generate_buildrequires
%pyproject_buildrequires


%build
%pyproject_wheel


%install
%pyproject_install
%pyproject_save_files -l %{pypi_name}


%check
%if %{with tests}
# Test requires network
k="${k-}${k+ and }not TestMapPlot"
%pytest ${k+-k }"${k-}"
%else
%pyproject_check_import
%endif


%files -n python3-%{pypi_name} -f %{pyproject_files}
%doc README.rst


%changelog
## START: Generated by rpmautospec
* Mon Oct 21 2024 Sandro <devel@penguinpee.nl> - 0.8.0-1
- Update to 0.8.0 (RHBZ#2312892)

* Wed Sep 04 2024 Miroslav Suchý <msuchy@redhat.com> - 0.7.0~a1-9
- convert license to SPDX

* Fri Jul 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.0~a1-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild

* Wed Jun 26 2024 Python Maint <python-maint@redhat.com> - 0.7.0~a1-7
- Rebuilt for Python 3.13

* Fri May 17 2024 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.7.0~a1-6
- Exclude i686 from builds

* Fri Jan 26 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.0~a1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Mon Jan 22 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.0~a1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Mon Nov 13 2023 Karolina Surma <ksurma@redhat.com> - 0.7.0~a1-3
- Allow to build with Cython 3.0.5

* Tue Sep 05 2023 Sandro <devel@penguinpee.nl> - 0.7.0~a1-2
- Fix version mismatch (RPM vs. upstream)

* Tue Sep 05 2023 Sandro <devel@penguinpee.nl> - 0.7.0~a1-1
- Make sure version sorts correctly

* Sun Jul 30 2023 Sandro <devel@penguinpee.nl> - 0.7.0a1-1
- Update to 0.7.0a1 (RHBZ#2220464 RHBZ#2226306)
- Build from master branch
- Use forge macros for that
- Drop patches (no longer required)
- Clean up BRs
- Switch to pytest and fix command (unknown option '-n')
- Move BR python3-sphinx into conditional
- Use Cython < 3.0.0 (compat package)
- Clean up BRs for testing (python3-pytest-flake8 is retired)
- Tests now require python3-cartopy
- Generate docs in %%install

* Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.6.1-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

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

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

* Tue Jun 21 2022 Python Maint <python-maint@redhat.com> - 0.6.1-10
- Rebuilt for Python 3.11

* Sat Feb 19 2022 Iztok Fister Jr. <iztokf AT fedoraproject DOT org> - 0.6.1-9
- Add subpackage for docs

* Thu Feb 17 2022 Iztok Fister Jr. <iztokf AT fedoraproject DOT org> - 0.6.1-8
- Install examples/ in docs

* Thu Feb 17 2022 Iztok Fister Jr. <iztokf AT fedoraproject DOT org> - 0.6.1-7
- Improve description; define acronym

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

* Mon Dec 06 2021 Orion Poplawski <orion@nwra.com> - 0.6.1-5
- Fix igraph dependency (bz#2019113)

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

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

* Mon Mar 29 2021 Iztok Fister Jr. <iztokf AT fedoraproject DOT org> - 0.6.1-2
- New patch - one test is failing on s390x

* Mon Mar 29 2021 Iztok Fister Jr. <iztokf AT fedoraproject DOT org> - 0.6.1-1
- Multiple licences added

* Mon Mar 22 2021 Iztok Fister Jr. <iztokf AT fedoraproject DOT org> - 0.6.1-1
- Initial package

## END: Generated by rpmautospec