Skip to content

Commit

Permalink
Avoid truncating EXTERNALLY-MANAGED error message
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Feb 29, 2024
1 parent ef15098 commit 26855ec
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions crates/uv-interpreter/src/interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ use platform_tags::{Tags, TagsError};
use uv_cache::{Cache, CacheBucket, CachedByTimestamp, Freshness, Timestamp};
use uv_fs::write_atomic_sync;

use crate::{Error, find_requested_python, PythonVersion};
use crate::python_environment::detect_virtual_env;
use crate::python_query::try_find_default_python;
use crate::virtualenv_layout::VirtualenvLayout;
use crate::{find_requested_python, Error, PythonVersion};

/// A Python executable and its associated platform markers.
#[derive(Debug, Clone)]
Expand Down Expand Up @@ -279,13 +279,16 @@ impl Interpreter {
return None;
};

let Ok(mut ini) = Ini::new_cs().read(contents) else {
let mut ini = Ini::new_cs();
ini.set_multiline(true);

let Ok(mut sections) = ini.read(contents) else {
// If a file exists but is not a valid INI file, we assume the environment is
// externally managed.
return Some(ExternallyManaged::default());
};

let Some(section) = ini.get_mut("externally-managed") else {
let Some(section) = sections.get_mut("externally-managed") else {
// If the file exists but does not contain an "externally-managed" section, we assume
// the environment is externally managed.
return Some(ExternallyManaged::default());
Expand Down

0 comments on commit 26855ec

Please sign in to comment.