mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
This commit is contained in:
parent
c8cce1e355
commit
3487147221
@ -18,7 +18,6 @@
|
||||
import sys, re, os, shutil, subprocess, stat
|
||||
from setup import VERSION, APPNAME, scripts, main_modules, basenames, main_functions
|
||||
from setuptools import setup
|
||||
sys.argv[1:2] = ['py2app']
|
||||
from py2app.build_app import py2app
|
||||
from modulegraph.find_modules import find_modules
|
||||
|
||||
@ -222,6 +221,15 @@ sys.frameworks_dir = os.path.join(os.path.dirname(os.environ['RESOURCEPATH']), '
|
||||
BuildAPP.makedmg(os.path.join(self.dist_dir, APPNAME+'.app'), APPNAME+'-'+VERSION)
|
||||
|
||||
|
||||
def main():
|
||||
auto = '--auto' in sys.argv
|
||||
if auto:
|
||||
sys.argv.remove('--auto')
|
||||
if auto and not os.path.exists('dist/auto'):
|
||||
print '%s does not exist'%os.path.abspath('dist/auto')
|
||||
return 1
|
||||
|
||||
sys.argv[1:2] = ['py2app']
|
||||
setup(
|
||||
name = APPNAME,
|
||||
app = [scripts['gui'][0]],
|
||||
@ -250,3 +258,9 @@ setup(
|
||||
},
|
||||
setup_requires = ['py2app'],
|
||||
)
|
||||
if auto:
|
||||
subprocess.call(('sudo', 'shutdown', '-h', '+0'))
|
||||
return 0
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
48
upload.py
48
upload.py
@ -1,6 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
import sys, os, shutil
|
||||
import sys, os, shutil, time
|
||||
sys.path.append('src')
|
||||
import subprocess
|
||||
from subprocess import check_call as _check_call
|
||||
from functools import partial
|
||||
#from pyvix.vix import Host, VIX_SERVICEPROVIDER_VMWARE_WORKSTATION
|
||||
@ -34,23 +35,49 @@ def tag_release():
|
||||
client.callback_get_log_message = get_log_message
|
||||
client.copy(base+'/trunk', tag)
|
||||
|
||||
def build_installer(installer, vm, timeout=25):
|
||||
if os.path.exists(installer):
|
||||
os.unlink(installer)
|
||||
f = open('dist/auto', 'wb')
|
||||
f.write('\n')
|
||||
f.close()
|
||||
print 'Building installer %s ...'%installer
|
||||
vmware = ('vmware', '-q', '-x', '-n', vm)
|
||||
try:
|
||||
p = subprocess.Popen(vmware)
|
||||
print 'Waiting...',
|
||||
minutes = 0
|
||||
sys.stdout.flush()
|
||||
while p.returncode is None and minutes < timeout and not os.path.exists(installer):
|
||||
p.poll()
|
||||
time.sleep(60)
|
||||
minutes += 1
|
||||
print minutes,
|
||||
sys.stdout.flush()
|
||||
if not os.path.exists(installer):
|
||||
raise Exception('Failed to build windows installer')
|
||||
finally:
|
||||
os.unlink('dist/auto')
|
||||
|
||||
|
||||
return os.path.basename(installer)
|
||||
|
||||
|
||||
def build_windows():
|
||||
from libprs500 import __version__
|
||||
installer = 'dist/libprs500-%s.exe'%__version__
|
||||
if not os.path.exists(installer):
|
||||
raise Exception('You must build the windows installer before running this script')
|
||||
vm = '/vmware/Windows XP/Windows XP Professional.vmx'
|
||||
return build_installer(installer, vm, 20)
|
||||
|
||||
return os.path.basename(installer)
|
||||
|
||||
def build_osx():
|
||||
from libprs500 import __version__
|
||||
installer = 'dist/libprs500-%s.dmg'%__version__
|
||||
if not os.path.exists(installer):
|
||||
raise Exception('You must build the OSX installer before running this script')
|
||||
|
||||
return os.path.basename(installer)
|
||||
vm = '/vmware/Mac OSX/Mac OSX.vmx'
|
||||
return build_installer(installer, vm, 20)
|
||||
|
||||
def build_installers():
|
||||
return build_windows(), build_osx()
|
||||
|
||||
def upload_demo():
|
||||
check_call('''html2lrf --title='Demonstration of html2lrf' --author='Kovid Goyal' '''
|
||||
@ -94,10 +121,7 @@ def main():
|
||||
check_call('svn commit -m "Updated translations" src/libprs500/translations')
|
||||
tag_release()
|
||||
upload_demo()
|
||||
print 'Building OSX installer...'
|
||||
dmg = build_osx()
|
||||
print 'Building Windows installer...'
|
||||
exe = build_windows()
|
||||
exe, dmg = build_installers()
|
||||
if upload:
|
||||
print 'Uploading installers...'
|
||||
upload_installers(exe, dmg)
|
||||
|
@ -15,9 +15,6 @@
|
||||
''' Create a windows installer '''
|
||||
import sys, re, os, shutil, subprocess
|
||||
from setup import VERSION, APPNAME, entry_points, scripts, basenames
|
||||
sys.argv[1:2] = ['py2exe']
|
||||
if '--verbose' not in ' '.join(sys.argv):
|
||||
sys.argv.append('--quiet') #py2exe produces too much output by default
|
||||
from distutils.core import setup
|
||||
from distutils.filelist import FileList
|
||||
import py2exe, glob
|
||||
@ -432,6 +429,18 @@ class BuildEXE(build_exe):
|
||||
return (24, cls.manifest_resource_id,
|
||||
cls.MANIFEST_TEMPLATE % dict(prog=prog, version=VERSION+'.0'))
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
auto = '--auto' in sys.argv
|
||||
if auto:
|
||||
sys.argv.remove('--auto')
|
||||
sys.argv[1:2] = ['py2exe']
|
||||
if '--verbose' not in sys.argv:
|
||||
sys.argv.append('--quiet') #py2exe produces too much output by default
|
||||
if auto and not os.path.exists('dist\\auto'):
|
||||
print os.path.abspath('dist\\auto'), 'does not exist'
|
||||
return 1
|
||||
console = [dict(dest_base=basenames['console'][i], script=scripts['console'][i])
|
||||
for i in range(len(scripts['console']))]
|
||||
|
||||
@ -466,3 +475,9 @@ setup(
|
||||
},
|
||||
|
||||
)
|
||||
if auto:
|
||||
subprocess.call(('shutdown', '-s', '-f', '-t', '01'))
|
||||
return 0
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
|
Loading…
x
Reference in New Issue
Block a user