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

Name:           python-decopatch
Version:        1.4.10
Release:        %autorelease
Summary:        Helper to write python decorators

License:        BSD-3-Clause
URL:            https://pypi.org/project/decopatch
Source:	        %{pypi_source decopatch}
Patch:          0001-Adjust-for-whitespace-changes-with-python-3.12.patch
# Drop the pytest-runner dependency
# https://github.com/smarie/python-decopatch/pull/38
Patch:          decopatch-1.4.10-no-pytest-runner.patch

BuildArch:	noarch
BuildRequires:	pyproject-rpm-macros

# There is a build dependency loop when built with tests.
# It involves pytest-cases, pytest-harvest, pytest-steps.
# This bcons allows to bootstrap it.
%bcond tests 1

%global _description %{expand:
Because of a tiny oddity in the python language, writing decorators without help
can be a pain because you have to handle the no-parenthesis usage explicitly.
Decopatch provides a simple way to solve this issue so that writing decorators
is simple and straightforward.}

%description %_description

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

%description -n python3-decopatch %_description

%prep
%autosetup -p 1 -n decopatch-%{version}
cat >pyproject.toml <<EOF
[build-system]
requires = ["setuptools_scm"%{?with_tests:, "pypandoc", "pytest", "pytest-cases"}]
build-backend = "setuptools.build_meta"
EOF

%generate_buildrequires
%pyproject_buildrequires -r

%build
%pyproject_wheel

%install
%pyproject_install
%pyproject_save_files decopatch

%check
%if %{with tests}
TEST_ARGS=(
  # Test fails with whitespace differences in Python 3.13
  --deselect=tests/test_doc.py::test_doc_add_tag_function
)
PYTHONPATH=build/lib %python3 -m pytest -v "${TEST_ARGS[@]}"
%else
%pyproject_check_import
%endif

%files -n python3-decopatch
%license LICENSE
%doc README.md
%{python3_sitelib}/decopatch/
%{python3_sitelib}/decopatch-%{version}.dist-info/

%changelog
## START: Generated by rpmautospec
* Tue Dec 24 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 1.4.10-19
- Drop the pytest-runner dependency

* Mon Jul 22 2024 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 1.4.10-18
- Skip tests that fail with python3.13

* Fri Jul 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.10-17
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild

* Tue Jun 18 2024 Python Maint <python-maint@redhat.com> - 1.4.10-16
- Rebuilt for Python 3.13

* Mon Jun 10 2024 Python Maint <python-maint@redhat.com> - 1.4.10-15
- Bootstrap for Python 3.13

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

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

* Tue Nov 21 2023 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 1.4.10-12
- Convert license tag to SPDX

* Tue Jul 25 2023 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 1.4.10-11
- Fix tests for python 3.12

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

* Wed Jul 12 2023 Python Maint <python-maint@redhat.com> - 1.4.10-8
- Rebuilt for Python 3.12

* Tue Jun 13 2023 Python Maint <python-maint@redhat.com> - 1.4.10-7
- Bootstrap for Python 3.12

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

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

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

* Wed Jun 15 2022 Python Maint <python-maint@redhat.com> - 1.4.10-3
- Bootstrap for Python 3.11

* Wed Jun 15 2022 Miro Hrončok <miro@hroncok.cz> - 1.4.10-2
- Introduce a tests bcond

* Fri Apr 22 2022 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 1.4.10-1
- Version 1.4.10 (rhbz#2059532)

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

* Tue Jul 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.6-7
- Second attempt - Rebuilt for
  https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

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

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

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

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

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

* Sat Aug 10 2019 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 1.4.6-1
- Initial packaging

## END: Generated by rpmautospec