From 309172f9a83cf6b9bcadfa4a4665b54d0a381b15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Fri, 23 Jul 2021 08:01:13 +0000 Subject: [PATCH] Rename %_pyproject_ghost_distinfo and %_pyproject_record to indicate they are private Related: rhbz#1950291 --- macros.pyproject | 18 +++++++++--------- pyproject-rpm-macros.spec | 1 + tests/python-setuptools_scm.spec | 6 +++--- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/macros.pyproject b/macros.pyproject index 13d3125..6cb35f3 100644 --- a/macros.pyproject +++ b/macros.pyproject @@ -11,8 +11,8 @@ %_pyproject_builddir %{_builddir}%{?buildsubdir:/%{buildsubdir}}/.pyproject-builddir %pyproject_files %{_builddir}/pyproject-files -%pyproject_ghost_distinfo %{_builddir}/pyproject-ghost-distinfo -%pyproject_record %{_builddir}/pyproject-record +%_pyproject_ghost_distinfo %{_builddir}/pyproject-ghost-distinfo +%_pyproject_record %{_builddir}/pyproject-record # Avoid leaking %%{_pyproject_builddir} to pytest collection # https://bugzilla.redhat.com/show_bug.cgi?id=1935212 @@ -34,7 +34,7 @@ if [ -d %{buildroot}%{_bindir} ]; then %py3_shebang_fix %{buildroot}%{_bindir}/* rm -rfv %{buildroot}%{_bindir}/__pycache__ fi -rm -f %{pyproject_ghost_distinfo} +rm -f %{_pyproject_ghost_distinfo} site_dirs=() # Process %%{python3_sitelib} if exists if [ -d %{buildroot}%{python3_sitelib} ]; then @@ -47,25 +47,25 @@ fi # Process all *.dist-info dirs in sitelib/sitearch for site_dir in ${site_dirs[@]}; do for distinfo in %{buildroot}$site_dir/*.dist-info; do - echo "%ghost ${distinfo#%{buildroot}}" >> %{pyproject_ghost_distinfo} + echo "%ghost ${distinfo#%{buildroot}}" >> %{_pyproject_ghost_distinfo} sed -i 's/pip/rpm/' ${distinfo}/INSTALLER PYTHONPATH=%{_rpmconfigdir}/redhat \\ %{__python3} -B %{_rpmconfigdir}/redhat/pyproject_preprocess_record.py \\ - --buildroot %{buildroot} --record ${distinfo}/RECORD --output %{pyproject_record} + --buildroot %{buildroot} --record ${distinfo}/RECORD --output %{_pyproject_record} rm -fv ${distinfo}/RECORD rm -fv ${distinfo}/REQUESTED done done -lines=$(wc -l %{pyproject_ghost_distinfo} | cut -f1 -d" ") +lines=$(wc -l %{_pyproject_ghost_distinfo} | cut -f1 -d" ") if [ $lines -ne 1 ]; then echo -e "\\n\\nWARNING: %%%%pyproject_extras_subpkg won't work without explicit -i or -F, found $lines dist-info directories.\\n\\n" >&2 - rm %{pyproject_ghost_distinfo} # any attempt to use this will fail + rm %{_pyproject_ghost_distinfo} # any attempt to use this will fail fi } # Note: the three times nested questionmarked -i -f -F pattern means: If none of those options was used -- in that case, we inject our own -f -%pyproject_extras_subpkg(n:i:f:F) %{expand:%{?python_extras_subpkg:%{python_extras_subpkg%{?!-i:%{?!-f:%{?!-F: -f %{pyproject_ghost_distinfo}}}} %**}}} +%pyproject_extras_subpkg(n:i:f:F) %{expand:%{?python_extras_subpkg:%{python_extras_subpkg%{?!-i:%{?!-f:%{?!-F: -f %{_pyproject_ghost_distinfo}}}} %**}}} %pyproject_save_files() %{expand:\\\ @@ -75,7 +75,7 @@ fi --sitelib "%{python3_sitelib}" \\ --sitearch "%{python3_sitearch}" \\ --python-version "%{python3_version}" \\ - --pyproject-record "%{pyproject_record}" \\ + --pyproject-record "%{_pyproject_record}" \\ %{*} } diff --git a/pyproject-rpm-macros.spec b/pyproject-rpm-macros.spec index d167b06..15c1581 100644 --- a/pyproject-rpm-macros.spec +++ b/pyproject-rpm-macros.spec @@ -121,6 +121,7 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856 %changelog * Fri Jul 23 2021 Miro HronĨok - 0-46 - %%pyproject_buildrequires now fails when it encounters an invalid requirement +- Rename %%_pyproject_ghost_distinfo and %%_pyproject_record to indicate they are private * Fri Jul 23 2021 Fedora Release Engineering - 0-45 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild diff --git a/tests/python-setuptools_scm.spec b/tests/python-setuptools_scm.spec index 1602a49..29771b0 100644 --- a/tests/python-setuptools_scm.spec +++ b/tests/python-setuptools_scm.spec @@ -59,9 +59,9 @@ grep -F 'py%{python3_version_nodots}-test: commands succeeded' toxlog grep -F 'flake8: commands succeeded' toxlog # Internal check for our macros -# making sure that %%{pyproject_ghost_distinfo} has the right content -test -f %{pyproject_ghost_distinfo} -test "$(cat %{pyproject_ghost_distinfo})" == "%ghost %{python3_sitelib}/setuptools_scm-%{version}.dist-info" +# making sure that %%{_pyproject_ghost_distinfo} has the right content +test -f %{_pyproject_ghost_distinfo} +test "$(cat %{_pyproject_ghost_distinfo})" == "%ghost %{python3_sitelib}/setuptools_scm-%{version}.dist-info" %files -n python3-setuptools_scm -f %{pyproject_files}