From 0a07704d6dc53bf3a35d4aadfa240586f55e9487 Mon Sep 17 00:00:00 2001 From: LMBishop <13875753+LMBishop@users.noreply.github.com> Date: Thu, 20 Jul 2023 21:19:29 +0100 Subject: Replace python installer --- util/runners.py | 41 ----------------------------------------- 1 file changed, 41 deletions(-) delete mode 100644 util/runners.py (limited to 'util/runners.py') diff --git a/util/runners.py b/util/runners.py deleted file mode 100644 index dbfcf1f..0000000 --- a/util/runners.py +++ /dev/null @@ -1,41 +0,0 @@ -import os -import re -from util.exceptions import StepFailedError -from termcolor import colored - -HOME = os.getenv("HOME") -OVERWRITE_FILES = os.getenv("OVERWRITE_FILES") - - -def run_step(step): - step_type = step["=="] - - if step_type == "run": - do_run(step["command"]) - elif step_type == "link": - do_link(step["from"], step["to"]) - - -def do_run(command): - print(f"! {command}") - if not os.system(command) == 0: - raise StepFailedError("Non-zero return code") - - -def do_link(source, destination): - destination = re.sub(r"^~/", HOME + "/", destination) - print(f"Linking {source} -> {destination}") - if os.path.exists(destination): - if OVERWRITE_FILES == "1": - os.remove(destination) - print(colored(" (File overwritten)", "yellow")) - else: - print(colored(" (File already exists)", "yellow")) - return - - try: - os.link(source, destination) - except OSError as e: - raise StepFailedError("Link raised exeption: " + str(e)) from e - except Exception as e: - raise StepFailedError("Link raised exeption: " + str(e)) from e -- cgit v1.2.3-70-g09d2