Skip to content

Commit bfd4c74

Browse files
committed
fix: relative source packages
1 parent 4546f40 commit bfd4c74

File tree

1 file changed

+20
-3
lines changed
  • crates/pixi_command_dispatcher/src/expand_dev_sources

1 file changed

+20
-3
lines changed

crates/pixi_command_dispatcher/src/expand_dev_sources/mod.rs

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
use std::collections::{BTreeMap, HashSet};
22

3+
use itertools::Either;
34
use miette::Diagnostic;
45
use pixi_build_discovery::EnabledProtocols;
5-
use pixi_spec::{BinarySpec, PixiSpec, SourceSpec};
6+
use pixi_spec::{BinarySpec, PixiSpec, SourceAnchor, SourceSpec};
67
use pixi_spec_containers::DependencyMap;
78
use rattler_conda_types::{ChannelConfig, ChannelUrl, PackageName};
89
use 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

Comments
 (0)