Skip to content

Commit

Permalink
Skip removed directories during bytecode compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
zanieb committed Feb 19, 2025
1 parent 326d0c4 commit a08c2ea
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion crates/uv-installer/src/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,19 @@ pub async fn compile_tree(
// Otherwise we stumble over temporary files from `compileall`.
.filter_entry(|dir| dir.file_name() != "__pycache__");
for entry in walker {
let entry = entry?;
let entry = match entry {
Ok(entry) => entry,
Err(err) => {
if err
.io_error()
.is_some_and(|err| err.kind() == io::ErrorKind::NotFound)
{
// The directory was removed, just ignore it
continue;
}
return Err(err.into());
}
};
// https://github.com/pypa/pip/blob/3820b0e52c7fed2b2c43ba731b718f316e6816d1/src/pip/_internal/operations/install/wheel.py#L593-L604
if entry.metadata()?.is_file() && entry.path().extension().is_some_and(|ext| ext == "py") {
source_files += 1;
Expand Down

0 comments on commit a08c2ea

Please sign in to comment.