fix: never consider minor version for global site packages (#5893)

This commit is contained in:
pyranota
2025-06-07 03:35:28 +02:00
committed by GitHub
parent c697efaab9
commit 5ab4eca2f0
4 changed files with 24 additions and 24 deletions

View File

@@ -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");