2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-16 22:57:14 +00:00

fixing pre-run script

This commit is contained in:
2024-12-12 17:08:00 +00:00
parent 58c9dd7d09
commit 321f912083
4 changed files with 33 additions and 60 deletions

View File

@@ -1,5 +1,6 @@
import os
import shutil
from pathlib import Path
"""Cleans all django-created files and compiled python. Used by the
pre-run.sh script which cleans and initialises everything before
@@ -47,7 +48,11 @@ def delete_migrations():
if folder.endswith("migrations"):
for item in os.listdir(folder):
if not item.endswith("__init__.py"):
os.remove(os.path.join(folder, item))
fullitem = Path(folder, item)
if fullitem.is_dir():
print(f"__ directory {item} in {folder} not deleted")
else:
os.remove(os.path.join(folder, item))
print("All migration files deleted.")
return None