%global python3_pkgversion 3.11
Name:           python-sphinx-inline-tabs
# There are 2 different versions here:
# https://github.com/pradyunsg/sphinx-inline-tabs/issues/7
Version:        2023.04.21
%global tag     2023.04.21
Release:        2.ac15.py3.11%{?dist}
Summary:        Add inline tabbed content to your Sphinx documentation
# SPDX
License:        MIT
URL:            https://github.com/pradyunsg/sphinx-inline-tabs
Source0:        %{url}/archive/%{tag}/sphinx-inline-tabs-%{tag}.tar.gz

BuildArch:      noarch
BuildRequires:  python%{python3_pkgversion}-devel
BuildRequires:  pyproject-rpm-macros

%global _description %{expand:
Add inline tabbed content to your Sphinx documentation.

Features:

- Elegant design: Small footprint in the markup and generated website,
  while looking good.
- Configurable: All the colors can be configured using CSS variables.
- Synchronization: Tabs with the same label all switch with a single click.
- Works without JavaScript: JavaScript is not required for the basics, only for
  synchronization.}

%description %_description


%package -n python%{python3_pkgversion}-sphinx-inline-tabs
Summary:        %{summary}

%description -n python%{python3_pkgversion}-sphinx-inline-tabs  %_description


%prep
%autosetup -p1 -n sphinx-inline-tabs-%{tag}


%generate_buildrequires
# There is a [test] extra, but there are no tests :/
# https://github.com/pradyunsg/sphinx-inline-tabs/issues/6
%pyproject_buildrequires -r


%build
%pyproject_wheel


%install
%pyproject_install
%pyproject_save_files sphinx_inline_tabs


for b in $(find %{buildroot}%{_bindir}/ -type f) ; do mv "$b" $(sed -re "s|(.*)$|\1-%{python3_pkgversion}|"<<<"$b"); done
for m in $(find %{buildroot}%{_mandir}/ -type f) ; do mv "$m" $(sed -re "s|(.*).([1-8])(.*)$|\1-%{python3_pkgversion}.\2\3|"<<<"$m"); done
for m in $(find %{buildroot}%{_datadir}/locale/* -type f) ; do mv "$m" $(sed -re "s|(.*).mo$|\1-%{python3_pkgversion}.mo|"<<<"$m"); done
for l in $(find %{buildroot}/usr/lib64/lib* -type f -o -type l) ; do mv "$l" $(sed -re "s|(.*).so(.*)$|\1-py%{python3_pkgversion}.so\2|"<<<"$l"); done
for p in $(find %{buildroot}/usr/lib64/pkgconfig/* -type f) ; do mv "$p" $(sed -re "s|(.*).pc$|\1-py%{python3_pkgversion}.pc|"<<<"$p"); done
%files -n python%{python3_pkgversion}-sphinx-inline-tabs -f %{pyproject_files}
%doc README.md
%doc CODE_OF_CONDUCT.md
%license LICENSE


%changelog
* Thu May 02 2024 Ding-Yi Chen <dingyichen@gmail.com> -  2023.04.21-2.ac15.py3.11
 - Cut corner packaging