calibre/upload
2007-05-28 21:35:04 +00:00

62 lines
2.0 KiB
Python

#!/usr/bin/python
import sys, glob, os, subprocess
from subprocess import check_call as _check_call
from functools import partial
from pyvix.vix import *
check_call = partial(_check_call, shell=True)
check_call("sudo python setup.py develop", shell=True)
files = glob.glob('dist/*.exe')
for file in files:
os.unlink(file)
h = Host(hostType=VIX_SERVICEPROVIDER_VMWARE_WORKSTATION)
vm = h.openVM('/mnt/extra/vmware/Windows Vista/Windows Vista.vmx')
vm.powerOn()
if not vm.waitForToolsInGuest():
print >>sys.stderr, 'Windows is not booting up'
sys.exit(1)
vm.loginInGuest('kovid', 'et tu brutus')
vm.loginInGuest(VIX_CONSOLE_USER_NAME, '')
vm.runProgramInGuest('C:\\Users\kovid\Desktop\libprs500.bat', '')
vm.runProgramInGuest('C:\Windows\system32\shutdown.exe', '/s')
if not glob.glob('dist/*.exe'):
raise Exception('Windows build has failed')
PREFIX = "/var/www/vhosts/kovidgoyal.net/subdomains/libprs500"
DOWNLOADS = PREFIX+"/httpdocs/downloads"
DOCS = PREFIX+"/httpdocs/apidocs"
exe = os.path.basename(glob.glob('dist/*.exe')[0])
HTML2LRF = "src/libprs500/ebooks/lrf/html/demo"
f = open(os.path.join(HTML2LRF, 'demo_ext.html'), 'w')
f.write("<h2>The HTML</h2><pre>\n")
f.write(open(os.path.join(HTML2LRF, 'demo.html')).read())
f.write('\n</pre>')
f.close()
check_call('''html2lrf --title='Demonstration of html2lrf' --author='Kovid Goyal' --header --output=/tmp/html2lrf.lrf %s/demo.html'''%(HTML2LRF,))
check_call('''scp /tmp/html2lrf.lrf castalia:%s/'''%(DOWNLOADS,))
check_call('''python setup.py register sdist bdist_egg upload''')
check_call('''ssh castalia rm -f %s/libprs500\*.exe'''%(DOWNLOADS,))
check_call('''scp dist/%s castalia:%s/'''%(exe, DOWNLOADS))
check_call('''ssh castalia chmod a+r %s/\*'''%(DOWNLOADS,))
check_call('''ssh castalia /root/bin/update-installer-link %s'''%(exe,))
check_call('''epydoc --config epydoc.conf''')
check_call('''scp -r docs/html castalia:%s/'''%(DOCS,))
check_call('''epydoc -v --config epydoc-pdf.conf''')
check_call('''scp docs/pdf/api.pdf castalia:%s/'''%(DOCS,))
check_call('''rm -rf dist/* build/*''')