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

# Let’s try to build this as early as we can, since it’s a dependency for
# some important libraries, such as python-platformdirs.
%bcond_with bootstrap
%bcond_with tests

Name:           python-hatch-vcs
Version:        0.4.0
Release:        %autorelease
Summary:        Hatch plugin for versioning with your preferred VCS

# SPDX
License:        MIT
URL:            https://github.com/ofek/hatch-vcs
Source:         %{pypi_source hatch_vcs}

BuildArch:      noarch

BuildRequires:  python%{python3_pkgversion}-devel
%if 0%{?rhel} < 9
BuildRequires:  python%{python3_pkgversion}-hatchling
BuildRequires:  python%{python3_pkgversion}-packaging
BuildRequires:  python%{python3_pkgversion}-pip
%endif

%if %{with tests}
BuildRequires:  python%{python3_pkgversion}dist(pytest)
BuildRequires:  git-core
%endif

%global common_description %{expand:
This provides a plugin for Hatch that uses your preferred version control
system (like Git) to determine project versions.}

%description %{common_description}


%package -n python%{python3_pkgversion}-hatch-vcs
Summary:        %{summary}

%description -n python%{python3_pkgversion}-hatch-vcs %{common_description}


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

%if 0%{?rhel} > 8
%generate_buildrequires
%pyproject_buildrequires
%endif

%build
%pyproject_wheel


%install
%pyproject_install
%pyproject_save_files hatch_vcs


%check
%if %{with tests}
%pytest
%else
%pyproject_check_import
%endif


%files -n python%{python3_pkgversion}-hatch-vcs -f %{pyproject_files}
%doc HISTORY.md
%doc README.md


%changelog
* Mon Nov 06 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 0.4.0-1
- Update to 0.4.0 (close RHBZ#2248106)

* Mon Nov 06 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 0.3.0-5
- Use new (rpm 4.17.1+) bcond style

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

* Tue Dec 20 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 0.3.0-2
- Work with setuptools_scm 7.1

* Sat Dec 10 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 0.3.0-1
- Update to 0.3.0 (close RHBZ#2152320)
- We can now rely on pyproject-rpm-macros >= 1.2.0
- The LICENSE.txt file is now handled in pyproject_files
- The setuptools_scm 7 patch is now merged upstream

* Sat Oct 22 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 0.2.0-10
- Confirm License is SPDX MIT

* Sun Sep 11 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 0.2.0-9
- Use hatchling’s new “prepare_metadata_…” hook support for BR’s

* Thu Jul 21 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 0.2.0-8
- Updated setuptools_scm 7 patch again

* Thu Jul 07 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 0.2.0-7
- Fix extra newline in description

* Thu Jun 30 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 0.2.0-6
- Updated setuptools_scm 7 patch

* Thu Jun 30 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 0.2.0-5
- Fix test compatibility with setuptools_scm 7

* Mon Jun 13 2022 Python Maint <python-maint@redhat.com> - 0.2.0-4
- Rebuilt for Python 3.11

* Fri May 06 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 0.2.0-3
- Use wheel-building support to generate BR’s

* Sun May 01 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 0.2.0-2
- Adjust for pyproject-rpm-macros >= 1.1.0

* Fri Apr 22 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 0.2.0-1
- Initial package (close RHBZ#2077832)
