Skip to content

Commit 8caef4e

Browse files
committed
Remove potential __pycache__ directories from src tarballs
1 parent 63d6ce0 commit 8caef4e

File tree

1 file changed

+14
-0
lines changed
  • src/bootstrap/src/core/build_steps

1 file changed

+14
-0
lines changed

src/bootstrap/src/core/build_steps/dist.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,6 +1028,20 @@ impl Step for PlainSourceTarball {
10281028
builder.create(&cargo_config_dir.join("config.toml"), &config);
10291029
}
10301030

1031+
// Delete extraneous directories
1032+
// FIXME: if we're managed by git, we should probably instead ask git if the given path
1033+
// is managed by it?
1034+
for entry in walkdir::WalkDir::new(tarball.image_dir())
1035+
.follow_links(true)
1036+
.into_iter()
1037+
.filter_map(|e| e.ok())
1038+
{
1039+
if entry.path().is_dir() && entry.path().file_name() == Some(OsStr::new("__pycache__"))
1040+
{
1041+
t!(fs::remove_dir_all(entry.path()));
1042+
}
1043+
}
1044+
10311045
tarball.bare()
10321046
}
10331047
}

0 commit comments

Comments
 (0)