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


def install():

    # Uninstalling other versions 
    for to_uninstall in installed_softwares("FastFlix"):
        print("Removing: %s (%s)" % (to_uninstall["name"], to_uninstall["version"]))
        killalltasks(ensure_list(control.impacted_process))
        run(uninstall_cmd(to_uninstall["key"]))
        wait_uninstallkey_absent(to_uninstall["key"])

    # Declaring local variables
    bin_name = glob.glob('FastFlix_*_installer.exe')[0]

    # Installing the software
    install_exe_if_needed(bin_name ,
        silentflags='/S',
        key='FastFlix',
        min_version=control.get_software_version()
    )



