Skip to content

Commit

Permalink
[Builder] Clean up option in config file (#1032)
Browse files Browse the repository at this point in the history
  • Loading branch information
emmamarichal authored Sep 24, 2024
1 parent da3ca08 commit b5bb703
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions Lib/gftools/builder/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,12 +349,21 @@ def draw_graph(self):
print("Could not parse ninja build file")

def clean(self):
for file in ["./build.ninja", "./.ninja_log"]:
if os.path.exists(file):
os.remove(file)
if hasattr(self, "config") and isinstance(self.config, dict):
cleanUp = self.config.get("cleanUp")
if cleanUp == True:
print("Cleaning up temporary files...")

if os.path.exists("instance_ufos"):
shutil.rmtree("instance_ufos")
for file in ["./build.ninja", "./.ninja_log"]:
if os.path.exists(file):
os.remove(file)

if os.path.exists("instance_ufos"):
shutil.rmtree("instance_ufos")

print("Done cleaning up temporary files")
else:
print("Configuration not found or invalid, skipping cleanup.")


def main(args=None):
Expand Down

0 comments on commit b5bb703

Please sign in to comment.