fix: never consider minor version for global site packages (#5893)
This commit is contained in:
@@ -278,14 +278,24 @@ impl PyV {
|
||||
.into())
|
||||
}
|
||||
}
|
||||
/// e.g.: `/tmp/windmill/cache/python_3xy`
|
||||
pub(crate) fn to_cache_dir(&self) -> String {
|
||||
/// e.g.: `/tmp/windmill/cache/python_3_x_y`
|
||||
pub(crate) fn to_cache_dir(&self, ignore_patch: bool) -> String {
|
||||
use windmill_common::worker::ROOT_CACHE_DIR;
|
||||
format!("{ROOT_CACHE_DIR}{}", self.to_cache_dir_top_level())
|
||||
format!(
|
||||
"{ROOT_CACHE_DIR}{}",
|
||||
self.to_cache_dir_top_level(ignore_patch)
|
||||
)
|
||||
}
|
||||
|
||||
/// e.g.: `python_3_x_y`
|
||||
pub fn to_cache_dir_top_level(&self) -> String {
|
||||
pub fn to_cache_dir_top_level(&self, ignore_patch: bool) -> String {
|
||||
if ignore_patch {
|
||||
if let [major, minor, ..] = self.release() {
|
||||
return format!("python_{major}_{minor}");
|
||||
}
|
||||
|
||||
tracing::warn!("failed to parse python's ({}) top level directory with no patch digit, fallback to full version.", self.to_string());
|
||||
}
|
||||
format!("python_{}", self.to_string().replace(".", "_"))
|
||||
}
|
||||
|
||||
@@ -589,7 +599,7 @@ impl PyV {
|
||||
// For the default version directory created during startup (main.rs)
|
||||
DirBuilder::new()
|
||||
.recursive(true)
|
||||
.create(self.to_cache_dir())
|
||||
.create(self.to_cache_dir(false))
|
||||
.await
|
||||
.expect("could not create initial worker dir");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user