Make it build on older EL releases
Signed-off-by: Nils Philippsen <nils@redhat.com>
This commit is contained in:
parent
a53efb98c2
commit
9b1359cb07
@ -1,3 +1,15 @@
|
||||
%if ! 0%{?rhel} || 0%{?rhel} >= 10
|
||||
%bcond_without testcoverage
|
||||
%bcond_with compatbuild
|
||||
%else
|
||||
%bcond_with testcoverage
|
||||
%bcond_without compatbuild
|
||||
%endif
|
||||
|
||||
%if 0%{undefined pyproject_files}
|
||||
%global pyproject_files %{_builddir}/%{name}-%{version}-%{release}.%{_arch}-pyproject-files
|
||||
%endif
|
||||
|
||||
%global srcname rpmautospec_core
|
||||
%global canonicalname %{py_dist_name %{srcname}}
|
||||
|
||||
@ -13,11 +25,17 @@ BuildArch: noarch
|
||||
BuildRequires: python3-devel >= 3.6.0
|
||||
# The dependencies needed for testing don’t get auto-generated.
|
||||
BuildRequires: python3dist(pytest)
|
||||
%if %{with testcoverage}
|
||||
BuildRequires: python3dist(pytest-cov)
|
||||
%endif
|
||||
BuildRequires: sed
|
||||
|
||||
%if %{without compatbuild}
|
||||
%generate_buildrequires
|
||||
%pyproject_buildrequires
|
||||
%else
|
||||
BuildRequires: python3dist(setuptools)
|
||||
%endif
|
||||
|
||||
%global _description %{expand:
|
||||
This package contains minimum functionality to determine if an RPM spec file
|
||||
@ -27,26 +45,56 @@ uses rpmautospec features.}
|
||||
|
||||
%package -n python3-%{canonicalname}
|
||||
Summary: %{summary}
|
||||
%if %{with compatbuild}
|
||||
%py_provides python3-%{canonicalname}
|
||||
%endif
|
||||
|
||||
%description -n python3-%{canonicalname} %_description
|
||||
|
||||
%prep
|
||||
%autosetup -n %{srcname}-%{version}
|
||||
|
||||
%if %{without testcoverage}
|
||||
cat << PYTESTINI > pytest.ini
|
||||
[pytest]
|
||||
addopts =
|
||||
PYTESTINI
|
||||
%endif
|
||||
|
||||
%if %{with compatbuild}
|
||||
cat << SETUPPY > setup.py
|
||||
from setuptools import setup
|
||||
|
||||
setup(name="%{canonicalname}", version="%{version}")
|
||||
SETUPPY
|
||||
%endif
|
||||
|
||||
%build
|
||||
%if %{without compatbuild}
|
||||
%pyproject_wheel
|
||||
%else
|
||||
%py3_build
|
||||
%endif
|
||||
|
||||
%install
|
||||
%if %{without compatbuild}
|
||||
%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
|
||||
echo '%{python3_sitelib}/%{srcname}*' > %{pyproject_files}
|
||||
%endif
|
||||
|
||||
%check
|
||||
%pytest
|
||||
|
||||
%files -n python3-%{canonicalname} -f %{pyproject_files}
|
||||
%doc README.md
|
||||
%if %{with compatbuild}
|
||||
%license LICENSE
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
%autochangelog
|
||||
|
Loading…
Reference in New Issue
Block a user