## START: Set by rpmautospec
## (rpmautospec version 0.7.3)
## 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

%global pypi_name mizani

# Generate HTML documentation
%bcond_without doc

# Provide man pages
%bcond_without man

Name:           python-%{pypi_name}
Version:        0.13.1
Release:        %{autorelease}
Summary:        Scales package for graphics

%global forgeurl https://github.com/has2k1/mizani
%forgemeta

# MIT License applies to doc/theme/static/bootstrap-3.4.1
# Python-2.0.1 license applies to doc/_static/copybutton.js
License:        BSD-3-Clause AND MIT AND Python-2.0.1
URL:            %forgeurl
Source:         %forgesource

BuildArch:      noarch
BuildRequires:  python3-devel
BuildRequires:  python3-pytest
BuildRequires:  git-core
%if %{with doc} || %{with man}
BuildRequires:  make
BuildRequires:  coreutils
%if %{with doc}
BuildRequires:  python3-sphinx
%endif
%if %{with man}
BuildRequires:  python3-numpydoc
%endif
%endif

%global _description %{expand:
Mizani is a scales package for graphics. It is written in Python and is
based on Hadley Wickham’s Scales.}

%description %_description


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

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


%if %{with doc}
%package doc
Summary:        HTML documentation for %{name}
Requires:       python3-%{pypi_name} == %{version}-%{release}

%description doc
%{summary}
%endif


%prep
%forgeautosetup -p1

# Disable coverage
sed -i -e 's/--cov=mizani --cov-report=xml//' pyproject.toml


%generate_buildrequires
export SETUPTOOLS_SCM_PRETEND_VERSION=%{version}
%pyproject_buildrequires


%build
export SETUPTOOLS_SCM_PRETEND_VERSION=%{version}
%pyproject_wheel
%if %{with doc} || %{with man}
  pushd doc
  %if %{with doc}
    make html
  %endif
  %if %{with man}
    make man
  %endif
  popd
%endif


%install
%pyproject_install
%if %{with doc}
  mkdir -p %{buildroot}/%{_pkgdocdir}
  cp -a doc/_build/html %{buildroot}/%{_pkgdocdir}
  rm -rf %{buildroot}/%{_pkgdocdir}/html/.buildinfo
%endif
%if %{with man}
  mkdir -p %{buildroot}/%{_mandir}/man1
  cp -a doc/_build/man/*.1 %{buildroot}/%{_mandir}/man1
%endif
%pyproject_save_files -l %{pypi_name}


%check
%pytest -v


%files -n python3-%{pypi_name} -f %{pyproject_files}
%doc README.md
%if %{with man}
%{_mandir}/man1/%{pypi_name}.1*
%endif
%license licences/*LICENSE

%if %{with doc}
%files doc
%dir %{_pkgdocdir}
%doc %{_pkgdocdir}/html
%endif


%changelog
## START: Generated by rpmautospec
* Tue Dec 10 2024 Packit <hello@packit.dev> - 0.13.1-1
- Update to 0.13.1 upstream release
- Resolves: rhbz#2331413

* Mon Nov 18 2024 Sandro <devel@penguinpee.nl> - 0.13.0-2
- Allow skipping automatic Packit build

* Sat Oct 26 2024 Packit <hello@packit.dev> - 0.13.0-1
- Update to 0.13.0 upstream release
- Resolves: rhbz#2321897

* Thu Sep 05 2024 Packit <hello@packit.dev> - 0.12.2-1
- Update to 0.12.2 upstream release
- Resolves: rhbz#2301604

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

* Wed Jun 26 2024 Sandro <devel@penguinpee.nl> - 0.11.4-8
- Fix wrong version in Python metadata

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

* Fri May 24 2024 Packit <hello@packit.dev> - 0.11.4-1
- Update to 0.11.4 upstream release
- Resolves: rhbz#2283108

* Fri Apr 26 2024 Packit <hello@packit.dev> - 0.11.2-1
- Update to 0.11.2 upstream release
- Resolves: rhbz#2277402

* Wed Mar 27 2024 Packit <hello@packit.dev> - 0.11.1-1
- [packit] 0.11.1 upstream release
- Resolves: rhbz#2271785

* Mon Feb 12 2024 Packit <hello@packit.dev> - 0.11.0-1
- [packit] 0.11.0 upstream release
- Resolves rhbz#2263873

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

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

* Tue Sep 12 2023 Sandro <devel@penguinpee.nl> - 0.9.3-1
- Update to 0.9.3 (bugfix release)

* Tue Sep 12 2023 Sandro <devel@penguinpee.nl> - 0.9.2-1
- Revert "Update to 0.10.0 (RHBZ#2227226)"

* Sat Sep 09 2023 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 0.10.0-2
- chore(packit): init

* Sun Sep 03 2023 Sandro <devel@penguinpee.nl> - 0.10.0-1
- Update to 0.10.0 (RHBZ#2227226)

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

* Wed Jun 28 2023 Python Maint <python-maint@redhat.com> - 0.9.2-3
- Rebuilt for Python 3.12

* Sun Jun 25 2023 Sandro <devel@penguinpee.nl> - 0.9.2-2
- Fix packaging of man pages and docs
- Use %%{buildroot} macro instead of $RPM_BUILD_ROOT

* Sat Jun 03 2023 Sandro <devel@penguinpee.nl> - 0.9.2-1
- Update tp 0.9.2 (RHBZ#2208636)

* Wed Apr 19 2023 Sandro <devel@penguinpee.nl> - 0.9.0-3
- Drop '-t' (not using tox)

* Wed Apr 19 2023 Sandro <devel@penguinpee.nl> - 0.9.0-2
- Drop setuptools-scm

* Tue Apr 18 2023 Sandro <devel@penguinpee.nl> - 0.9.0-1
- Update to 0.9.0 (RHBZ#2186992)
- Drop patch
- Use pyproject.toml
- README.rst --> README.md

* Tue Apr 11 2023 Sandro <devel@penguinpee.nl> - 0.8.1-4
- Fix TypeError in Sphinx config (RHBZ#2180474)

* Mon Mar 27 2023 Sandro <devel@penguinpee.nl> - 0.8.1-3
- Use macro

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

* Fri Oct 21 2022 Sandro <devel@penguinpee.nl> - 0.8.1-1
- Initial release (RHBZ#2130026)
## END: Generated by rpmautospec