Blame python-rpmautospec.spec

d997a3d
# The pytest-xdist package is not available when bootstrapping or for EL builds
480f5d5
%bcond xdist %{undefined rhel}
3722993
2e6cdfb
# Package the placeholder rpm-macros (moved to redhat-rpm-config in F40)
2e6cdfb
%if ! (0%{?fedora} >= 40 || 0%{?rhel} >= 10)
2e6cdfb
%bcond rpmmacropkg 1
2e6cdfb
%else
2e6cdfb
%bcond rpmmacropkg 0
2e6cdfb
%endif
1e3af47
264dae5
# Appease old Poetry versions (<1.2.0a2)
264dae5
%if ! 0%{?fedora}%{?rhel} || 0%{?fedora} >= 38 || 0%{?rhel} >= 10
264dae5
%bcond oldpoetry 0
264dae5
%else
264dae5
%bcond oldpoetry 1
264dae5
%endif
264dae5
2e6cdfb
%global srcname rpmautospec
2e6cdfb
d997a3d
Name: python-%{srcname}
945ef75
Version: 0.6.1
2e6cdfb
Release: %autorelease
2e6cdfb
Summary: Package and CLI tool to generate release fields and changelogs
2e6cdfb
License: MIT
d997a3d
URL: https://github.com/fedora-infra/%{srcname}
d997a3d
Source0: https://github.com/fedora-infra/%{srcname}/releases/download/%{version}/%{srcname}-%{version}.tar.gz
2e6cdfb
2e6cdfb
BuildArch: noarch
2e6cdfb
BuildRequires: git
b8a3210
# the langpacks are needed for tests
2e6cdfb
BuildRequires: glibc-langpack-de
2e6cdfb
BuildRequires: glibc-langpack-en
2e6cdfb
BuildRequires: python3-devel >= 3.9.0
2e6cdfb
# The dependencies needed for testing don’t get auto-generated.
2e6cdfb
BuildRequires: python3dist(pytest)
3722993
%if %{with xdist}
2e6cdfb
BuildRequires: python3dist(pytest-xdist)
3722993
%endif
2e6cdfb
BuildRequires: python3dist(pyyaml)
2e6cdfb
BuildRequires: sed
9a30a91
1e3af47
%global _description %{expand:
1e3af47
A package and CLI tool to generate RPM release fields and changelogs.}
1e3af47
1e3af47
%description %_description
1e3af47
d997a3d
%package -n python3-%{srcname}
2e6cdfb
Summary: %{summary}
1e3af47
%{?python_provide:%python_provide python3-%{srcname}}
1e3af47
d997a3d
%description -n python3-%{srcname} %_description
1e3af47
d997a3d
%package -n %{srcname}
1e3af47
Summary:  CLI tool for generating RPM releases and changelogs
d997a3d
Requires: python3-%{srcname} = %{version}-%{release}
1e3af47
d997a3d
%description -n %{srcname}
1e3af47
CLI tool for generating RPM releases and changelogs
1e3af47
2e6cdfb
%if %{with rpmmacropkg}
9eef233
%package -n rpmautospec-rpm-macros
9eef233
Summary: Rpmautospec RPM macros for local rpmbuild
9eef233
Requires: rpm
9eef233
9eef233
%description -n rpmautospec-rpm-macros
2e6cdfb
This package contains RPM macros with placeholders for building rpmautospec
2e6cdfb
enabled packages locally.
7f0832b
%endif
9eef233
2e6cdfb
%generate_buildrequires
2e6cdfb
%pyproject_buildrequires
1e3af47
1e3af47
%prep
9cf1aaf
%autosetup -n %{srcname}-%{version}
264dae5
%if %{with oldpoetry}
9cf1aaf
sed -i \
9cf1aaf
    -e 's/\[tool\.poetry\.group\.dev\.dependencies\]/[tool.poetry.dev-dependencies]/g' \
9cf1aaf
    pyproject.toml
264dae5
%endif
1e3af47
9e5158a
# https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_linters
9ee17e7
sed -i -e '/pytest-cov/d; /addopts.*--cov/d' pyproject.toml
9e5158a
1e3af47
%build
2e6cdfb
%pyproject_wheel
1e3af47
1e3af47
%install
2e6cdfb
%pyproject_install
2e6cdfb
%pyproject_save_files %{srcname}
2e6cdfb
# Work around poetry not listing license files as such in package metadata.
2e6cdfb
sed -i -e 's|^\(.*/LICENSE\)|%%license \1|g' %{pyproject_files}
2e6cdfb
2e6cdfb
%if %{with rpmmacropkg}
9eef233
mkdir -p %{buildroot}%{rpmmacrodir}
9eef233
install -m 644  rpm/macros.d/macros.rpmautospec %{buildroot}%{rpmmacrodir}/
7f0832b
%endif
9eef233
1e3af47
%check
5f50ea2
%pytest -v \
3722993
%if %{with xdist}
3722993
--numprocesses=auto
3722993
%endif
3722993
d997a3d
%files -n python3-%{srcname} -f %{pyproject_files}
2e6cdfb
%doc README.rst
2e6cdfb
d997a3d
%files -n %{srcname}
2e6cdfb
%{_bindir}/rpmautospec
2e6cdfb
2e6cdfb
%if %{with rpmmacropkg}
2e6cdfb
%files -n rpmautospec-rpm-macros
2e6cdfb
%{rpmmacrodir}/macros.rpmautospec
2e6cdfb
%endif
1e3af47
1e3af47
%changelog
d1e6485
%autochangelog