# -*- coding: utf-8 -*-
from setuphelpers import *

def install():
    bin_name = glob.glob('TheBrain*.exe')[0]

    # Install the software
    install_exe_if_needed(
        bin_name,
        silentflags='/quiet /norestart',
        name="^TheBrain$",
        min_version=control.get_software_version(),
    )
    uninstallkey.clear()

def uninstall():
    print(f"Removing: {control.name}")
    for uninstall in installed_softwares(name="^TheBrain$"):
        if uninstall["uninstall_string"].endswith("uninstall") :
            killalltasks(control.get_impacted_process_list())
            run(uninstall_cmd(uninstall["key"]))
            wait_uninstallkey_absent(uninstall["key"])