Skip to content

Commit

Permalink
fix: --import env_file potentially breaks channel priority (prefix-de…
Browse files Browse the repository at this point in the history
  • Loading branch information
fecet authored Sep 23, 2024
1 parent fd903bf commit cf91da2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions crates/pixi_utils/src/conda_environment_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,12 @@ impl CondaEnvFile {
Vec<pep508_rs::Requirement>,
Vec<NamedChannelOrUrl>,
)> {
let channels = parse_channels(self.channels().clone());
let (conda_deps, pip_deps, mut extra_channels) =
let mut channels = parse_channels(self.channels().clone());
let (conda_deps, pip_deps, extra_channels) =
parse_dependencies(self.dependencies().clone())?;

extra_channels.extend(channels);
let mut channels: Vec<_> = extra_channels.into_iter().unique().collect();
channels.extend(extra_channels);
let mut channels: Vec<_> = channels.into_iter().unique().collect();
if channels.is_empty() {
channels = config.default_channels();
}
Expand Down Expand Up @@ -234,9 +234,9 @@ mod tests {
assert_eq!(
channels,
vec![
NamedChannelOrUrl::from_str("pytorch").unwrap(),
NamedChannelOrUrl::from_str("conda-forge").unwrap(),
NamedChannelOrUrl::from_str("https://custom-server.com/channel").unwrap(),
NamedChannelOrUrl::from_str("pytorch").unwrap(),
]
);

Expand Down

0 comments on commit cf91da2

Please sign in to comment.