Fix "Requirement satisfied/not satisfied" messages to show overridden constraints

Previously, the log messages used the original requirement string
(before dependency overrides were applied), which was confusing.

Add a regression test that checks stderr contains the overridden form.

Assisted-By: Claude Opus 4.6
This commit is contained in:
Miro Hrončok 2026-05-13 13:12:45 +02:00
parent 9b2f271530
commit e2a7be92a2
3 changed files with 35 additions and 1 deletions

View File

@ -14,7 +14,7 @@ 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.22.1
Version: 1.22.2
Release: 1%{?dist}
# Macro files
@ -179,6 +179,9 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856
%changelog
* Thu May 14 2026 Miro Hrončok <mhroncok@redhat.com> - 1.22.2-1
- %%pyproject_buildrequires: Fix "Requirement satisfied/not satisfied" messages to show overridden constraints from %%pyproject_patch_dependency
* Thu May 07 2026 Miro Hrončok <mhroncok@redhat.com> - 1.22.1-1
- Fix a regression wrt option parsing for macros with backslash-escaped newlines in argument list

View File

@ -237,6 +237,7 @@ class Requirements:
# Apply dependency overrides before the installed-version check,
# so the check reflects the constraints we will actually output.
requirement = self._apply_dependency_overrides(requirement)
requirement_str = str(requirement)
# We need to always accept pre-releases as satisfying the requirement
# Otherwise e.g. installed cffi version 1.15.0rc2 won't even satisfy the requirement for "cffi"

View File

@ -1925,6 +1925,36 @@ Dependency override drop_lower:
python3dist(foo)
result: 0
Dependency override drop_lower (stderr contains overriden constraint):
installed:
setuptools: 50
wheel: 1
tomli: 1
bar: 1.5
include_runtime: false
dependency_overrides:
- "bar:drop_lower"
pyproject.toml: |
[build-system]
requires = ["setuptools", "wheel", "bar>=1.0,<2.0"]
build-backend = "setuptools.build_meta"
setup.cfg: |
[metadata]
name = test
version = 0.1
expected:
- | # setuptools 70+
python3dist(bar) < 2~~
python3dist(setuptools)
python3dist(wheel)
- | # setuptools < 70
python3dist(bar) < 2~~
python3dist(setuptools)
python3dist(wheel)
python3dist(wheel)
result: 0
stderr_contains: "Requirement satisfied: bar<2.0"
Dependency override drop_constraints:
installed:
setuptools: 50