-
-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A cleanup script to use with development
- Loading branch information
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import shutil | ||
from pathlib import Path | ||
|
||
|
||
# Clean up after installing for local development | ||
def clean(): | ||
# Get the current directory | ||
base_dir = Path.cwd() | ||
|
||
# Directories and patterns to clean | ||
cleanup_patterns = [ | ||
'build', | ||
'dist', | ||
'*.egg-info', | ||
'__pycache__', | ||
'.eggs', | ||
'.pytest_cache' | ||
] | ||
|
||
# Clean directories | ||
for pattern in cleanup_patterns: | ||
for path in base_dir.glob(pattern): | ||
try: | ||
if path.is_dir(): | ||
shutil.rmtree(path) | ||
else: | ||
path.unlink() | ||
print(f"Removed: {path}") | ||
except Exception as e: | ||
print(f"Could not remove {path}: {e}") | ||
|
||
# Remove compiled Python files | ||
for path in base_dir.rglob('*.py[co]'): | ||
try: | ||
path.unlink() | ||
print(f"Removed compiled file: {path}") | ||
except Exception as e: | ||
print(f"Could not remove {path}: {e}") | ||
|
||
|
||
if __name__ == '__main__': | ||
clean() |