Remove potential __pycache__ directories from src tarballs

This commit is contained in:
Jakub Beránek 2024-03-30 21:21:58 +01:00
parent 63d6ce03b3
commit 8caef4e6c3
No known key found for this signature in database
GPG Key ID: 909CD0D26483516B

View File

@ -1028,6 +1028,20 @@ impl Step for PlainSourceTarball {
builder.create(&cargo_config_dir.join("config.toml"), &config); 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() tarball.bare()
} }
} }