Use constraints in trace rather than irrelevant requires-python (#9529)

This commit is contained in:
Charlie Marsh 2024-11-29 14:25:43 -05:00 committed by GitHub
parent 58cf93a219
commit 950855877a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 19 additions and 6 deletions

View File

@ -1753,6 +1753,15 @@ impl<InstalledPackages: InstalledPackagesProvider> ResolverState<InstalledPackag
let mut marker = constraint.marker.clone();
marker.and(requirement.marker.clone());
if marker.is_false() {
trace!(
"skipping {constraint} because of disjoint markers: `{}` vs. `{}`",
constraint.marker.try_to_string().unwrap(),
requirement.marker.try_to_string().unwrap(),
);
return None;
}
Cow::Owned(Requirement {
name: constraint.name.clone(),
extras: constraint.extras.clone(),
@ -1768,17 +1777,21 @@ impl<InstalledPackages: InstalledPackagesProvider> ResolverState<InstalledPackag
let mut marker = constraint.marker.clone();
marker.and(requirement.marker.clone());
if marker.is_false() {
trace!(
"skipping {constraint} because of disjoint markers: `{}` vs. `{}`",
constraint.marker.try_to_string().unwrap(),
requirement.marker.try_to_string().unwrap(),
);
return None;
}
// Additionally, if the requirement is `requests ; sys_platform == 'darwin'`
// and the constraint is `requests ; python_version == '3.6'`, the
// constraint should only apply when _both_ markers are true.
if marker.is_false() {
trace!("skipping {constraint} because of Requires-Python: {requires_python}");
return None;
}
if python_marker.is_disjoint(&marker) {
trace!(
"skipping constraint {requirement} because of Requires-Python: {requires_python}",
requires_python = python_requirement.target(),
"skipping constraint {requirement} because of Requires-Python: {requires_python}"
);
return None;
}