Skip to content

Commit de784c5

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

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

pycross/private/tools/wheel_installer.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,19 @@
1010
from installer import install
1111
from installer.destinations import SchemeDictionaryDestination
1212
from installer.sources import WheelFile
13-
1413
from pycross.private.tools import namespace_pkgs
1514
from pycross.private.tools.args import FlagFileArgumentParser
1615

1716

17+
def remove_pycache_folders(root_dir):
18+
"""
19+
Recursively delete __pycache__ directories in the specified directory.
20+
"""
21+
root_path = Path(root_dir)
22+
for pycache_dir in root_path.rglob("__pycache__"):
23+
shutil.rmtree(pycache_dir, ignore_errors=True)
24+
25+
1826
def setup_namespace_pkg_compatibility(wheel_dir: Path) -> None:
1927
"""Converts native namespace packages to pkgutil-style packages
2028
@@ -77,6 +85,7 @@ def main(args: Any) -> None:
7785
)
7886
finally:
7987
shutil.rmtree(link_dir, ignore_errors=True)
88+
remove_pycache_folders(lib_dir)
8089

8190
setup_namespace_pkg_compatibility(lib_dir)
8291

0 commit comments

Comments
 (0)