mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 21:35:00 +00:00
Respect Requires-Python
in universal resolution (#3998)
## Summary Closes #3982.
This commit is contained in:
parent
63c84ed4a6
commit
6afb659c9a
13 changed files with 419 additions and 17 deletions
|
@ -306,11 +306,12 @@ impl<InstalledPackages: InstalledPackagesProvider> ResolverState<InstalledPackag
|
|||
let mut resolutions = vec![];
|
||||
|
||||
debug!(
|
||||
"Solving with target Python version {}",
|
||||
self.python_requirement
|
||||
.target()
|
||||
.unwrap_or(self.python_requirement.installed())
|
||||
"Solving with installed Python version: {}",
|
||||
self.python_requirement.installed()
|
||||
);
|
||||
if let Some(target) = self.python_requirement.target() {
|
||||
debug!("Solving with target Python version: {}", target);
|
||||
}
|
||||
|
||||
'FORK: while let Some(mut state) = forked_states.pop() {
|
||||
loop {
|
||||
|
@ -713,7 +714,7 @@ impl<InstalledPackages: InstalledPackagesProvider> ResolverState<InstalledPackag
|
|||
// The version is incompatible due to its Python requirement.
|
||||
if let Some(requires_python) = metadata.requires_python.as_ref() {
|
||||
if let Some(target) = self.python_requirement.target() {
|
||||
if !requires_python.contains(target) {
|
||||
if !target.subset_of(requires_python) {
|
||||
return Ok(Some(ResolverVersion::Unavailable(
|
||||
version.clone(),
|
||||
UnavailableVersion::IncompatibleDist(IncompatibleDist::Source(
|
||||
|
@ -725,9 +726,7 @@ impl<InstalledPackages: InstalledPackagesProvider> ResolverState<InstalledPackag
|
|||
)));
|
||||
}
|
||||
}
|
||||
|
||||
let installed = self.python_requirement.installed();
|
||||
if !requires_python.contains(installed) {
|
||||
if !requires_python.contains(self.python_requirement.installed()) {
|
||||
return Ok(Some(ResolverVersion::Unavailable(
|
||||
version.clone(),
|
||||
UnavailableVersion::IncompatibleDist(IncompatibleDist::Source(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue