import os import subprocess # dir: string -> directory where installer exist # args: string -> which includes all parameters with space delimiter def spm_install(dir, args): os.chdir(dir) argslist = args.split() try: subprocess.check_call(argslist) print 'retcode' + str(0) + 'retcode' except subprocess.CalledProcessError as e: print 'retcode' + str(e.returncode) + 'retcode' # dir: string -> directory where installer exist # args: string -> which includes all parameters with space delimiter def spm_uninstall(dir, args): import time import subprocess command='"C:\\Program Files\\Google\\Chrome\\Application\\79.0.3945.117\\Installer\\setup.exe" --uninstall --force-uninstall --multi-install --chrome --system-level' result=subprocess.call(command) if result in [0,19, 20]: pass else: raise Exception(result) time.sleep(60) print 'retcode' + str(0)+ 'retcode' # dir: string -> directory where installer exist # args: string -> which includes all parameters with space delimiter def spm_update(dir, args): os.chdir(dir) argslist = args.split() try: subprocess.check_call(argslist) print 'retcode' + str(0) + 'retcode' except subprocess.CalledProcessError as e: print 'retcode' + str(e.returncode) + 'retcode'