File tree Expand file tree Collapse file tree 2 files changed +33
-6
lines changed Expand file tree Collapse file tree 2 files changed +33
-6
lines changed Original file line number Diff line number Diff line change @@ -1609,10 +1609,30 @@ impl<InstalledPackages: InstalledPackagesProvider> ResolverState<InstalledPackag
1609
1609
}
1610
1610
} ;
1611
1611
if name == Some ( & requirement. name ) {
1612
+ let Requirement {
1613
+ name,
1614
+ extras,
1615
+ groups,
1616
+ marker,
1617
+ source,
1618
+ origin,
1619
+ } = requirement;
1620
+
1621
+ // Add the constraints for that extra, i.e., if `project[foo]` includes `project[bar]>1.0`,
1622
+ // as a dependency, we need to propagate `project>1.0`, in addition to transitively
1623
+ // expanding `project[bar]`.
1624
+ requirements. push ( Cow :: Owned ( Requirement {
1625
+ name,
1626
+ extras : vec ! [ ] ,
1627
+ groups,
1628
+ marker,
1629
+ source,
1630
+ origin,
1631
+ } ) ) ;
1632
+
1612
1633
// Add each transitively included extra.
1613
1634
queue. extend (
1614
- requirement
1615
- . extras
1635
+ extras
1616
1636
. iter ( )
1617
1637
. cloned ( )
1618
1638
. map ( |extra| ( extra, requirement. marker ) ) ,
@@ -1625,7 +1645,7 @@ impl<InstalledPackages: InstalledPackagesProvider> ResolverState<InstalledPackag
1625
1645
}
1626
1646
1627
1647
// Drop all the self-requirements now that we flattened them out.
1628
- requirements. retain ( |req| name != Some ( & req. name ) ) ;
1648
+ requirements. retain ( |req| name != Some ( & req. name ) || req . extras . is_empty ( ) ) ;
1629
1649
1630
1650
requirements
1631
1651
}
Original file line number Diff line number Diff line change @@ -19131,6 +19131,10 @@ fn lock_recursive_extra() -> Result<()> {
19131
19131
lock, @r###"
19132
19132
version = 1
19133
19133
requires-python = ">=3.12"
19134
+ resolution-markers = [
19135
+ "python_full_version >= '3.13' or sys_platform != 'darwin'",
19136
+ "python_full_version < '3.13' and sys_platform == 'darwin'",
19137
+ ]
19134
19138
19135
19139
[options]
19136
19140
exclude-newer = "2024-03-25T00:00:00Z"
@@ -19585,12 +19589,15 @@ fn lock_self_extra_to_extra_incompatible() -> Result<()> {
19585
19589
)?;
19586
19590
19587
19591
uv_snapshot!(context.filters(), context.lock(), @r###"
19588
- success: true
19589
- exit_code: 0
19592
+ success: false
19593
+ exit_code: 1
19590
19594
----- stdout -----
19591
19595
19592
19596
----- stderr -----
19593
- Resolved 2 packages in [TIME]
19597
+ × No solution found when resolving dependencies:
19598
+ ╰─▶ Because project[foo] depends on your project and your project requires project[foo], we can conclude that your project's requirements are unsatisfiable.
19599
+
19600
+ hint: The package `project[foo]` depends on itself. This is likely a mistake. Consider removing the dependency.
19594
19601
"###);
19595
19602
19596
19603
let lock = context.read("uv.lock");
You can’t perform that action at this time.
0 commit comments