Add pyproject-srpm-macros with a minimal %pyproject_buildrequires macro
pyproject-srpm-macros is intended to be installed in the default buildroot. That way, no explicit BuildRequires for pyproject-rpm-macros are required, as long as %pyproject_buildrequires is used in %generate_buildrequires. When only pyproject-srpm-macros is installed, the minimal implementation of %pyproject_buildrequires generates a dependency on pyproject-rpm-macros. When pyproject-rpm-macros is installed, it overrides the implementation of %pyproject_buildrequires with the full one. Note that in Fedora, pyproject-rpm-macros is required by python3-devel, but not in RHEL. This allows us to keep pyproject-rpm-macros in the RHEL CRB repository.
This commit is contained in:
parent
05aaf0674a
commit
a4d05ba2c2
7
macros.aaa-pyproject-srpm
Normal file
7
macros.aaa-pyproject-srpm
Normal file
@ -0,0 +1,7 @@
|
||||
# This file is called macros.aaa-pyproject-srpm
|
||||
# to sort alphabetically before macros.pyproject.
|
||||
# When this file is installed but macros.pyproject is not
|
||||
# this macro will cause the package with the real macro to be installed.
|
||||
# When macros.pyproject is installed, it overrides this macro.
|
||||
# Note: This needs to maintain the same set of options as the real macro.
|
||||
%pyproject_buildrequires(rRxtNwe:) echo 'pyproject-rpm-macros' && exit 0
|
@ -124,6 +124,7 @@ fi
|
||||
%toxenv %{default_toxenv}
|
||||
|
||||
|
||||
# Note: Keep the options in sync with this macro from macros.aaa-pyproject-srpm
|
||||
%pyproject_buildrequires(rRxtNwe:) %{expand:\\\
|
||||
%_set_pytest_addopts
|
||||
# The _auto_set_build_flags feature does not do this in %%generate_buildrequires section,
|
||||
@ -144,7 +145,7 @@ fi
|
||||
%{-w:%{error:The -N and -w options are mutually exclusive}}
|
||||
}
|
||||
%{-e:%{expand:%global toxenv %(%{__python3} -s %{_rpmconfigdir}/redhat/pyproject_construct_toxenv.py %{?**})}}
|
||||
echo 'pyproject-rpm-macros' # we already have this installed, but this way, it's repoqueryable
|
||||
echo 'pyproject-rpm-macros' # first stdout line matches the implementation in macros.aaa-pyproject-srpm
|
||||
echo 'python%{python3_pkgversion}-devel'
|
||||
echo 'python%{python3_pkgversion}dist(pip) >= 19'
|
||||
echo 'python%{python3_pkgversion}dist(packaging)'
|
||||
|
@ -10,11 +10,12 @@ License: MIT
|
||||
# Increment Y and reset Z when new macros or features are added
|
||||
# Increment Z when this is a bugfix or a cosmetic change
|
||||
# Dropping support for EOL Fedoras is *not* considered a breaking change
|
||||
Version: 1.5.1
|
||||
Release: 2%{?dist}
|
||||
Version: 1.6.0
|
||||
Release: 1%{?dist}
|
||||
|
||||
# Macro files
|
||||
Source001: macros.pyproject
|
||||
Source002: macros.aaa-pyproject-srpm
|
||||
|
||||
# Implementation files
|
||||
Source101: pyproject_buildrequires.py
|
||||
@ -62,6 +63,7 @@ BuildRequires: python3-rpm-macros
|
||||
Requires: python-rpm-macros
|
||||
Requires: python-srpm-macros
|
||||
Requires: python3-rpm-macros
|
||||
Requires: (pyproject-srpm-macros = %{?epoch:%{epoch}:}%{version}-%{release} if pyproject-srpm-macros)
|
||||
|
||||
# We use the following tools outside of coreutils
|
||||
Requires: /usr/bin/find
|
||||
@ -82,6 +84,17 @@ These macros replace %%py3_build and %%py3_install,
|
||||
which only work with setup.py.
|
||||
|
||||
|
||||
%package -n pyproject-srpm-macros
|
||||
Summary: Minimal implementation of %%pyproject_buildrequires
|
||||
Requires: (pyproject-rpm-macros = %{?epoch:%{epoch}:}%{version}-%{release} if pyproject-rpm-macros)
|
||||
|
||||
%description -n pyproject-srpm-macros
|
||||
This package contains a minimal implementation of %%pyproject_buildrequires.
|
||||
When used in %%generate_buildrequires, it will generate BuildRequires
|
||||
for pyproject-rpm-macros. When both packages are installed, the full version
|
||||
takes precedence.
|
||||
|
||||
|
||||
%prep
|
||||
# Not strictly necessary but allows working on file names instead
|
||||
# of source numbers in install section
|
||||
@ -95,6 +108,7 @@ cp -p %{sources} .
|
||||
mkdir -p %{buildroot}%{_rpmmacrodir}
|
||||
mkdir -p %{buildroot}%{_rpmconfigdir}/redhat
|
||||
install -pm 644 macros.pyproject %{buildroot}%{_rpmmacrodir}/
|
||||
install -pm 644 macros.aaa-pyproject-srpm %{buildroot}%{_rpmmacrodir}/
|
||||
install -pm 644 pyproject_buildrequires.py %{buildroot}%{_rpmconfigdir}/redhat/
|
||||
install -pm 644 pyproject_convert.py %{buildroot}%{_rpmconfigdir}/redhat/
|
||||
install -pm 644 pyproject_save_files.py %{buildroot}%{_rpmconfigdir}/redhat/
|
||||
@ -126,7 +140,15 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856
|
||||
%doc README.md
|
||||
%license LICENSE
|
||||
|
||||
%files -n pyproject-srpm-macros
|
||||
%{_rpmmacrodir}/macros.aaa-pyproject-srpm
|
||||
%license LICENSE
|
||||
|
||||
|
||||
%changelog
|
||||
* Fri Jan 20 2023 Miro Hrončok <miro@hroncok.cz> - 1.6.0-1
|
||||
- Add pyproject-srpm-macros with a minimal %%pyproject_buildrequires macro
|
||||
|
||||
* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.1-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
|
||||
|
||||
|
@ -8,12 +8,13 @@ URL: https://entrypoints.readthedocs.io/
|
||||
Source0: %{pypi_source}
|
||||
|
||||
BuildArch: noarch
|
||||
BuildRequires: pyproject-rpm-macros
|
||||
BuildRequires: python3-devel
|
||||
|
||||
%description
|
||||
This package contains one .py module
|
||||
Building this tests the flit build backend.
|
||||
This package also has no explicit BuildRequires for python or the macros,
|
||||
testing the minimal implementation of %%pyproject_buildrequires
|
||||
from pyproject-srpm-macros.
|
||||
|
||||
|
||||
%package -n python3-%{pypi_name}
|
||||
|
Loading…
Reference in New Issue
Block a user