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

app_name = "SCclient"

def install():
    bin_name = glob.glob('SCENARIclient*x64.exe')[0]
    for to_uninstall in installed_softwares("SCclient"):
        print("Removing: %s (%s)" % (to_uninstall["name"], to_uninstall["version"]))
        killalltasks(control.impacted_process.split(","))
        run(uninstall_cmd(to_uninstall["key"]))
        wait_uninstallkey_absent(to_uninstall["key"])

    print("installing tis-scenariclient")
    run(bin_name + r" /S")


def uninstall():
    for to_uninstall in installed_softwares("SCENARIclient 6"):
        print("Removing: %s (%s)" % (to_uninstall["name"], to_uninstall["version"]))
        killalltasks(control.impacted_process.split(","))
        run(uninstall_cmd(to_uninstall["key"]))
        wait_uninstallkey_absent(to_uninstall["key"])