This commit is contained in:
Kovid Goyal 2008-08-30 13:46:39 -07:00
parent 62d3987e34
commit 5c399a268e
3 changed files with 17 additions and 24 deletions

View File

@ -5,9 +5,11 @@ __docformat__ = 'restructuredtext en'
''' '''
''' '''
import sys, time, subprocess, os import sys, time, subprocess, os, re
from calibre import __appname__, __version__ from calibre import __appname__, __version__
sv = re.sub(r'[a-z]\d+', '', __version__)
cmdline = [ cmdline = [
'/usr/local/installjammer/installjammer', '/usr/local/installjammer/installjammer',
'--build-dir', '/tmp/calibre-installjammer', '--build-dir', '/tmp/calibre-installjammer',
@ -18,10 +20,10 @@ cmdline = [
'-DPackageDescription', '%s is an e-book library manager. It can view, convert and catalog e-books in most of the major e-book formats. It can also talk to a few e-book reader devices. It can go out to the internet and fetch metadata for your books. It can download newspapers and convert them into e-books for convenient reading.'%__appname__, '-DPackageDescription', '%s is an e-book library manager. It can view, convert and catalog e-books in most of the major e-book formats. It can also talk to a few e-book reader devices. It can go out to the internet and fetch metadata for your books. It can download newspapers and convert them into e-books for convenient reading.'%__appname__,
'-DPackageSummary', '%s: E-book library management'%__appname__, '-DPackageSummary', '%s: E-book library management'%__appname__,
'-DVersion', __version__, '-DVersion', __version__,
'-DInstallVersion', __version__ + '.0', '-DInstallVersion', sv + '.0',
'-DLicense', open(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), 'LICENSE')).read().replace('\n', '\r\n'), '-DLicense', open(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), 'LICENSE')).read().replace('\n', '\r\n'),
'--output-dir', os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), 'dist'), '--output-dir', os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), 'dist'),
'--platform', 'Windows', '--platform', 'Windows',
] ]
def run_install_jammer(installer_name='<%AppName%>-<%Version%><%Ext%>', build_for_release=True): def run_install_jammer(installer_name='<%AppName%>-<%Version%><%Ext%>', build_for_release=True):
@ -43,4 +45,4 @@ def main(args=sys.argv):
return 0 return 0
if __name__ == '__main__': if __name__ == '__main__':
sys.exit(main()) sys.exit(main())

View File

