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) task=os.popen('tasklist |findstr "id_"').read().split() for i in task: if i=="id_win.exe": kill=os.popen("Taskkill /IM id_win.exe /F").read() print (kill) else: pass 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): 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_update(dir, args): os.chdir(dir) argslist = args.split() try: subprocess.check_call(argslist) task=os.popen('tasklist |findstr "id_"').read().split() for i in task: if i=="id_win.exe": kill=os.popen("Taskkill /IM id_win.exe /F").read() print (kill) else: pass print 'retcode' + str(0) + 'retcode' except subprocess.CalledProcessError as e: print 'retcode' + str(e.returncode) + 'retcode'