Set PIP_CONFIG_FILE=/dev/null by default when invoking pip to build+install the wheel

User pip configuration (e.g. require-virtualenv = true in ~/.pip/pip.conf)
can interfere with the wheel build, causing unexpected failures.
Since %pyproject_wheel runs pip in the RPM build environment,
user-level pip settings are never appropriate.

However, if the packager sets PIP_CONFIG_FILE in spec,
it still takes precedence.

Assisted-By: Claude Opus 4.6
(cherry picked from Fedora commit 30df8fe217)
This commit is contained in:
Miro Hrončok 2026-04-24 15:22:55 +02:00
parent ef6908c8da
commit dd938499fb
3 changed files with 5 additions and 1 deletions

View File

@ -111,6 +111,7 @@ if [ -z "$specifier" ]; then
echo 'ERROR: %%%%pyproject_install found no wheel in %%%%{_pyproject_wheeldir} %{_pyproject_wheeldir}' >&2
exit 1
fi
PIP_CONFIG_FILE="${PIP_CONFIG_FILE:-/dev/null}" \
TMPDIR="%{_pyproject_builddir}" %{__python3} -m pip install --root %{buildroot} --prefix %{_prefix} --no-deps --disable-pip-version-check --progress-bar off --verbose --ignore-installed --no-warn-script-location --no-index --no-cache-dir --find-links %{_pyproject_wheeldir} $specifier
if [ -d %{buildroot}%{_bindir} ]; then
%py3_shebang_fix %{buildroot}%{_bindir}/*

View File

@ -207,6 +207,7 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856
- getopt: Fix global macro clobbering with save/restore stack
- %%pyproject_extras_subpkg: Add long options support
- %%pyproject_extras_subpkg: Make -D/--dist-name mutually exclusive with -i/-f/-F
- Set PIP_CONFIG_FILE=/dev/null by default when invoking pip to build the wheel
* Thu Jul 16 2026 Fedora Release Engineering <releng@fedoraproject.org> - 1.23.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_45_Mass_Rebuild

View File

@ -1,4 +1,5 @@
import argparse
import os
import sys
import subprocess
@ -56,7 +57,8 @@ def build_wheel(*, wheeldir, stdout=None, config_settings=None):
*get_config_settings_args(config_settings),
'.',
)
cp = subprocess.run(command, stdout=stdout)
env = {'PIP_CONFIG_FILE': '/dev/null', **os.environ}
cp = subprocess.run(command, env=env, stdout=stdout)
return cp.returncode