From 11efaa26694a9857dce6738019278b116b586004 Mon Sep 17 00:00:00 2001 From: Kevin Date: Wed, 3 Nov 2021 10:49:34 -0700 Subject: [PATCH] changed code aligner to run recursively on a root directory -only runs the aligner on .sv files -runs recursively on sub-directories --- wally-pipelined/src/ifu/CodeAligner.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/wally-pipelined/src/ifu/CodeAligner.py b/wally-pipelined/src/ifu/CodeAligner.py index 59f9de4e..579fd623 100644 --- a/wally-pipelined/src/ifu/CodeAligner.py +++ b/wally-pipelined/src/ifu/CodeAligner.py @@ -87,12 +87,26 @@ def Mod_Space_at(Ln,loc,diff): return NewString -def main_filehandler(overwrite=False): +'''def main_filehandler(overwrite=False): for filename in os.listdir(): - if ".py" not in filename: + if ".sv" in filename: GiantString = read_input(filename) SOV = ID_start(GiantString) ModifiedGS = modified_logNew(GiantString,SOV) - Newname = write_to_output(filename,ModifiedGS,overwrite) + Newname = write_to_output(filename,ModifiedGS,overwrite)''' +def root_filehandler(path,overwrite=False): + for f in os.listdir(path): + if os.path.isdir(f): + root_filehandler(path+"/"+f) + else: + if ".sv" in f: + GiantString = read_input(f) + SOV = ID_start(GiantString) + ModifiedGS = modified_logNew(GiantString,SOV) + Newname = write_to_output(f,ModifiedGS,overwrite) + + +def driver(overwrite=False): + root_filehandler(os.getcwd()) -main_filehandler(True) \ No newline at end of file +driver(True) \ No newline at end of file