2023-12-03 04:07:05 +00:00
|
|
|
|
%bcond_with testcoverage
|
2024-06-27 13:12:43 +00:00
|
|
|
|
|
|
|
|
|
# Only generate buildrequires or use PEP 518 style building on Fedora and new EPEL releases because
|
|
|
|
|
# Poetry is missing elsewhere. Fall back to using setuptools instead.
|
|
|
|
|
%if ! 0%{?rhel} || 0%{?epel} >= 10
|
2023-11-17 16:58:32 +00:00
|
|
|
|
%bcond_without genbrs
|
2024-06-27 13:12:43 +00:00
|
|
|
|
%bcond_without pyproject_build
|
2023-11-17 16:12:58 +00:00
|
|
|
|
%else
|
2023-11-17 16:58:32 +00:00
|
|
|
|
%bcond_with genbrs
|
2024-06-27 13:12:43 +00:00
|
|
|
|
%bcond_with pyproject_build
|
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-06-27 13:12:43 +00:00
|
|
|
|
Version: 0.1.5
|
2024-08-21 14:58:58 +00:00
|
|
|
|
Release: 0%{?dist}
|
2023-11-13 12:25:26 +00:00
|
|
|
|
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-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
|
2024-08-21 14:57:37 +00:00
|
|
|
|
%{?autochangelog}
|