11use std:: collections:: { BTreeMap , HashSet } ;
22
3+ use itertools:: Either ;
34use miette:: Diagnostic ;
45use pixi_build_discovery:: EnabledProtocols ;
5- use pixi_spec:: { BinarySpec , PixiSpec , SourceSpec } ;
6+ use pixi_spec:: { BinarySpec , PixiSpec , SourceAnchor , SourceSpec } ;
67use pixi_spec_containers:: DependencyMap ;
78use rattler_conda_types:: { ChannelConfig , ChannelUrl , PackageName } ;
89use thiserror:: Error ;
@@ -125,6 +126,9 @@ impl ExpandDevSourcesSpec {
125126 error,
126127 } ) ?;
127128
129+ // Create a SourceAnchor for resolving relative paths in dependencies
130+ let source_anchor = SourceAnchor :: from ( SourceSpec :: from ( pinned_source. pinned . clone ( ) ) ) ;
131+
128132 // Get the output dependencies
129133 let spec = GetOutputDependenciesSpec {
130134 source : pinned_source. pinned ,
@@ -151,9 +155,22 @@ impl ExpandDevSourcesSpec {
151155 // Skip dependencies that are also dev_sources
152156 // TODO: Currently matching by name only. In the future, we might want to
153157 // also check if the source location matches for more precise matching.
154- if ! dev_source_names. contains ( & name) {
155- result . dependencies . insert ( name , spec ) ;
158+ if dev_source_names. contains ( & name) {
159+ continue
156160 }
161+
162+ // Resolve relative paths for source dependencies
163+ let resolved_spec = match spec. into_source_or_binary ( ) {
164+ Either :: Left ( source) => {
165+ // Resolve the source relative to the dev_source's location
166+ PixiSpec :: from ( source_anchor. resolve ( source) )
167+ }
168+ Either :: Right ( binary) => {
169+ // Binary specs don't need path resolution
170+ PixiSpec :: from ( binary)
171+ }
172+ } ;
173+ result. dependencies . insert ( name, resolved_spec) ;
157174 }
158175 }
159176 } ;
0 commit comments