2023-12-03 04:07:05 +00:00
|
|
|
|
%bcond_with testcoverage
|
2023-11-17 16:12:58 +00:00
|
|
|
|
%if ! 0%{?rhel} || 0%{?rhel} >= 10
|
2023-11-17 16:58:32 +00:00
|
|
|
|
%bcond_without pyproject_build
|
|
|
|
|
%bcond_without genbrs
|
2023-11-17 16:12:58 +00:00
|
|
|
|
%else
|
2023-11-17 16:58:32 +00:00
|
|
|
|
%bcond_with pyproject_build
|
|
|
|
|
%bcond_with genbrs
|
2023-11-17 16:12:58 +00:00
|
|
|
|
%endif
|
|
|
|
|
|
|
|
|
|
%if 0%{undefined pyproject_files}
|
|
|
|
|
%global pyproject_files %{_builddir}/%{name}-%{version}-%{release}.%{_arch}-pyproject-files
|
|
|
|
|
%endif
|
|
|
|
|
|
2023-11-13 12:25:26 +00:00
|
|
|
|
%global srcname rpmautospec_core
|
2024-02-12 12:09:06 +00:00
|
|
|
|
%global canonicalname rpmautospec-core
|
2023-11-13 12:25:26 +00:00
|
|
|
|
|
|
|
|
|
Name: python-%{canonicalname}
|
2024-01-09 11:49:08 +00:00
|
|
|
|
Version: 0.1.4
|
2023-11-13 12:25:26 +00:00
|
|
|
|
Release: %autorelease
|
|
|
|
|
Summary: Minimum functionality for rpmautospec
|
|
|
|
|
|
|
|
|
|
License: MIT
|
|
|
|
|
URL: https://github.com/fedora-infra/%{canonicalname}
|
|
|
|
|
Source0: %{pypi_source %{srcname}}
|
|
|
|
|
BuildArch: noarch
|
|
|
|
|
BuildRequires: python3-devel >= 3.6.0
|
2023-11-15 11:36:32 +00:00
|
|
|
|
# The dependencies needed for testing don’t get auto-generated.
|
|
|
|
|
BuildRequires: python3dist(pytest)
|
2023-11-17 16:12:58 +00:00
|
|
|
|
%if %{with testcoverage}
|
2023-11-15 11:36:32 +00:00
|
|
|
|
BuildRequires: python3dist(pytest-cov)
|
2023-11-17 16:12:58 +00:00
|
|
|
|
%endif
|
2023-11-13 12:25:26 +00:00
|
|
|
|
BuildRequires: sed
|
|
|
|
|
|
2023-11-17 16:58:32 +00:00
|
|
|
|
%if %{with genbrs}
|
2023-11-13 12:25:26 +00:00
|
|
|
|
%generate_buildrequires
|
2023-11-17 16:35:44 +00:00
|
|
|
|
%{pyproject_buildrequires}
|
|
|
|
|
%else
|
2023-11-17 16:58:32 +00:00
|
|
|
|
BuildRequires: python3dist(pip)
|
2023-11-17 16:12:58 +00:00
|
|
|
|
BuildRequires: python3dist(setuptools)
|
|
|
|
|
%endif
|
2023-11-13 12:25:26 +00:00
|
|
|
|
|
|
|
|
|
%global _description %{expand:
|
|
|
|
|
This package contains minimum functionality to determine if an RPM spec file
|
|
|
|
|
uses rpmautospec features.}
|
|
|
|
|
|
|
|
|
|
%description %_description
|
|
|
|
|
|
|
|
|
|
%package -n python3-%{canonicalname}
|
|
|
|
|
Summary: %{summary}
|
2023-11-17 16:58:32 +00:00
|
|
|
|
%if %{without pyproject_build}
|
2023-11-17 16:12:58 +00:00
|
|
|
|
%py_provides python3-%{canonicalname}
|
|
|
|
|
%endif
|
2023-11-13 12:25:26 +00:00
|
|
|
|
|
|
|
|
|
%description -n python3-%{canonicalname} %_description
|
|
|
|
|
|
|
|
|
|
%prep
|
|
|
|
|
%autosetup -n %{srcname}-%{version}
|
|
|
|
|
|
2023-11-17 16:12:58 +00:00
|
|
|
|
%if %{without testcoverage}
|
|
|
|
|
cat << PYTESTINI > pytest.ini
|
|
|
|
|
[pytest]
|
|
|
|
|
addopts =
|
|
|
|
|
PYTESTINI
|
|
|
|
|
%endif
|
|
|
|
|
|
2023-11-17 16:58:32 +00:00
|
|
|
|
%if %{without pyproject_build}
|
2023-11-17 16:12:58 +00:00
|
|
|
|
cat << SETUPPY > setup.py
|
|
|
|
|
from setuptools import setup
|
|
|
|
|
|
2023-11-21 13:10:54 +00:00
|
|
|
|
setup(name="%{canonicalname}", version="%{version}", packages=["%{srcname}"])
|
2023-11-17 16:12:58 +00:00
|
|
|
|
SETUPPY
|
|
|
|
|
%endif
|
|
|
|
|
|
2023-11-13 12:25:26 +00:00
|
|
|
|
%build
|
2023-11-17 16:58:32 +00:00
|
|
|
|
%if %{with pyproject_build}
|
2023-11-13 12:25:26 +00:00
|
|
|
|
%pyproject_wheel
|
2023-11-17 16:12:58 +00:00
|
|
|
|
%else
|
|
|
|
|
%py3_build
|
|
|
|
|
%endif
|
2023-11-13 12:25:26 +00:00
|
|
|
|
|
|
|
|
|
%install
|
2023-11-17 16:58:32 +00:00
|
|
|
|
%if %{with pyproject_build}
|
2023-11-13 12:25:26 +00:00
|
|
|
|
%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}
|
2023-11-17 16:12:58 +00:00
|
|
|
|
%else
|
|
|
|
|
%py3_install
|
|
|
|
|
echo '%{python3_sitelib}/%{srcname}*' > %{pyproject_files}
|
|
|
|
|
%endif
|
2023-11-13 12:25:26 +00:00
|
|
|
|
|
|
|
|
|
%check
|
2023-11-15 11:36:32 +00:00
|
|
|
|
%pytest
|
2023-11-13 12:25:26 +00:00
|
|
|
|
|
|
|
|
|
%files -n python3-%{canonicalname} -f %{pyproject_files}
|
|
|
|
|
%doc README.md
|
2023-11-17 16:58:32 +00:00
|
|
|
|
%if %{without pyproject_build}
|
2023-11-17 16:12:58 +00:00
|
|
|
|
%license LICENSE
|
|
|
|
|
%endif
|
2023-11-13 12:25:26 +00:00
|
|
|
|
|
|
|
|
|
%changelog
|
|
|
|
|
%autochangelog
|