# -*- coding: utf-8 -*-
from setuphelpers import *
import os
import shutil
uninstallkey = []

def install():
    def killsoft():
      for soft in ('WINWORD.EXE','POWERPNT.EXE','EXCEL.exe','MSPUB.EXE','MSACCESS.EXE','INFOPATH.EXE','lync.exe','ONENOTE.EXE','OUTLOOK.EXE','ONENOTEM.EXE','MSOSYNC.EXE','GROOVE.EXE'):
        if isrunning(soft):
           print ("closing %s" % soft)
           killalltasks(soft)

    project = 'Microsoft Project Standard 2013'
    projectpresent = installed_softwares(project)

    print('installing project')
    if not projectpresent:
            cmd = '"ms-project-2013\setup.exe" /adminfile project.msp'
    else:
            cmd = 'msiexec.exe /p project.msp'
    killsoft()
    run(cmd,timeout=1200,accept_returncodes=[1641,3010,0])
    projectpresent = installed_softwares(project)
    if not projectpresent:
        error('End audit did not find the software.')