@ -14,7 +14,7 @@ IMAGEMAGICK_DIR = 'C:\\ImageMagick'
FONTCONFIG_DIR = 'C:\\fontconfig' FONTCONFIG_DIR = 'C:\\fontconfig'
import sys, os, py2exe, shutil, zipfile, glob, subprocess import sys, os, py2exe, shutil, zipfile, glob, subprocess, re
from distutils.core import setup from distutils.core import setup
from distutils.filelist import FileList from distutils.filelist import FileList
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
@ -22,6 +22,8 @@ sys.path.insert(0, BASE_DIR)
from setup import VERSION, APPNAME, entry_points, scripts, basenames from setup import VERSION, APPNAME, entry_points, scripts, basenames
sys.path.remove(BASE_DIR) sys.path.remove(BASE_DIR)
VERSION = re.sub('[a-z]\d+', '', VERSION)
PY2EXE_DIR = os.path.join(BASE_DIR, 'build','py2exe') PY2EXE_DIR = os.path.join(BASE_DIR, 'build','py2exe')
class BuildEXE(py2exe.build_exe.py2exe): class BuildEXE(py2exe.build_exe.py2exe):
@ -58,29 +60,18 @@ class BuildEXE(py2exe.build_exe.py2exe):
shutil.copyfile(f, os.path.join(self.dist_dir, os.path.basename(f))) shutil.copyfile(f, os.path.join(self.dist_dir, os.path.basename(f)))
for f in glob.glob(os.path.join(BASE_DIR, 'src', 'calibre', 'plugins', '*.pyd')): for f in glob.glob(os.path.join(BASE_DIR, 'src', 'calibre', 'plugins', '*.pyd')):
shutil.copyfile(f, os.path.join(tgt, os.path.basename(f))) shutil.copyfile(f, os.path.join(tgt, os.path.basename(f)))
qtsvgdll = None
for other in self.other_depends:
if 'qtsvg4.dll' in other.lower():
qtsvgdll = other
break
shutil.copyfile('LICENSE', os.path.join(self.dist_dir, 'LICENSE')) shutil.copyfile('LICENSE', os.path.join(self.dist_dir, 'LICENSE'))
print print
if qtsvgdll: print 'Adding QtXml4.dll'
print 'Adding', qtsvgdll shutil.copyfile(os.path.join(QT_DIR, 'bin', 'QtXml4.dll'),
shutil.copyfile(qtsvgdll, os.path.join(self.dist_dir, os.path.basename(qtsvgdll))) os.path.join(self.dist_dir, 'QtXml4.dll'))
qtxmldll = os.path.join(os.path.dirname(qtsvgdll), 'QtXml4.dll')
print 'Adding', qtxmldll
shutil.copyfile(qtxmldll,
os.path.join(self.dist_dir, os.path.basename(qtxmldll)))
print 'Adding Qt plugins...', print 'Adding Qt plugins...',
qt_prefix = QT_DIR qt_prefix = QT_DIR
if qtsvgdll:
qt_prefix = os.path.dirname(os.path.dirname(qtsvgdll))
plugdir = os.path.join(qt_prefix, 'plugins') plugdir = os.path.join(qt_prefix, 'plugins')
for d in ('imageformats', 'codecs', 'iconengines'): for d in ('imageformats', 'codecs', 'iconengines'):
print d, print d,
imfd = os.path.join(plugdir, d) imfd = os.path.join(plugdir, d)
tg = os.path.join(self.dist_dir, d) tg = os.path.join(self.dist_dir, d)
if os.path.exists(tg): if os.path.exists(tg):
shutil.rmtree(tg) shutil.rmtree(tg)
shutil.copytree(imfd, tg) shutil.copytree(imfd, tg)
@ -124,8 +115,8 @@ class BuildEXE(py2exe.build_exe.py2exe):
@classmethod @classmethod
def manifest(cls, prog): def manifest(cls, prog):
cls.manifest_resource_id += 1 cls.manifest_resource_id += 1
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')))
def main(args=sys.argv): def main(args=sys.argv):
@ -161,7 +152,7 @@ def main(args=sys.argv):
'win32process', 'win32api', 'msvcrt', 'win32process', 'win32api', 'msvcrt',
'win32event', 'calibre.ebooks.lrf.any.*', 'win32event', 'calibre.ebooks.lrf.any.*',
'calibre.ebooks.lrf.feeds.*', 'calibre.ebooks.lrf.feeds.*',
'genshi', 'genshi',
'path', 'pydoc', 'IPython.Extensions.*', 'path', 'pydoc', 'IPython.Extensions.*',
'calibre.web.feeds.recipes.*', 'calibre.web.feeds.recipes.*',
'PyQt4.QtWebKit', 'PyQt4.QtNetwork', 'PyQt4.QtWebKit', 'PyQt4.QtNetwork',

View File

@ -31,7 +31,7 @@ cd ~/build && \
rsync -avz --exclude src/calibre/plugins --exclude calibre/src/calibre.egg-info --exclude docs --exclude .bzr --exclude .build --exclude build --exclude dist --exclude "*.pyc" --exclude "*.pyo" rsync://%(host)s/work/%(project)s . && \ rsync -avz --exclude src/calibre/plugins --exclude calibre/src/calibre.egg-info --exclude docs --exclude .bzr --exclude .build --exclude build --exclude dist --exclude "*.pyc" --exclude "*.pyo" rsync://%(host)s/work/%(project)s . && \
cd %(project)s && \ cd %(project)s && \
%%s && \ %%s && \
rm -rf build/* && \ rm -rf build/* dist/* && \
%%s %%s %%s %%s
'''%dict(host=HOST, project=PROJECT) '''%dict(host=HOST, project=PROJECT)
check_call = partial(_check_call, shell=True) check_call = partial(_check_call, shell=True)