-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathclean.py
More file actions
executable file
·36 lines (27 loc) · 952 Bytes
/
clean.py
File metadata and controls
executable file
·36 lines (27 loc) · 952 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env python3
import os
import shutil
from pathlib import Path
def main():
# Get the directory where this script is located
script_dir = Path(__file__).parent
print(f"cleaning: {script_dir}")
# Define directories to clean
built_dir = script_dir / "build"
dist_dir = script_dir / "dist"
# Remove contents of directories if they exist
for directory in [built_dir, dist_dir]:
if directory.exists():
# Remove all contents but keep the directory
for item in directory.iterdir():
if item.is_dir():
shutil.rmtree(item)
print(f"Removed directory: {item}")
else:
item.unlink()
print(f"Removed file: {item}")
else:
print(f"Directory not found (skipping): {directory}")
print("cleaned out all built stuff")
if __name__ == "__main__":
main()