fix(python): supports folders starting with numbers for execution
This commit is contained in:
@@ -472,7 +472,13 @@ async fn prepare_wrapper(
|
||||
|
||||
let relative_imports = RELATIVE_IMPORT_REGEX.is_match(&inner_content);
|
||||
|
||||
let script_path_splitted = script_path.split("/");
|
||||
let script_path_splitted = script_path.split("/").map(|x| {
|
||||
if x.starts_with(|x: char| x.is_ascii_digit()) {
|
||||
format!("_{}", x)
|
||||
} else {
|
||||
x.to_string()
|
||||
}
|
||||
});
|
||||
let dirs_full = script_path_splitted
|
||||
.clone()
|
||||
.take(script_path_splitted.clone().count() - 1)
|
||||
@@ -497,12 +503,6 @@ async fn prepare_wrapper(
|
||||
let module_dir = format!("{}/{}", job_dir, dirs);
|
||||
tokio::fs::create_dir_all(format!("{module_dir}/")).await?;
|
||||
|
||||
let last = if last.starts_with(|x: char| x.is_ascii_digit()) {
|
||||
format!("_{}", last)
|
||||
} else {
|
||||
last
|
||||
};
|
||||
|
||||
let _ = write_file(&module_dir, &format!("{last}.py"), inner_content).await?;
|
||||
if relative_imports {
|
||||
let _ = write_file(job_dir, "loader.py", RELATIVE_PYTHON_LOADER).await?;
|
||||
|
||||
Reference in New Issue
Block a user