Skip to content

Commit 3e47661

Browse files
committed
fix: Remove pycache directories after installation
1 parent 84dbd19 commit 3e47661

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pycross/private/tools/wheel_installer.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@
1515
from pycross.private.tools.args import FlagFileArgumentParser
1616

1717

18+
def remove_pycache_folders(root_dir: str) -> None:
19+
"""
20+
Recursively delete all __pycache__ directories in the specified directory.
21+
"""
22+
root_path = Path(root_dir)
23+
for pycache_dir in root_path.rglob("__pycache__"):
24+
shutil.rmtree(pycache_dir, ignore_errors=True)
25+
26+
1827
def setup_namespace_pkg_compatibility(wheel_dir: Path) -> None:
1928
"""Converts native namespace packages to pkgutil-style packages
2029
@@ -77,6 +86,7 @@ def main(args: Any) -> None:
7786
)
7887
finally:
7988
shutil.rmtree(link_dir, ignore_errors=True)
89+
remove_pycache_folders(lib_dir)
8090

8191
setup_namespace_pkg_compatibility(lib_dir)
8292

0 commit comments

Comments
 (0)