diff --git a/macros.aaa-pyproject-srpm b/macros.aaa-pyproject-srpm new file mode 100644 index 0000000..9dab590 --- /dev/null +++ b/macros.aaa-pyproject-srpm @@ -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 diff --git a/macros.pyproject b/macros.pyproject index a0cdb72..8cc59ae 100644 --- a/macros.pyproject +++ b/macros.pyproject @@ -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)' diff --git a/pyproject-rpm-macros.spec b/pyproject-rpm-macros.spec index 795e199..16bd9d9 100644 --- a/pyproject-rpm-macros.spec +++ b/pyproject-rpm-macros.spec @@ -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 - 1.6.0-1 +- Add pyproject-srpm-macros with a minimal %%pyproject_buildrequires macro + * Fri Jan 20 2023 Fedora Release Engineering - 1.5.1-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild diff --git a/tests/python-entrypoints.spec b/tests/python-entrypoints.spec index 2591ed0..95e7791 100644 --- a/tests/python-entrypoints.spec +++ b/tests/python-entrypoints.spec @@ -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}