## 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

Name:           python-flexparser
Version:        0.4
Release:        %autorelease
Summary:        Parsing made fun … using typing

License:        BSD-3-Clause
URL:            https://github.com/hgrecco/flexparser
Source:         %{pypi_source flexparser}

BuildArch:      noarch

BuildRequires:  python3-devel

# See requirements.test.txt. We list test dependencies manually since we do not
# want pytest-cov
# (https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_linters)
# and the other pytest plugins are spurious
# (https://github.com/hgrecco/flexparser/pull/10).
BuildRequires:  %{py3_dist pytest}

%global common_description %{expand:
The idea is quite simple. You write a class for every type of content (called
here ParsedStatement) you need to parse. Each class should have a from_string
constructor. We used extensively the typing module to make the output structure
easy to use and less error prone.}

%description %{common_description}


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

%description -n python3-flexparser %{common_description}


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


%generate_buildrequires
%pyproject_buildrequires


%build
%pyproject_wheel


%install
%pyproject_install
%pyproject_save_files -l flexparser

# Upstream probably doesn’t want to install flexparser.testsuite, but we don’t
# know how to suggest a fix given “[BUG] options.packages.find.exclude not
# taking effect when include_package_data = True”,
# https://github.com/pypa/setuptools/issues/3260.
#
# Still, we don’t want to install the test suite, so we just remove the files
# manually for now.
rm -rvf '%{buildroot}%{python3_sitelib}/flexparser/testsuite'
sed -r -i '/\/flexparser\/testsuite/d' %{pyproject_files}


%check
%pytest


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


%changelog
## START: Generated by rpmautospec
* Thu Nov 07 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 0.4-1
- Update to 0.4 (close RHBZ#2324278)

* Tue Aug 20 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 0.3.1-5
- Fix manual test BuildRequires

* Tue Aug 20 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 0.3.1-4
- Drop some unnecessary testing BuildRequires

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

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

* Thu Jun 06 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 0.3.1-1
- Update to 0.3.1 (close RHBZ#2290659)

* Wed Mar 20 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 0.3-1
- Update to 0.3 (close RHBZ#2268632)

* Wed Mar 20 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 0.2.1-1
- Update to 0.2.1

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

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

* Sun Dec 31 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 0.2-2
- Assert that %%pyproject_files contains a license file

* Sun Dec 31 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 0.2-1
- Initial package (close RHBZ#2247275)
## END: Generated by rpmautospec