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): 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): app_name=r'\VulkanSDK' silent_cmd=r' /S' drive=os.getenv("SystemDrive") file_path=os.path.join(drive,app_name) try: d=os.listdir(file_path) for version in d: u=os.path.join(file_path,version) chk_path=os.path.join(u,r'Uninstall.exe') if os.path.exists(chk_path): unargslist1=chk_path+silent_cmd subprocess.check_call(unargslist1) print 'VulkanSDK '+version+ ' is removed' except subprocess.CalledProcessError as e: print 'VulkanSDK '+version+ ' does not exist, uninstaller returncode:' + str(e.returncode); 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'