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

# tests require network to use poetry
%bcond tests 0

%global _description %{expand:
This is a Python 3.7+ plugin for Poetry 1.2.0+ and Poetry Core 1.0.0+ to enable
dynamic versioning based on tags in your version control system, powered by
Dunamai. Many different version control systems are supported, including Git
and Mercurial; please refer to the Dunamai page for the full list (and minimum
supported version where applicable).

poetry-dynamic-versioning provides a build backend that patches Poetry Core to
enable the versioning system in PEP 517 build frontends. When installed with
the plugin feature (i.e., poetry-dynamic-versioning[plugin]), it also
integrates with the Poetry CLI to trigger the versioning in commands like
poetry build.}

Name:           python-poetry-dynamic-versioning
Version:        1.7.0
Release:        %{autorelease}
Summary:        Plugin for Poetry to enable dynamic versioning based on VCS tags

# SPDX
License:        MIT
URL:            https://github.com/mtkennerly/poetry-dynamic-versioning
Source0:        %{url}/archive/v%{version}/%{name}-%{version}.tar.gz

BuildArch:      noarch

%description %_description

%package -n python3-poetry-dynamic-versioning
Summary:        %{summary}
BuildRequires:  python3-devel
BuildRequires:  help2man

%if %{with tests}
BuildRequires:  python3-pytest
BuildRequires:  /usr/bin/git
BuildRequires:  /usr/bin/hg
BuildRequires:  /usr/bin/darcs
BuildRequires:  /usr/bin/svn
BuildRequires:  /usr/bin/bzr
BuildRequires:  /usr/bin/fossil
BuildRequires:  /usr/bin/poetry
# pijul is not in Fedora yet
#BuildRequires:  /usr/bin/pijul
%endif

%description -n python3-poetry-dynamic-versioning %_description

%prep
%autosetup -n poetry-dynamic-versioning-%{version}

%generate_buildrequires
%pyproject_buildrequires

%build
%pyproject_wheel

%install
%pyproject_install
%pyproject_save_files poetry_dynamic_versioning
install -t %{buildroot}%{_mandir}/man1 -D -p -m 0644 \
    docs/poetry-dynamic-versioning.1

%check
%if %{with tests}
# set up git
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
# set up bzr
brz whoami "Your Name <name@example.com>"
# set up darcs
export DARCS_EMAIL="Yep something <name@example.com>"

%{pytest}
%endif

%files -n python3-poetry-dynamic-versioning -f %{pyproject_files}
%license LICENSE
%doc README.md CHANGELOG.md README.plugin.md
%{_bindir}/poetry-dynamic-versioning
%{_mandir}/man1/poetry-dynamic-versioning.1*

%changelog
## START: Generated by rpmautospec
* Thu Jan 16 2025 Packit <hello@packit.dev> - 1.7.0-1
- Update to 1.7.0 upstream release
- Resolves: rhbz#2338401

* Fri Jan 10 2025 Packit <hello@packit.dev> - 1.6.0-1
- Update to 1.6.0 upstream release
- Resolves: rhbz#2336866

* Sun Jan 05 2025 Packit <hello@packit.dev> - 1.5.0-1
- Update to 1.5.0 upstream release
- Resolves: rhbz#2335720

* Fri Sep 13 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 1.4.1-3
- Use the upstream man page (now that one exists)

* Tue Sep 10 2024 Packit <hello@packit.dev> - 1.4.1-1
- Update to 1.4.1 upstream release
- Resolves: rhbz#2311343

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

* Mon Jun 17 2024 Packit <hello@packit.dev> - 1.4.0-1
- Update to 1.4.0 upstream release
- Resolves: rhbz#2292800

* Fri Jun 07 2024 Python Maint <python-maint@redhat.com> - 1.3.0-2
- Rebuilt for Python 3.13

* Tue Apr 30 2024 Packit <hello@packit.dev> - 1.3.0-1
- Update to 1.3.0 upstream release
- Resolves: rhbz#2277922

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

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

* Sat Dec 02 2023 Packit <hello@packit.dev> - 1.2.0-1
- [packit] 1.2.0 upstream release
- Resolves rhbz#2252564

* Fri Oct 27 2023 Packit <hello@packit.dev> - 1.1.1-1
- [packit] 1.1.1 upstream release
- Resolves rhbz#2246486 Upstream tag: v1.1.1 Upstream commit: c9aa7404

* Sun Oct 01 2023 Packit <hello@packit.dev> - 1.1.0-1
- [packit] 1.1.0 upstream release

* Sun Sep 10 2023 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 1.0.1-1
- feat: update to 1.0.1 (fixes rh#2233014)

* Sun Sep 10 2023 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 0.21.5-4
- chore: add packit

* Tue Jul 25 2023 Python Maint <python-maint@redhat.com> - 0.21.5-3
- Rebuilt for Python 3.12

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

* Mon May 15 2023 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 0.21.5-1
- feat: update to 0.25.1 (fixes rhbz#2140496)

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

* Mon Dec 26 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 0.21.3-2
- Add a trivial man page

* Sun Dec 25 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 0.21.3-1
- Update to 0.21.3

* Sun Dec 25 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 0.20.0-4
- Confirm License is SPDX MIT

* Thu Nov 03 2022 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 0.20.0-3
- feat: check in sources (fix rhbz#2139208)

* Thu Nov 03 2022 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 0.20.0-2
- feat: ready for review

* Thu Nov 03 2022 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 0.20.0-1
- wip: requires dunamai
## END: Generated by rpmautospec