From dd938499fbde7f30c4397d323745ef3cd1009ea0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Fri, 24 Apr 2026 15:22:55 +0200 Subject: [PATCH] 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 30df8fe2179cbe09fb7b06e303fc1c5959358f0d) --- macros.pyproject | 1 + pyproject-rpm-macros.spec | 1 + pyproject_wheel.py | 4 +++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/macros.pyproject b/macros.pyproject index d877475..46b6289 100644 --- a/macros.pyproject +++ b/macros.pyproject @@ -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}/* diff --git a/pyproject-rpm-macros.spec b/pyproject-rpm-macros.spec index 9d23023..6d3550c 100644 --- a/pyproject-rpm-macros.spec +++ b/pyproject-rpm-macros.spec @@ -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 - 1.23.0-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_45_Mass_Rebuild diff --git a/pyproject_wheel.py b/pyproject_wheel.py index 55e35e6..186ba36 100644 --- a/pyproject_wheel.py +++ b/pyproject_wheel.py @@ -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