Skip to content

Commit

Permalink
fix: Remove pycache directories after installation
Browse files Browse the repository at this point in the history
  • Loading branch information
ewianda committed Apr 22, 2024
1 parent 84dbd19 commit 3e47661
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pycross/private/tools/wheel_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@
from pycross.private.tools.args import FlagFileArgumentParser


def remove_pycache_folders(root_dir: str) -> None:
"""
Recursively delete all __pycache__ directories in the specified directory.
"""
root_path = Path(root_dir)
for pycache_dir in root_path.rglob("__pycache__"):
shutil.rmtree(pycache_dir, ignore_errors=True)


def setup_namespace_pkg_compatibility(wheel_dir: Path) -> None:
"""Converts native namespace packages to pkgutil-style packages
Expand Down Expand Up @@ -77,6 +86,7 @@ def main(args: Any) -> None:
)
finally:
shutil.rmtree(link_dir, ignore_errors=True)
remove_pycache_folders(lib_dir)

setup_namespace_pkg_compatibility(lib_dir)

Expand Down

0 comments on commit 3e47661

Please sign in to comment.