Skip to content

Commit

Permalink
Remove potential __pycache__ directories from src tarballs
Browse files Browse the repository at this point in the history
  • Loading branch information
Kobzol committed Mar 30, 2024
1 parent 47cb48e commit dfd24b5
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/bootstrap/src/core/build_steps/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1028,6 +1028,20 @@ impl Step for PlainSourceTarball {
builder.create(&cargo_config_dir.join("config.toml"), &config);
}

// Delete extraneous directories
// FIXME: if we're managed by git, we should probably instead ask git if the given path
// is managed by it?
for entry in walkdir::WalkDir::new(tarball.image_dir())
.follow_links(true)
.into_iter()
.filter_map(|e| e.ok())
{
if entry.path().is_dir() && entry.path().file_name() == Some(OsStr::new("__pycache__"))
{
t!(fs::remove_dir_all(entry.path()));
}
}

tarball.bare()
}
}
Expand Down

0 comments on commit dfd24b5

Please sign in to comment.