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

%global srcname trailrunner

%global common_description %{expand:
trailrunner is a simple library for walking paths on the filesystem, and
executing functions for each file found. trailrunner obeys project level
.gitignore files, and runs functions on a process pool for increased
performance. trailrunner is designed for use by linting, formatting, and other
developer tools that need to find and operate on all files in project in a
predictable fashion with a minimal API.}

Name:           python-%{srcname}
Version:        1.4.0
Release:        %autorelease
Summary:        Walk paths and run things

License:        MIT
URL:            https://trailrunner.omnilib.dev/
Source:         %{pypi_source}

BuildArch:      noarch

BuildRequires:  python3-devel
BuildRequires:  python3dist(pytest)
%if %{with docs}
BuildRequires:  python3-docs
BuildRequires:  python3dist(sphinx)
BuildRequires:  python3dist(sphinx-mdinclude)
BuildRequires:  sed
%endif

%description
%{common_description}


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

%description -n python3-%{srcname}
%{common_description}


%if %{with docs}
%package        doc
Summary:        %{name} documentation
Requires:       python3-docs

%description    doc
Documentation for %{name}.
%endif


%prep
%autosetup -n %{srcname}-%{version} -p1
%if %{with docs}
# Use local intersphinx inventory
sed -r \
    -e 's|https://docs.python.org/3|%{_docdir}/python3-docs/html|' \
    -i docs/conf.py
%endif

%generate_buildrequires
%pyproject_buildrequires


%build
%pyproject_wheel

# generate html docs
PYTHONPATH=${PWD} sphinx-build-3 docs html
# remove the sphinx-build leftovers
rm -rf html/.{doctrees,buildinfo}


%install
%pyproject_install
%pyproject_save_files %{srcname}


%check
%pytest -v trailrunner/tests/*


%files -n python3-%{srcname} -f %{pyproject_files}
%license LICENSE
%doc README.md CHANGELOG.md


%if %{with docs}
%files doc
%doc html
%license LICENSE
%endif


%changelog
## START: Generated by rpmautospec
* Fri Jan 26 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

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

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

* Mon Jun 26 2023 Python Maint <python-maint@redhat.com> - 1.4.0-2
- Rebuilt for Python 3.12

* Sun Jun 25 2023 Davide Cavalca <dcavalca@fedoraproject.org> - 1.4.0-1
- Update to 1.4.0; Fixes: RHBZ#2181995

* Thu Jun 15 2023 Python Maint <python-maint@redhat.com> - 1.3.0-3
- Rebuilt for Python 3.12

* Sat Mar 18 2023 Michel Alexandre Salim <salimma@fedoraproject.org> - 1.3.0-2
- Generate documentation

* Fri Mar 17 2023 Michel Alexandre Salim <salimma@fedoraproject.org> - 1.3.0-1
- Initial Fedora package
## END: Generated by rpmautospec