mirror of https://github.com/astral-sh/uv
uv-resolver: fix propagation of extras
This will make `package[extra]` work even when `extra` is declared as a conflicting extra. Note that this isn't relevant for dependency groups since AFAIK those can actually only be enabled on the CLI. There is no `package:group` dependency syntax.
This commit is contained in:
parent
18fa48a092
commit
1676e63603
|
|
@ -1,3 +1,4 @@
|
||||||
|
use std::borrow::Cow;
|
||||||
use std::collections::hash_map::Entry;
|
use std::collections::hash_map::Entry;
|
||||||
use std::collections::VecDeque;
|
use std::collections::VecDeque;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
@ -277,6 +278,14 @@ pub trait Installable<'lock> {
|
||||||
Either::Right(package.dependencies.iter())
|
Either::Right(package.dependencies.iter())
|
||||||
};
|
};
|
||||||
for dep in deps {
|
for dep in deps {
|
||||||
|
let mut activated_extras = Cow::Borrowed(&*activated_extras);
|
||||||
|
if !dep.extra.is_empty() {
|
||||||
|
let mut extended = activated_extras.to_vec();
|
||||||
|
for extra in &dep.extra {
|
||||||
|
extended.push((&dep.package_id.name, extra));
|
||||||
|
}
|
||||||
|
activated_extras = Cow::Owned(extended);
|
||||||
|
}
|
||||||
if !dep.complexified_marker.evaluate(
|
if !dep.complexified_marker.evaluate(
|
||||||
marker_env,
|
marker_env,
|
||||||
&activated_extras,
|
&activated_extras,
|
||||||
|
|
|
||||||
|
|
@ -1191,7 +1191,11 @@ fn extra_unconditional_non_conflicting() -> Result<()> {
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
Audited in [TIME]
|
Prepared 3 packages in [TIME]
|
||||||
|
Installed 3 packages in [TIME]
|
||||||
|
+ anyio==4.1.0
|
||||||
|
+ idna==3.6
|
||||||
|
+ sniffio==1.3.1
|
||||||
"###);
|
"###);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue