This commit is contained in:
Kovid Goyal 2008-06-09 19:11:13 -07:00
parent 94736825ca
commit 5b68896e04
4 changed files with 17 additions and 10 deletions

View File

@ -17,4 +17,4 @@ class UnknownFormatError(Exception):
BOOK_EXTENSIONS = ['lrf', 'lrx', 'rar', 'zip', 'rtf', 'lit', 'txt', 'htm', 'xhtm', BOOK_EXTENSIONS = ['lrf', 'lrx', 'rar', 'zip', 'rtf', 'lit', 'txt', 'htm', 'xhtm',
'html', 'xhtml', 'epub', 'pdf', 'prc', 'mobi', 'azw', 'html', 'xhtml', 'epub', 'pdf', 'prc', 'mobi', 'azw',
'epub', 'fb2'] 'epub', 'fb2', 'djvu']

View File

@ -1750,7 +1750,7 @@ def process_file(path, options, logger=None):
tpath = '' tpath = ''
try_opf(path, options, logger) try_opf(path, options, logger)
if getattr(options, 'cover', None): if getattr(options, 'cover', None):
options.cover = os.path.expanduser(options.cover) options.cover = os.path.expanduser(options.cover)
if not os.path.isabs(options.cover): if not os.path.isabs(options.cover):
options.cover = os.path.join(dirpath, options.cover) options.cover = os.path.join(dirpath, options.cover)
if os.access(options.cover, os.R_OK): if os.access(options.cover, os.R_OK):
@ -1768,7 +1768,7 @@ def process_file(path, options, logger=None):
cim = im.resize((width, height), PILImage.BICUBIC).convert('RGB') if \ cim = im.resize((width, height), PILImage.BICUBIC).convert('RGB') if \
scaled else im scaled else im
cf = PersistentTemporaryFile(prefix=__appname__+"_", suffix=".jpg") cf = PersistentTemporaryFile(prefix=__appname__+"_", suffix=".jpg")
cf.close() cf.close()
cim.save(cf.name) cim.save(cf.name)
options.cover = cf.name options.cover = cf.name

View File

@ -120,7 +120,6 @@ lib.FcFontRenderPrepare.restype = POINTER(FcPattern)
if not lib.FcInit(): if not lib.FcInit():
raise RuntimeError(_('Could not initialize the fontconfig library')) raise RuntimeError(_('Could not initialize the fontconfig library'))
def find_font_families(allowed_extensions=['ttf']): def find_font_families(allowed_extensions=['ttf']):
''' '''
Return an alphabetically sorted list of font families available on the system. Return an alphabetically sorted list of font families available on the system.
@ -317,4 +316,4 @@ def main(args=sys.argv):
return 0 return 0
if __name__ == '__main__': if __name__ == '__main__':
sys.exit(main()) sys.exit(main())

View File

