## START: Set by rpmautospec
## (rpmautospec version 0.6.0)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 1;
    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 _description %{expand:
inspyred is a free, open source framework for creating biologically-inspired
computational intelligence algorithms in Python, including evolutionary
computation, swarm intelligence, and immunocomputing. Additionally, inspyred
provides easy-to-use canonical versions of many bio-inspired algorithms for
users who do not need much customization.}


Name:           python-inspyred
Version:        1.0.2

%global forgeurl https://github.com/aarongarrett/inspyred/
%forgemeta

Release:        %{autorelease}
Summary:        Library for bio-inspired computational intelligence

License:        MIT
URL:            %{forgeurl}
Source:         %{forgesource}

BuildArch:      noarch
BuildRequires:  python3-devel

%description %_description

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

%description -n python3-inspyred %_description

%prep
%forgeautosetup -p1

# Remove unneeded BRs
sed -e '/flake8/ d' \
    -e '/tox/ d' \
    -e '/coverage/ d' \
    -e '/Sphinx/ d' \
    -i requirements_dev.txt

# pp is not packaged (nor maintained), so skip its test
# upstream has been informed: https://github.com/aarongarrett/inspyred/pull/21#issue-1061517666
sed -i -e '/test_parallel_evaluation_pp/i \    @unittest.skip("pp unavailable")' tests/evaluator_tests.py

# May fail simply because of randomisation, so we skip it
# https://github.com/aarongarrett/inspyred/blob/d5976ab503cc9d51c6f586cbb7bb601a38c01128/tests/operator_tests.py#L69
sed -i -e '/test_multiprocessing_migration/i \    @unittest.skip("unreliable")' tests/operator_tests.py

%generate_buildrequires
%pyproject_buildrequires -r requirements_dev.txt


%build
%pyproject_wheel

%install
%pyproject_install
%pyproject_save_files inspyred

%check
# Make tests that are working discoverable
mv -v tests/example_tests.py tests/test_example.py
mv -v tests/supplemental_tests.py tests/test_supplemental.py
%pytest -v
# Since the tests are bit brittle also run import check
%pyproject_check_import

%files -n python3-inspyred -f %{pyproject_files}
%doc README.rst HISTORY.rst CONTRIBUTING.rst
%doc examples
%{_bindir}/inspyred

%changelog
## START: Generated by rpmautospec
* Fri May 31 2024 Sandro <devel@penguinpee.nl> - 1.0.2-1
- Update to 1.0.2
- Close RHBZ#2256754

* Fri Jan 26 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.1-15
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Mon Jan 22 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.1-14
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

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

* Tue Jun 27 2023 Python Maint <python-maint@redhat.com> - 1.0.1-12
- Rebuilt for Python 3.12

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

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

* Wed Jun 15 2022 Python Maint <python-maint@redhat.com> - 1.0.1-9
- Rebuilt for Python 3.11

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

* Wed Nov 24 2021 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 1.0.1-7
- fix: ensure all sub-modules are included in the RPM

* Wed Nov 24 2021 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 1.0.1-6
- fix: disable unreliable test

* Wed Nov 24 2021 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 1.0.1-5
- feat: update to latest snapshot

* Fri Nov 19 2021 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 1.0.1-4
- feat: check in source

* Fri Nov 19 2021 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 1.0.1-3
- feat: drop doc sub-package

* Fri Nov 19 2021 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 1.0.1-2
- feat: ready for review

* Fri Nov 19 2021 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 1.0.1-1
- feat: init
## END: Generated by rpmautospec