Add some misc. touch-ups in resolver (#9954)
Some checks are pending
CI / cargo shear (push) Waiting to run
CI / check system | pyston (push) Blocked by required conditions
CI / cargo dev generate-all (push) Blocked by required conditions
CI / Determine changes (push) Waiting to run
CI / lint (push) Waiting to run
CI / cargo clippy | ubuntu (push) Blocked by required conditions
CI / cargo clippy | windows (push) Blocked by required conditions
CI / cargo test | ubuntu (push) Blocked by required conditions
CI / cargo test | macos (push) Blocked by required conditions
CI / cargo test | windows (push) Blocked by required conditions
CI / check windows trampoline | aarch64 (push) Blocked by required conditions
CI / check windows trampoline | i686 (push) Blocked by required conditions
CI / check windows trampoline | x86_64 (push) Blocked by required conditions
CI / test windows trampoline | i686 (push) Blocked by required conditions
CI / test windows trampoline | x86_64 (push) Blocked by required conditions
CI / typos (push) Waiting to run
CI / mkdocs (push) Waiting to run
CI / build binary | linux (push) Blocked by required conditions
CI / build binary | macos aarch64 (push) Blocked by required conditions
CI / build binary | macos x86_64 (push) Blocked by required conditions
CI / build binary | windows (push) Blocked by required conditions
CI / cargo build (msrv) (push) Blocked by required conditions
CI / build binary | freebsd (push) Blocked by required conditions
CI / ecosystem test | prefecthq/prefect (push) Blocked by required conditions
CI / ecosystem test | pallets/flask (push) Blocked by required conditions
CI / integration test | conda on ubuntu (push) Blocked by required conditions
CI / integration test | free-threaded on linux (push) Blocked by required conditions
CI / check system | python on fedora (push) Blocked by required conditions
CI / integration test | free-threaded on windows (push) Blocked by required conditions
CI / integration test | pypy on ubuntu (push) Blocked by required conditions
CI / integration test | pypy on windows (push) Blocked by required conditions
CI / integration test | graalpy on ubuntu (push) Blocked by required conditions
CI / integration test | graalpy on windows (push) Blocked by required conditions
CI / integration test | github actions (push) Blocked by required conditions
CI / integration test | determine publish changes (push) Blocked by required conditions
CI / integration test | uv publish (push) Blocked by required conditions
CI / check cache | ubuntu (push) Blocked by required conditions
CI / check cache | macos aarch64 (push) Blocked by required conditions
CI / check system | python on debian (push) Blocked by required conditions
CI / check system | python on ubuntu (push) Blocked by required conditions
CI / check system | python on opensuse (push) Blocked by required conditions
CI / check system | python on rocky linux 8 (push) Blocked by required conditions
CI / check system | python on rocky linux 9 (push) Blocked by required conditions
CI / check system | pypy on ubuntu (push) Blocked by required conditions
CI / check system | alpine (push) Blocked by required conditions
CI / check system | python on macos aarch64 (push) Blocked by required conditions
CI / check system | homebrew python on macos aarch64 (push) Blocked by required conditions
CI / check system | python on macos x86_64 (push) Blocked by required conditions
CI / check system | python3.10 on windows (push) Blocked by required conditions
CI / check system | python3.10 on windows x86 (push) Blocked by required conditions
CI / check system | python3.13 on windows (push) Blocked by required conditions
CI / check system | python3.12 via chocolatey (push) Blocked by required conditions
CI / check system | python3.9 via pyenv (push) Blocked by required conditions
CI / check system | python3.13 (push) Blocked by required conditions
CI / check system | conda3.11 on linux (push) Blocked by required conditions
CI / check system | conda3.8 on linux (push) Blocked by required conditions
CI / check system | conda3.11 on macos (push) Blocked by required conditions
CI / check system | conda3.8 on macos (push) Blocked by required conditions
CI / check system | conda3.11 on windows (push) Blocked by required conditions
CI / check system | conda3.8 on windows (push) Blocked by required conditions
CI / check system | amazonlinux (push) Blocked by required conditions
CI / check system | embedded python3.10 on windows (push) Blocked by required conditions
CI / benchmarks (push) Blocked by required conditions

This commit is contained in:
Charlie Marsh 2024-12-16 22:59:57 -05:00 committed by GitHub
parent 85e17ddfa7
commit 9e4b842382
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 13 additions and 18 deletions

View file

@ -192,7 +192,7 @@ pub(crate) fn simplify_conflict_markers(
let mut inferences: FxHashMap<NodeIndex, Vec<FxHashSet<Inference>>> = FxHashMap::default();
for (node_id, sets) in activated {
let mut new_sets = vec![];
let mut new_sets = Vec::with_capacity(sets.len());
for set in sets {
let mut new_set = FxHashSet::default();
for item in set {

View file

@ -155,15 +155,15 @@ impl PubGrubPackage {
/// Returns the marker expression associated with this PubGrub package, if
/// it has one.
pub(crate) fn marker(&self) -> Option<MarkerTree> {
pub(crate) fn marker(&self) -> MarkerTree {
match &**self {
// A root can never be a dependency of another package, and a `Python` pubgrub
// package is never returned by `get_dependencies`. So these cases never occur.
PubGrubPackageInner::Root(_) | PubGrubPackageInner::Python(_) => None,
PubGrubPackageInner::Root(_) | PubGrubPackageInner::Python(_) => MarkerTree::TRUE,
PubGrubPackageInner::Package { marker, .. }
| PubGrubPackageInner::Extra { marker, .. }
| PubGrubPackageInner::Dev { marker, .. } => Some(*marker),
PubGrubPackageInner::Marker { marker, .. } => Some(*marker),
| PubGrubPackageInner::Dev { marker, .. } => *marker,
PubGrubPackageInner::Marker { marker, .. } => *marker,
}
}

View file

@ -435,7 +435,7 @@ impl<'d> ForkingPossibility<'d> {
env: &ResolverEnvironment,
dep: &'d PubGrubDependency,
) -> ForkingPossibility<'d> {
let marker = dep.package.marker().unwrap_or(MarkerTree::TRUE);
let marker = dep.package.marker();
if !env.included_by_marker(marker) {
ForkingPossibility::DependencyAlwaysExcluded
} else if marker.is_true() {
@ -506,7 +506,7 @@ impl<'d> Forker<'d> {
/// Returns true if the dependency represented by this forker may be
/// included in the given resolver environment.
pub(crate) fn included(&self, env: &ResolverEnvironment) -> bool {
let marker = self.package.marker().unwrap_or(MarkerTree::TRUE);
let marker = self.package.marker();
env.included_by_marker(marker)
}
}

View file

@ -3053,16 +3053,13 @@ impl Forks {
// For example, given `requires-python = ">=3.7"` and `uv ; python_version >= "3.8"`,
// where uv itself only supports Python 3.8 and later, we need to fork to ensure
// that the resolution can find a solution.
if !dep
.package
.marker()
.and_then(marker::requires_python)
.is_some_and(|bound| python_requirement.raises(&bound))
if marker::requires_python(dep.package.marker())
.is_none_or(|bound| !python_requirement.raises(&bound))
{
let dep = deps.pop().unwrap();
let markers = dep.package.marker().unwrap_or(MarkerTree::TRUE);
let marker = dep.package.marker();
for fork in &mut forks {
if fork.env.included_by_marker(markers) {
if fork.env.included_by_marker(marker) {
fork.add_dependency(dep.clone());
}
}
@ -3249,10 +3246,8 @@ impl Fork {
fn set_env(&mut self, env: ResolverEnvironment) {
self.env = env;
self.dependencies.retain(|dep| {
let Some(markers) = dep.package.marker() else {
return true;
};
if self.env.included_by_marker(markers) {
let marker = dep.package.marker();
if self.env.included_by_marker(marker) {
return true;
}
if let Some(conflicting_item) = dep.package.conflicting_item() {