from setuphelpers import *


def install():
    # # Installing the software
    bin_name = glob.glob("Zulip-*-x64.msi")[0]

    for u in installed_softwares('zulip'):
        if Version(u['version']) < control.get_software_version():
            run(uninstall_cmd(u['key']))
            
    old_key= get_msi_properties(bin_name)['ProductCode']
    if uninstall_key_exists(old_key):
        if not isfile(makepath(programfiles64,'zulip',"Zulip.exe")):
            run(uninstall_cmd(old_key))
    install_msi_if_needed(bin_name,properties={"ALLUSERS":1})
