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

%global pypi_name ftfy
%global github_name python-%{pypi_name}

Name:           python-%{pypi_name}
Version:        6.2.0
Release:        %autorelease
Summary:        Fixes mojibake and other glitches in Unicode text, after the fact

License:        MIT
URL:            https://github.com/rspeer/python-ftfy
Source:         %url/archive/v%{version}/%{github_name}-%{version}.tar.gz

BuildArch:      noarch
BuildRequires:  poetry
BuildRequires:  python3-devel
BuildRequires:  python3dist(furo)
BuildRequires:  python3dist(pytest)
BuildRequires:  python3dist(sphinx)

%global common_description %{expand:
ftfy fixes mojibake and other glitches in Unicode text, after the fact.}

%description %{common_description}

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

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

%package -n python-%{pypi_name}-doc
Summary:        Documentation for python-%{pypi_name}
# BSD-2-Clause: Sphinx javascript
# MIT: jquery
License:        MIT AND BSD-2-Clause
BuildArch:      noarch
Requires:       python3-%{pypi_name} = %{?epoch:%{epoch}:}%{version}-%{release}
Provides:       bundled(js-sphinx_javascript_frameworks_compat)
Provides:       bundled(js-doctools)
Provides:       bundled(js-jquery)
Provides:       bundled(js-language_data)
Provides:       bundled(js-searchtools)

%description -n python-%{pypi_name}-doc
%{common_description}

This package is providing the documentation for %{pypi_name}.

%prep
%autosetup -p1 -n %{github_name}-%{version}

%generate_buildrequires
%pyproject_buildrequires

%build
%pyproject_wheel

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

%install
%pyproject_install
%pyproject_save_files %{pypi_name}
rm -rfv %{buildroot}%{python3_sitelib}/*.md

%check
# Don't work in Mock
rm -rfv tests/test_cli.py
%pytest

%files -n python3-%{pypi_name} -f %{pyproject_files}
%doc CHANGELOG.md README.md
%license LICENSE.txt
%{_bindir}/ftfy

%files -n python-%{pypi_name}-doc
%doc html
%license html/_static/scripts/furo.js.LICENSE.txt

%changelog
## START: Generated by rpmautospec
* Sun Jun 09 2024 Python Maint <python-maint@redhat.com> - 6.2.0-2
- Rebuilt for Python 3.13

* Wed May 22 2024 Robert-André Mauchin <zebob.m@gmail.com> - 6.2.0-1
- Update to 6.2.0

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

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

* Sat Oct 28 2023 Robert-André Mauchin <zebob.m@gmail.com> - 6.1.1-1
- Initial import
## END: Generated by rpmautospec