Skip to content

Commit 9889462

Browse files
committed
Only apply to locals, if a version is available
1 parent 309e408 commit 9889462

File tree

5 files changed

+460
-340
lines changed

5 files changed

+460
-340
lines changed

crates/uv-resolver/src/pubgrub/package.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -228,11 +228,6 @@ impl PubGrubPackage {
228228
}
229229
}
230230

231-
/// Returns `true` if this PubGrub package is the root package.
232-
pub(crate) fn is_root(&self) -> bool {
233-
matches!(&**self, PubGrubPackageInner::Root(_))
234-
}
235-
236231
/// Returns `true` if this PubGrub package is a proxy package.
237232
pub(crate) fn is_proxy(&self) -> bool {
238233
matches!(

crates/uv-resolver/src/resolver/availability.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,6 @@ pub(crate) enum ResolverVersion {
170170
Unavailable(Version, UnavailableVersion),
171171
/// A usable version
172172
Unforked(Version),
173-
/// A set of forks.
174-
Forked(Vec<ResolverEnvironment>),
173+
/// A set of forks, optionally with resolved versions
174+
Forked(Vec<(ResolverEnvironment, Option<Version>)>),
175175
}

crates/uv-resolver/src/resolver/environment.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ pub(crate) fn fork_version_by_python_requirement(
559559
pub(crate) fn fork_version_by_marker(
560560
env: &ResolverEnvironment,
561561
marker: MarkerTree,
562-
) -> Vec<ResolverEnvironment> {
562+
) -> Option<(ResolverEnvironment, ResolverEnvironment)> {
563563
let Kind::Universal {
564564
markers: ref env_marker,
565565
..
@@ -584,20 +584,18 @@ pub(crate) fn fork_version_by_marker(
584584
// `sys_platform == 'win32'`, return an empty list, since the following isn't satisfiable:
585585
//
586586
// python_version >= '3.10' and sys_platform == 'linux' and sys_platform == 'win32'
587-
588-
let mut envs = vec![];
589587
if env_marker.is_disjoint(marker) {
590-
return vec![];
588+
return None;
591589
}
592-
envs.push(env.narrow_environment(marker));
590+
let with_marker = env.narrow_environment(marker);
593591

594592
let complement = marker.negate();
595593
if env_marker.is_disjoint(complement) {
596-
return vec![];
594+
return None;
597595
}
598-
envs.push(env.narrow_environment(complement));
596+
let without_marker = env.narrow_environment(complement);
599597

600-
envs
598+
Some((with_marker, without_marker))
601599
}
602600

603601
#[cfg(test)]

0 commit comments

Comments
 (0)