@ -82,20 +82,24 @@ def _build_linux():
cwd = os.getcwd() cwd = os.getcwd()
tbz2 = os.path.join(cwd, installer_name('tar.bz2')) tbz2 = os.path.join(cwd, installer_name('tar.bz2'))
SPEC="""\ SPEC="""\
import os
HOME = '%s' HOME = '%s'
PYINSTALLER = HOME+'/build/pyinstaller' PYINSTALLER = os.path.expanduser('~/build/pyinstaller')
CALIBREPREFIX = HOME+'/work/calibre' CALIBREPREFIX = HOME+'/work/calibre'
CLIT = '/usr/bin/clit' CLIT = '/usr/bin/clit'
PDFTOHTML = '/usr/bin/pdftohtml' PDFTOHTML = '/usr/bin/pdftohtml'
LIBUNRAR = '/usr/lib/libunrar.so' LIBUNRAR = '/usr/lib/libunrar.so'
QTDIR = '/usr/lib/qt4' QTDIR = '/usr/lib/qt4'
QTDLLS = ('QtCore', 'QtGui', 'QtNetwork', 'QtSvg', 'QtXml') QTDLLS = ('QtCore', 'QtGui', 'QtNetwork', 'QtSvg', 'QtXml')
EXTRAS = ('/usr/lib/python2.5/site-packages/PIL', os.path.expanduser('~/ipython/IPython'))
import glob, sys, subprocess, tarfile import glob, sys, subprocess, tarfile
CALIBRESRC = os.path.join(CALIBREPREFIX, 'src') CALIBRESRC = os.path.join(CALIBREPREFIX, 'src')
CALIBREPLUGINS = os.path.join(CALIBRESRC, 'calibre', 'plugins') CALIBREPLUGINS = os.path.join(CALIBRESRC, 'calibre', 'plugins')
subprocess.check_call(('/usr/bin/sudo', 'chown', '-R', 'kovid:users', glob.glob('/usr/lib/python*/site-packages/')[-1])) subprocess.check_call(('/usr/bin/sudo', 'chown', '-R', 'kovid:users', glob.glob('/usr/lib/python*/site-packages/')[-1]))
subprocess.check_call('rm -rf %%(py)s/dist/* %%(py)s/build/*'%%dict(py=PYINSTALLER), shell=True)
loader = os.path.join('/tmp', 'calibre_installer_loader.py') loader = os.path.join('/tmp', 'calibre_installer_loader.py')
if not os.path.exists(loader): if not os.path.exists(loader):
@ -112,8 +116,8 @@ excludes = ['gtk._gtk', 'gtk.glade', 'qt', 'matplotlib.nxutils', 'matplotlib._cn
'matplotlib.ttconv', 'matplotlib._image', 'matplotlib.ft2font', 'matplotlib.ttconv', 'matplotlib._image', 'matplotlib.ft2font',
'matplotlib._transforms', 'matplotlib._agg', 'matplotlib.backends._backend_agg', 'matplotlib._transforms', 'matplotlib._agg', 'matplotlib.backends._backend_agg',
'matplotlib.axes', 'matplotlib', 'matplotlib.pyparsing', 'matplotlib.axes', 'matplotlib', 'matplotlib.pyparsing',
'TKinter', 'atk', 'gobject._gobject', 'pango'] 'TKinter', 'atk', 'gobject._gobject', 'pango', 'PIL', 'Image', 'IPython']
temp = ['IPython.Extensions.ipy_profile_none'] temp = ['keyword', 'codeop']
recipes = ['calibre', 'web', 'feeds', 'recipes'] recipes = ['calibre', 'web', 'feeds', 'recipes']
prefix = '.'.join(recipes)+'.' prefix = '.'.join(recipes)+'.'
@ -192,9 +196,13 @@ coll = COLLECT(binaries, pyz, [('manifest', manifest, 'DATA'), ('version', versi
excludes=excludes, excludes=excludes,
name='dist')) name='dist'))
os.chdir(os.path.join(HOMEPATH, 'calibre', 'dist'))
for folder in EXTRAS:
subprocess.check_call('cp -rf %%s .'%%folder, shell=True)
print 'Building tarball...' print 'Building tarball...'
tf = tarfile.open('%s', 'w:bz2') tf = tarfile.open('%s', 'w:bz2')
os.chdir(os.path.join(HOMEPATH, 'calibre', 'dist'))
for f in os.listdir('.'): for f in os.listdir('.'):
tf.add(f) tf.add(f)
@ -214,7 +222,7 @@ def build_linux():
print 'Waiting for linux to boot up...' print 'Waiting for linux to boot up...'
time.sleep(60) time.sleep(60)
check_call('ssh linux make -C /mnt/hgfs/giskard/work/calibre all egg linux_binary') check_call('ssh linux make -C /mnt/hgfs/giskard/work/calibre all egg linux_binary')
check_call('ssh sudo poweroff') check_call('ssh linux sudo poweroff')
def build_installers(): def build_installers():
return build_linux(), build_windows(), build_osx() return build_linux(), build_windows(), build_osx()