Skip to content

Commit 2fb0a76

Browse files
mmahroussfda-odoo
authored andcommitted
[IMP] check for default python command
1 parent 1dc61fb commit 2fb0a76

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

server/src/constants.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,5 +122,4 @@ pub const BUILT_IN_LIBS: &[&str] = &["string", "re", "difflib", "textwrap", "un
122122
"cgi", "cgitb", "chunk", "crypt", "imghdr", "imp", "mailcap", "msilib", "nis", "nntplib", "optparse", "ossaudiodev",
123123
"pipes", "smtpd", "sndhdr", "spwd", "sunau", "telnetlib", "uu", "xdrlib", "struct", "codecs"];
124124

125-
pub const DEFAULT_PYTHON: &str = "python3";
126125
pub const CONFIG_WIKI_URL: &str = "https://github.com/odoo/odoo-ls/wiki/Configuration-files";

server/src/core/config.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ use ruff_python_parser::{Mode, ParseOptions};
1212
use serde::{Deserialize, Deserializer, Serialize, Serializer};
1313
use schemars::{JsonSchema, Schema, SchemaGenerator};
1414

15-
use crate::constants::{DEFAULT_PYTHON, CONFIG_WIKI_URL};
15+
use crate::constants::{CONFIG_WIKI_URL};
1616
use crate::core::diagnostics::{DiagnosticCode, DiagnosticSetting, SchemaDiagnosticCodes};
17-
use crate::utils::{fill_validate_path, has_template, is_addon_path, is_odoo_path, is_python_path, PathSanitizer};
17+
use crate::utils::{fill_validate_path, get_python_command, has_template, is_addon_path, is_odoo_path, is_python_path, PathSanitizer};
1818
use crate::S;
1919

2020

@@ -469,7 +469,7 @@ where
469469
{
470470
match opt {
471471
Some(val) => val.serialize(serializer),
472-
None => (Sourced { value: S!(DEFAULT_PYTHON), ..Default::default() }).serialize(serializer),
472+
None => (Sourced { value: S!(get_python_command().unwrap_or_default()), ..Default::default() }).serialize(serializer),
473473
}
474474
}
475475

@@ -760,7 +760,7 @@ impl Default for ConfigEntry {
760760
name: default_profile_name(),
761761
odoo_path: None,
762762
addons_paths: HashSet::new(),
763-
python_path: S!(DEFAULT_PYTHON),
763+
python_path: S!(get_python_command().unwrap_or_default()),
764764
additional_stubs: HashSet::new(),
765765
refresh_mode: RefreshMode::default(),
766766
file_cache: true,
@@ -1379,7 +1379,7 @@ fn merge_all_workspaces(
13791379
name: key.clone(),
13801380
odoo_path: raw_entry.odoo_path.map(|op| op.value),
13811381
addons_paths: raw_entry.addons_paths.into_iter().flatten().map(|op| op.value).collect(),
1382-
python_path: raw_entry.python_path.map(|op| op.value).unwrap_or(S!(DEFAULT_PYTHON)),
1382+
python_path: raw_entry.python_path.map(|op| op.value).unwrap_or(S!(get_python_command().unwrap_or_default())),
13831383
additional_stubs: raw_entry.additional_stubs.into_iter().flatten().map(|op| op.value).collect(),
13841384
refresh_mode: raw_entry.refresh_mode.map(|op| op.value).unwrap_or_default(),
13851385
file_cache: raw_entry.file_cache.map(|op| op.value).unwrap_or(true),

0 commit comments

Comments
 (0)