This script will download and install any program that has silent install options. You need to supply url, app name, directory to save to, directory will be created if it doesn’t exist, and silent install options. The downloaded file will be deleted on completion.
import urllib2, subprocess, os, sys, shutil
url = 'http://www.thewebsomewhere.com/yourapp.ext'
appname = 'savedappname.exe'
filedirectory = "directory/to/save/to"
options1 = '-yourswitch1'
options2 = '/yourswitch2'
drive = os.path.splitdrive(sys.executable)[0] + os.sep
directory = os.path.join(drive, filedirectory)
if not os.path.isdir(directory):
os.makedirs(directory)
installapplication = os.path.join(directory, appname)
getfile = urllib2.urlopen(url)
with open(installapplication, 'wb') as savefile:
shutil.copyfileobj(getfile, savefile)
process = subprocess.Popen([ installapplication, options1, options2 ],stdout=subprocess.PIPE)
for line in iter(process.stdout.readline,''):
print line.rstrip();
os.remove(installapplication)