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

# We do not build Sphinx documentation because current versions of
# python-autoclasstoc bring in a large tree of unpackaged dependencies via the
# python-parametrized-from-file test dependency, so we have elected to retire
# rather than upgrade python-autoclasstoc.

Name:           python-vecrec
Version:        0.3.1
Release:        %autorelease
Summary:        2D vector and rectangle library

# SPDX
License:        MIT
URL:            https://github.com/kxgames/vecrec
Source:         %{pypi_source vecrec}

BuildArch:      noarch

BuildRequires:  python3-devel

BuildRequires:  python3dist(pytest)

%global common_description %{expand:
This package provides 2D vector and rectangle classes. These classes were
written to be used in games, so they have some methods that conveniently tie
into pyglet and pygame, but for the most part they are quite general and could
be used for almost anything.}
%description %{common_description}


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

Obsoletes:      python-vecrec-doc < 0.3.1-3

%description -n python3-vecrec %{common_description}


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

# Remove HTML coverage directory with bundled JavaScript and other cruft
rm -rvf tests/htmlcov
# Patch out coverage dependencies
sed -r -i '/\b(pytest-cov|coveralls)\b/d' pyproject.toml
sed -r -i \
    -e 's/[[:blank:]]--cov[^=[:blank:]]*[= ][^[:blank:]]+//g' \
    -e 's/--no-cov[^[:blank:]]*//g' tests/pytest.ini

# Remove shebangs from modules. These are not script-like, so shebangs are
# useless. The find-then-modify pattern keeps us from discarding mtimes on
# any sources that do not need modification.
find vecrec -type f -exec \
    gawk '/^#!/ { print FILENAME }; { nextfile }' '{}' '+' |
  xargs -r -t sed -r -i '1{/^#!/d}'


%generate_buildrequires
%pyproject_buildrequires -x tests


%build
%pyproject_wheel


%install
%pyproject_install
%pyproject_save_files vecrec


%check
%pytest tests


%files -n python3-vecrec -f %{pyproject_files}
# pyproject-rpm-macros takes care of LICENSE.txt; verify with “rpm -qL -p …”
%doc README.rst


%changelog
* Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.1-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

* Thu Jun 29 2023 Python Maint <python-maint@redhat.com> - 0.3.1-9
- Rebuilt for Python 3.12

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

* Mon Nov 28 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 0.3.1-6
- Confirm License is SPDX MIT

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

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

* Fri Mar 11 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 0.3.1-3
- Completely disable documentation

* Fri Mar 11 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 0.3.1-2
- Fix and enable Sphinx-generated PDF documentation

* Wed Mar 02 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 0.3.1-1
- Update to 1.3.1 (close RHBZ#2037893)

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

* Mon Dec 27 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 0.3.0-1
- Initial package (close RHBZ#2023407)