## START: Set by rpmautospec
## (rpmautospec version 0.6.0)
## RPMAUTOSPEC: autorelease, autochangelog
%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

%bcond xvfb_tests 1

%global desc %{expand:
A collection of custom wx widgets and utilities used by FSLeyes.}

Name:           python-fsleyes-widgets
Version:        0.14.7
Release:        %autorelease
Summary:        A collection of custom wx widgets and utilities used by FSLeyes

License:        Apache-2.0
URL:            https://pypi.python.org/pypi/fsleyes-widgets
Source:         %{pypi_source fsleyes_widgets}

BuildArch:      noarch

BuildRequires:  python3-devel
%if %{with xvfb_tests}
BuildRequires:  xorg-x11-server-Xvfb
# We BR pytest manually because other dependencies in requirements-dev.txt
# pertain to coverage analysis
# (https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_linters)
# or to Sphinx documentation (which we do not build).
BuildRequires:  %{py3_dist pytest}
%endif

%description %{desc}


%package -n python3-fsleyes-widgets
Summary:        %{summary}

%description -n python3-fsleyes-widgets %{desc}

# do not generate docs because sphinx docs bundle js etc. which are very hard to unbundle


%prep
%autosetup -n fsleyes_widgets-%{version}

# https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_linters
sed -r -i 's/[[:blank:]]--cov=[^[:blank:]]+//' setup.cfg

# remove unneeded shebangs
find fsleyes_widgets -type f -name '*.py' -exec sed -r -i '1{/^#!/d}' '{}' '+'

# Don't run coverage when running tests
sed -r -i 's/ ?--cov=fsleyes_widgets//' pyproject.toml


%generate_buildrequires
%pyproject_buildrequires


%build
%pyproject_wheel


%install
%pyproject_install
%pyproject_save_files fsleyes_widgets


%check
%if %{with xvfb_tests}
# From https://git.fmrib.ox.ac.uk/fsl/fsleyes/widgets/blob/master/.ci/test_template.sh
%global __pytest xvfb-run -a -s '-screen 0 1920x1200x24' pytest
%pytest -m 'not dodgy'
%else
%pyproject_check_import
%endif


%files -n python3-fsleyes-widgets -f %{pyproject_files}
# While %%pyproject_files contains LICENSE in .dist-info, we need to add
# COPYRIGHT manually, so we install both files in the same place.
%license LICENSE COPYRIGHT
%doc README.rst


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

* Sat Jun 08 2024 Python Maint <python-maint@redhat.com> - 0.14.3-18
- Rebuilt for Python 3.13

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

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

* Fri Jan 05 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 0.14.3-15
- Re-enable xvfb tests, as they seem to have become reliable

* Sat Jul 22 2023 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 0.14.3-1
- feat: update to 0.14.3 (fixes rhbz#2220901)

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

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

* Mon Jun 12 2023 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 0.14.2-1
- feat: update to 0.14.2

* Mon Feb 27 2023 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 0.13.0-1
- feat: update to 0.13.0 (fixes rhbz#2171873)

* Mon Feb 27 2023 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 0.12.3-7
- feat: use spdx identifier

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

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

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

* Fri May 06 2022 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 0.12.3-3
- chore: drop doc sub-package

* Sat Aug 07 2021 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 0.12.1-1
- Update to latest release

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

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

* Sun Mar 28 2021 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 0.11.2-1
- Update to latest release

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

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

* Thu Jun 25 2020 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 0.9.0-2
- Explicitly BR setuptools

* Sun Jun 07 2020 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 0.9.0-1
- Update to new release

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

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

* Mon Oct 28 2019 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 0.8.4-1
- Update to 0.8.4
- Make tests conditional

* Mon Sep 23 2019 Aniket Pradhan <major AT fedoraproject DOT org> - 0.8.2-1
- Update to 0.8.2

* Wed Sep 11 2019 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 0.8.0-2
- Fix failing tests
- https://github.com/pauldmccarthy/fsleyes-widgets/issues/2

* Sat Aug 31 2019 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 0.8.0-1
- Update to 0.8.0
- Report and disable failing test

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

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

* Fri Jun 07 2019 Petr Viktorin <pviktori@redhat.com> - 0.7.3-2
- Require sphinx_rtd_theme, which is no longer provided in Sphinx 2.0+

* Sat Feb 16 2019 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 0.7.3-1
- Update to latest release
- Remove py2 conditionals

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

* Thu Nov 08 2018 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 0.7.0-3
- Fix doc building on F29-

* Thu Nov 08 2018 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 0.7.0-2
- Remove leftover files from the doc
- Move requires to py3 sub package
- Remove dot at end of summary

* Fri Nov 02 2018 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 0.7.0-1
- Initial build


## END: Generated by rpmautospec