This commit is contained in:
Kovid Goyal 2009-02-18 20:50:50 -08:00
parent abb6a83afb
commit d447bda625
2 changed files with 21 additions and 17 deletions

View File

@ -173,7 +173,7 @@ if __name__ == '__main__':
'stage3' : stage3, 'stage3' : stage3,
'stage2' : stage2, 'stage2' : stage2,
'stage1' : stage1, 'stage1' : stage1,
'upload' : upload, 'publish' : upload,
}, },
) )

View File

@ -449,7 +449,7 @@ def installer_name(ext):
class build_linux(OptionlessCommand): class build_linux(OptionlessCommand):
description = 'Build linux installer'
def run(self): def run(self):
installer = installer_name('tar.bz2') installer = installer_name('tar.bz2')
locals = {} locals = {}
@ -502,7 +502,7 @@ class VMInstaller(OptionlessCommand):
check_call('ssh -t %s bash build-calibre'%ssh_host, shell=True) check_call('ssh -t %s bash build-calibre'%ssh_host, shell=True)
class build_windows(VMInstaller): class build_windows(VMInstaller):
description = 'Build windows installer'
VM = '/mnt/backup/calibre_windows_xp_home/calibre_windows_xp_home.vmx' VM = '/mnt/backup/calibre_windows_xp_home/calibre_windows_xp_home.vmx'
if not os.path.exists(VM): if not os.path.exists(VM):
VM = '/home/kovid/calibre_windows_xp_home/calibre_windows_xp_home.vmx' VM = '/home/kovid/calibre_windows_xp_home/calibre_windows_xp_home.vmx'
@ -535,7 +535,7 @@ class build_windows(VMInstaller):
class build_osx(VMInstaller): class build_osx(VMInstaller):
description = 'Build OS X app bundle'
VM = '/vmware/Mac OSX/Mac OSX.vmx' VM = '/vmware/Mac OSX/Mac OSX.vmx'
if not os.path.exists(VM): if not os.path.exists(VM):
VM = '/home/kovid/calibre_os_x/Mac OSX.vmx' VM = '/home/kovid/calibre_os_x/Mac OSX.vmx'
@ -548,7 +548,7 @@ class build_osx(VMInstaller):
python = '/Library/Frameworks/Python.framework/Versions/Current/bin/python' python = '/Library/Frameworks/Python.framework/Versions/Current/bin/python'
self.start_vm('osx', ('sudo %s setup.py develop'%python, python, self.start_vm('osx', ('sudo %s setup.py develop'%python, python,
'installer/osx/freeze.py')) 'installer/osx/freeze.py'))
check_call(('scp', 'osx:build/calibre/dist/*.dmg', 'dist'), shell=True) check_call(('scp', 'osx:build/calibre/dist/*.dmg', 'dist'))
if not os.path.exists(installer): if not os.path.exists(installer):
raise Exception('Failed to build installer '+installer) raise Exception('Failed to build installer '+installer)
if not self.dont_shutdown: if not self.dont_shutdown:
@ -558,7 +558,7 @@ class build_osx(VMInstaller):
class upload_installers(OptionlessCommand): class upload_installers(OptionlessCommand):
description = 'Upload any installers present in dist/'
def curl_list_dir(self, url=MOBILEREAD, listonly=1): def curl_list_dir(self, url=MOBILEREAD, listonly=1):
import pycurl import pycurl
c = pycurl.Curl() c = pycurl.Curl()
@ -631,7 +631,7 @@ class upload_installers(OptionlessCommand):
%(__version__, DOWNLOADS), shell=True) %(__version__, DOWNLOADS), shell=True)
class upload_user_manual(OptionlessCommand): class upload_user_manual(OptionlessCommand):
description = 'Build and upload the User Manual'
sub_commands = [('manual', None)] sub_commands = [('manual', None)]
def run(self): def run(self):
@ -640,9 +640,9 @@ class upload_user_manual(OptionlessCommand):
'divok:%s'%USER_MANUAL]), shell=True) 'divok:%s'%USER_MANUAL]), shell=True)
class upload_to_pypi(OptionlessCommand): class upload_to_pypi(OptionlessCommand):
description = 'Upload eggs and source to PyPI'
def run(self): def run(self):
check_call('python setup.py register') check_call('python setup.py register'.split())
check_call('rm -f dist/*', shell=True) check_call('rm -f dist/*', shell=True)
check_call('sudo rm -rf build src/calibre/plugins/*', shell=True) check_call('sudo rm -rf build src/calibre/plugins/*', shell=True)
os.mkdir('build') os.mkdir('build')
@ -653,28 +653,31 @@ class upload_to_pypi(OptionlessCommand):
check_call('python setup.py sdist upload'.split()) check_call('python setup.py sdist upload'.split())
class stage3(OptionlessCommand): class stage3(OptionlessCommand):
description = 'Stage 3 of the build process'
sub_commands = [ sub_commands = [
('upload_installers', None), ('upload_installers', None),
('upload_user_manual', None), ('upload_user_manual', None),
('upload_to_pypi', None), ('upload_to_pypi', None),
] ]
def run(self): @classmethod
OptionlessCommand.run(self) def misc(cls):
check_call('ssh divok rm -f %s/calibre-\*.tar.gz'%DOWNLOADS, shell=True) check_call('ssh divok rm -f %s/calibre-\*.tar.gz'%DOWNLOADS, shell=True)
check_call('scp dist/calibre-*.tar.gz divok:%s/'%DOWNLOADS, shell=True) check_call('scp dist/calibre-*.tar.gz divok:%s/'%DOWNLOADS, shell=True)
check_call('''rm -rf dist/* build/*''', shell=True) check_call('''rm -rf dist/* build/*''', shell=True)
check_call('ssh divok bzr update /var/www/calibre.kovidgoyal.net/calibre/', check_call('ssh divok bzr update /var/www/calibre.kovidgoyal.net/calibre/',
shell=True) shell=True)
class stage2(OptionlessCommand): def run(self):
OptionlessCommand.run(self)
self.misc()
class stage2(OptionlessCommand):
description = 'Stage 2 of the build process'
sub_commands = [ sub_commands = [
('build_linux', None), ('build_linux', None),
('build_windows', None), ('build_windows', None),
('build_osx', None), ('build_osx', None)
('upload_installers', None),
] ]
def run(self): def run(self):
@ -682,7 +685,7 @@ class stage2(OptionlessCommand):
OptionlessCommand.run(self) OptionlessCommand.run(self)
class stage1(OptionlessCommand): class stage1(OptionlessCommand):
description = 'Stage 1 of the build process'
sub_commands = [ sub_commands = [
('update', None), ('update', None),
('tag_release', None), ('tag_release', None),
@ -690,6 +693,7 @@ class stage1(OptionlessCommand):
] ]
class upload(OptionlessCommand): class upload(OptionlessCommand):
description = 'Build and upload calibre to the servers'
sub_commands = [ sub_commands = [
('stage1', None), ('stage1', None),