From eb6244e0a32fdeb27bc4c3598b3500e8b1231d56 Mon Sep 17 00:00:00 2001 From: Alex E Date: Mon, 28 Apr 2025 09:53:56 +1000 Subject: [PATCH] Clean.py removal of .o and testbench + added to gitignore Refactored clean.py, and added removal of .o and testbench files --- .gitignore | 4 ++++ clean.py | 24 +++++++++++++----------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 82d9aed..b047674 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,7 @@ *.o *.exe + +stacktestbench +cputestbench +alutestbench \ No newline at end of file diff --git a/clean.py b/clean.py index a0d6806..90c10d7 100644 --- a/clean.py +++ b/clean.py @@ -1,20 +1,22 @@ -# remove *.txt, *.cf, *.vcd in the current directory and all subdirectories of "test" - import os import glob -# remove all .txt, .cf, and .vcd files in the current directory -for file in glob.glob("*.txt"): - os.remove(file) -for file in glob.glob("*.cf"): - os.remove(file) -for file in glob.glob("*.vcd"): +# File extensions to remove +extensions = (".txt", ".cf", ".vcd", ".o") + +# Remove files in the current directory +for ext in extensions: + for file in glob.glob(f"*{ext}"): + os.remove(file) + +# Remove files ending with "testbench" in the current directory +for file in glob.glob("*testbench"): os.remove(file) -# remove all .txt, .cf, and .vcd files in the test directory +# Remove files in "test" and its subdirectories for root, dirs, files in os.walk("test"): for file in files: - if file.endswith(".txt") or file.endswith(".cf") or file.endswith(".vcd"): + if file.endswith(extensions) or file.endswith("testbench"): os.remove(os.path.join(root, file)) -print("🧼 Cleaned up files!") \ No newline at end of file +print("🧼 Cleaned up files!")