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
|
import sys, re, os, shutil, subprocess, stat
|
||||||
from setup import VERSION, APPNAME, scripts, main_modules, basenames, main_functions
|
from setup import VERSION, APPNAME, scripts, main_modules, basenames, main_functions
|
||||||
from setuptools import setup
|
from setuptools import setup
|
||||||
sys.argv[1:2] = ['py2app']
|
|
||||||
from py2app.build_app import py2app
|
from py2app.build_app import py2app
|
||||||
from modulegraph.find_modules import find_modules
|
from modulegraph.find_modules import find_modules
|
||||||
|
|
||||||
@ -222,31 +221,46 @@ sys.frameworks_dir = os.path.join(os.path.dirname(os.environ['RESOURCEPATH']), '
|
|||||||
BuildAPP.makedmg(os.path.join(self.dist_dir, APPNAME+'.app'), APPNAME+'-'+VERSION)
|
BuildAPP.makedmg(os.path.join(self.dist_dir, APPNAME+'.app'), APPNAME+'-'+VERSION)
|
||||||
|
|
||||||
|
|
||||||
setup(
|
def main():
|
||||||
name = APPNAME,
|
auto = '--auto' in sys.argv
|
||||||
app = [scripts['gui'][0]],
|
if auto:
|
||||||
cmdclass = { 'py2app' : BuildAPP },
|
sys.argv.remove('--auto')
|
||||||
options = { 'py2app' :
|
if auto and not os.path.exists('dist/auto'):
|
||||||
{
|
print '%s does not exist'%os.path.abspath('dist/auto')
|
||||||
'optimize' : 2,
|
return 1
|
||||||
'dist_dir' : 'build/py2app',
|
|
||||||
'argv_emulation' : True,
|
sys.argv[1:2] = ['py2app']
|
||||||
'iconfile' : 'icons/library.icns',
|
setup(
|
||||||
'frameworks': ['libusb.dylib', 'libunrar.dylib'],
|
name = APPNAME,
|
||||||
'includes' : ['sip', 'pkg_resources', 'PyQt4.QtSvg',
|
app = [scripts['gui'][0]],
|
||||||
'mechanize', 'ClientForm', 'usbobserver'],
|
cmdclass = { 'py2app' : BuildAPP },
|
||||||
'packages' : ['PIL', 'Authorization', 'rtf2xml', 'lxml'],
|
options = { 'py2app' :
|
||||||
'excludes' : ['pydoc'],
|
{
|
||||||
'plist' : { 'CFBundleGetInfoString' : '''libprs500, an E-book management application.'''
|
'optimize' : 2,
|
||||||
''' Visit http://libprs500.kovidgoyal.net for details.''',
|
'dist_dir' : 'build/py2app',
|
||||||
'CFBundleIdentifier':'net.kovidgoyal.librs500',
|
'argv_emulation' : True,
|
||||||
'CFBundleShortVersionString':VERSION,
|
'iconfile' : 'icons/library.icns',
|
||||||
'CFBundleVersion':APPNAME + ' ' + VERSION,
|
'frameworks': ['libusb.dylib', 'libunrar.dylib'],
|
||||||
'LSMinimumSystemVersion':'10.4.3',
|
'includes' : ['sip', 'pkg_resources', 'PyQt4.QtSvg',
|
||||||
'LSMultipleInstancesProhibited':'true',
|
'mechanize', 'ClientForm', 'usbobserver'],
|
||||||
'NSHumanReadableCopyright':'Copyright 2006, Kovid Goyal',
|
'packages' : ['PIL', 'Authorization', 'rtf2xml', 'lxml'],
|
||||||
},
|
'excludes' : ['pydoc'],
|
||||||
},
|
'plist' : { 'CFBundleGetInfoString' : '''libprs500, an E-book management application.'''
|
||||||
},
|
''' Visit http://libprs500.kovidgoyal.net for details.''',
|
||||||
setup_requires = ['py2app'],
|
'CFBundleIdentifier':'net.kovidgoyal.librs500',
|
||||||
)
|
'CFBundleShortVersionString':VERSION,
|
||||||
|
'CFBundleVersion':APPNAME + ' ' + VERSION,
|
||||||
|
'LSMinimumSystemVersion':'10.4.3',
|
||||||
|
'LSMultipleInstancesProhibited':'true',
|
||||||
|
'NSHumanReadableCopyright':'Copyright 2006, Kovid Goyal',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
setup_requires = ['py2app'],
|
||||||
|
)
|
||||||
|
if auto:
|
||||||
|
subprocess.call(('sudo', 'shutdown', '-h', '+0'))
|
||||||
|
return 0
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
sys.exit(main())
|
50
upload.py
50
upload.py
@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
import sys, os, shutil
|
import sys, os, shutil, time
|
||||||
sys.path.append('src')
|
sys.path.append('src')
|
||||||
|
import subprocess
|
||||||
from subprocess import check_call as _check_call
|
from subprocess import check_call as _check_call
|
||||||
from functools import partial
|
from functools import partial
|
||||||
#from pyvix.vix import Host, VIX_SERVICEPROVIDER_VMWARE_WORKSTATION
|
#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.callback_get_log_message = get_log_message
|
||||||
client.copy(base+'/trunk', tag)
|
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():
|
def build_windows():
|
||||||
from libprs500 import __version__
|
from libprs500 import __version__
|
||||||
installer = 'dist/libprs500-%s.exe'%__version__
|
installer = 'dist/libprs500-%s.exe'%__version__
|
||||||
if not os.path.exists(installer):
|
vm = '/vmware/Windows XP/Windows XP Professional.vmx'
|
||||||
raise Exception('You must build the windows installer before running this script')
|
return build_installer(installer, vm, 20)
|
||||||
|
|
||||||
return os.path.basename(installer)
|
|
||||||
|
|
||||||
def build_osx():
|
def build_osx():
|
||||||
from libprs500 import __version__
|
from libprs500 import __version__
|
||||||
installer = 'dist/libprs500-%s.dmg'%__version__
|
installer = 'dist/libprs500-%s.dmg'%__version__
|
||||||
if not os.path.exists(installer):
|
vm = '/vmware/Mac OSX/Mac OSX.vmx'
|
||||||
raise Exception('You must build the OSX installer before running this script')
|
return build_installer(installer, vm, 20)
|
||||||
|
|
||||||
return os.path.basename(installer)
|
|
||||||
|
|
||||||
|
def build_installers():
|
||||||
|
return build_windows(), build_osx()
|
||||||
|
|
||||||
def upload_demo():
|
def upload_demo():
|
||||||
check_call('''html2lrf --title='Demonstration of html2lrf' --author='Kovid Goyal' '''
|
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')
|
check_call('svn commit -m "Updated translations" src/libprs500/translations')
|
||||||
tag_release()
|
tag_release()
|
||||||
upload_demo()
|
upload_demo()
|
||||||
print 'Building OSX installer...'
|
exe, dmg = build_installers()
|
||||||
dmg = build_osx()
|
|
||||||
print 'Building Windows installer...'
|
|
||||||
exe = build_windows()
|
|
||||||
if upload:
|
if upload:
|
||||||
print 'Uploading installers...'
|
print 'Uploading installers...'
|
||||||
upload_installers(exe, dmg)
|
upload_installers(exe, dmg)
|
||||||
|
@ -15,9 +15,6 @@
|
|||||||
''' Create a windows installer '''
|
''' Create a windows installer '''
|
||||||
import sys, re, os, shutil, subprocess
|
import sys, re, os, shutil, subprocess
|
||||||
from setup import VERSION, APPNAME, entry_points, scripts, basenames
|
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.core import setup
|
||||||
from distutils.filelist import FileList
|
from distutils.filelist import FileList
|
||||||
import py2exe, glob
|
import py2exe, glob
|
||||||
@ -432,37 +429,55 @@ class BuildEXE(build_exe):
|
|||||||
return (24, cls.manifest_resource_id,
|
return (24, cls.manifest_resource_id,
|
||||||
cls.MANIFEST_TEMPLATE % dict(prog=prog, version=VERSION+'.0'))
|
cls.MANIFEST_TEMPLATE % dict(prog=prog, version=VERSION+'.0'))
|
||||||
|
|
||||||
console = [dict(dest_base=basenames['console'][i], script=scripts['console'][i])
|
|
||||||
for i in range(len(scripts['console']))]
|
|
||||||
|
|
||||||
setup(
|
|
||||||
cmdclass = {'py2exe': BuildEXE},
|
def main():
|
||||||
windows = [
|
auto = '--auto' in sys.argv
|
||||||
{'script' : scripts['gui'][0],
|
if auto:
|
||||||
'dest_base' : APPNAME,
|
sys.argv.remove('--auto')
|
||||||
'icon_resources' : [(1, 'icons/library.ico')],
|
sys.argv[1:2] = ['py2exe']
|
||||||
'other_resources' : [BuildEXE.manifest(APPNAME)],
|
if '--verbose' not in sys.argv:
|
||||||
},
|
sys.argv.append('--quiet') #py2exe produces too much output by default
|
||||||
{'script' : scripts['gui'][1],
|
if auto and not os.path.exists('dist\\auto'):
|
||||||
'dest_base' : 'lrfviewer',
|
print os.path.abspath('dist\\auto'), 'does not exist'
|
||||||
'icon_resources' : [(1, 'icons/viewer.ico')],
|
return 1
|
||||||
'other_resources' : [BuildEXE.manifest('lrfviewer')],
|
console = [dict(dest_base=basenames['console'][i], script=scripts['console'][i])
|
||||||
},
|
for i in range(len(scripts['console']))]
|
||||||
],
|
|
||||||
console = console,
|
setup(
|
||||||
options = { 'py2exe' : {'compressed': 1,
|
cmdclass = {'py2exe': BuildEXE},
|
||||||
'optimize' : 2,
|
windows = [
|
||||||
'dist_dir' : PY2EXE_DIR,
|
{'script' : scripts['gui'][0],
|
||||||
'includes' : ['sip', 'pkg_resources', 'PyQt4.QtSvg',
|
'dest_base' : APPNAME,
|
||||||
'mechanize', 'ClientForm', 'wmi',
|
'icon_resources' : [(1, 'icons/library.ico')],
|
||||||
'win32file', 'pythoncom', 'rtf2xml',
|
'other_resources' : [BuildEXE.manifest(APPNAME)],
|
||||||
'lxml', 'lxml._elementpath'],
|
},
|
||||||
'packages' : ['PIL'],
|
{'script' : scripts['gui'][1],
|
||||||
'excludes' : ["Tkconstants", "Tkinter", "tcl",
|
'dest_base' : 'lrfviewer',
|
||||||
"_imagingtk", "ImageTk", "FixTk",
|
'icon_resources' : [(1, 'icons/viewer.ico')],
|
||||||
'pydoc'],
|
'other_resources' : [BuildEXE.manifest('lrfviewer')],
|
||||||
'dll_excludes' : ['mswsock.dll'],
|
},
|
||||||
},
|
],
|
||||||
},
|
console = console,
|
||||||
|
options = { 'py2exe' : {'compressed': 1,
|
||||||
)
|
'optimize' : 2,
|
||||||
|
'dist_dir' : PY2EXE_DIR,
|
||||||
|
'includes' : ['sip', 'pkg_resources', 'PyQt4.QtSvg',
|
||||||
|
'mechanize', 'ClientForm', 'wmi',
|
||||||
|
'win32file', 'pythoncom', 'rtf2xml',
|
||||||
|
'lxml', 'lxml._elementpath'],
|
||||||
|
'packages' : ['PIL'],
|
||||||
|
'excludes' : ["Tkconstants", "Tkinter", "tcl",
|
||||||
|
"_imagingtk", "ImageTk", "FixTk",
|
||||||
|
'pydoc'],
|
||||||
|
'dll_excludes' : ['mswsock.dll'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
)
|
||||||
|
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