From b69a39d380fc17ff3c8a068f8933fb3298cebbfe Mon Sep 17 00:00:00 2001 From: Nils Philippsen Date: Mon, 10 Jun 2024 14:19:56 +0200 Subject: [PATCH] Update to 0.6.4 - Install man page Additionally, enable building without poetry and add fill-in for %bcond macro for platforms where poetry is missing. Signed-off-by: Nils Philippsen --- python-rpmautospec.spec | 64 ++++++++++++++++++++++++++++++++++++++--- sources | 2 +- 2 files changed, 61 insertions(+), 5 deletions(-) diff --git a/python-rpmautospec.spec b/python-rpmautospec.spec index e6e6e23..02d5e1f 100644 --- a/python-rpmautospec.spec +++ b/python-rpmautospec.spec @@ -1,3 +1,10 @@ +%if 0%{!?bcond:1} +%define bcond() %[ (%2)\ + ? "%{expand:%%{!?_without_%{1}:%%global with_%{1} 1}}"\ + : "%{expand:%%{?_with_%{1}:%%global with_%{1} 1}}"\ +] +%endif + # The pytest-xdist package is not available when bootstrapping or for EL builds %bcond xdist %{undefined rhel} @@ -8,24 +15,40 @@ %bcond rpmmacropkg 0 %endif +%if ! 0%{?fedora}%{?rhel} || 0%{?fedora} || 0%{?epel} >= 9 +%bcond poetry 1 # Appease old Poetry versions (<1.2.0a2) %if ! 0%{?fedora}%{?rhel} || 0%{?fedora} >= 38 || 0%{?rhel} >= 10 -%bcond oldpoetry 0 +%bcond old_poetry 0 +%else +%bcond old_poetry 1 +%endif +%else +%bcond poetry 0 +%endif + +%if ! 0%{?fedora}%{?rhel} || 0%{?fedora} || 0%{?epel} >= 9 || 0%{?rhel} >= 10 +%bcond manpage_manual_title 1 %else -%bcond oldpoetry 1 +%bcond manpage_manual_title 0 %endif %global srcname rpmautospec Name: python-%{srcname} -Version: 0.6.3 +Version: 0.6.4 Release: %autorelease Summary: Package and CLI tool to generate release fields and changelogs License: MIT URL: https://github.com/fedora-infra/%{srcname} Source0: https://github.com/fedora-infra/%{srcname}/releases/download/%{version}/%{srcname}-%{version}.tar.gz +%if 0%{!?pyproject_files:1} +%global pyproject_files %{_builddir}/%{name}-%{version}-%{release}.%{_arch}-pyproject-files +%endif + BuildArch: noarch +BuildRequires: argparse-manpage BuildRequires: git # the langpacks are needed for tests BuildRequires: glibc-langpack-de @@ -39,6 +62,15 @@ BuildRequires: python3dist(pytest-xdist) BuildRequires: python3dist(pyyaml) BuildRequires: sed +%if %{without poetry} +BuildRequires: python3dist(babel) +BuildRequires: python3dist(pygit2) +BuildRequires: python3dist(rpm) +BuildRequires: python3dist(rpmautospec-core) +BuildRequires: python3dist(setuptools) +%{?python_provide:%python_provide python3-%{srcname}} +%endif + %global _description %{expand: A package and CLI tool to generate RPM release fields and changelogs.} @@ -68,11 +100,13 @@ enabled packages locally. %endif %generate_buildrequires +%if %{with poetry} %pyproject_buildrequires +%endif %prep %autosetup -n %{srcname}-%{version} -%if %{with oldpoetry} +%if %{with old_poetry} sed -i \ -e 's/\[tool\.poetry\.group\.dev\.dependencies\]/[tool.poetry.dev-dependencies]/g' \ pyproject.toml @@ -82,13 +116,34 @@ sed -i \ sed -i -e '/pytest-cov/d; /addopts.*--cov/d' pyproject.toml %build +%if %{with poetry} %pyproject_wheel +%else +%py3_build +%endif %install +%if %{with poetry} %pyproject_install %pyproject_save_files %{srcname} # Work around poetry not listing license files as such in package metadata. sed -i -e 's|^\(.*/LICENSE\)|%%license \1|g' %{pyproject_files} +%else +%py3_install +cat << EOF > %{pyproject_files} +%{python3_sitelib}/%{srcname}/ +%{python3_sitelib}/*.egg-info/ +EOF +%endif + +install -d %{buildroot}%{_mandir}/man1 +PYTHONPATH=%{buildroot}%{python3_sitelib} argparse-manpage \ +%if %{with manpage_manual_title} + --manual-title "User Commands" \ +%endif + --project-name rpmautospec \ + --module rpmautospec.cli \ + --function get_arg_parser > %{buildroot}%{_mandir}/man1/rpmautospec.1 %if %{with rpmmacropkg} mkdir -p %{buildroot}%{rpmmacrodir} @@ -106,6 +161,7 @@ install -m 644 rpm/macros.d/macros.rpmautospec %{buildroot}%{rpmmacrodir}/ %files -n %{srcname} %{_bindir}/rpmautospec +%{_mandir}/man1/rpmautospec.1* %if %{with rpmmacropkg} %files -n rpmautospec-rpm-macros diff --git a/sources b/sources index 9af04fc..ca51e9f 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (rpmautospec-0.6.3.tar.gz) = 25eff321290f01e3d70c5889a6a020ba798e5f07816348e52dbf47a8d5b96eccd0a08cf3505d97afcd43e418e58e2a318fb7ad38f978e45e400a998a2292306d +SHA512 (rpmautospec-0.6.4.tar.gz) = cbb858fb00aeed2a8e6fff51a245bdbf86d29ccc336757b417a41d4a031a89103ed1bb4e6138dd6a41629d6a12ab1f678d1850d3699f6d11857a093c63deb116