This commit is contained in:
Kovid Goyal 2008-08-27 18:06:38 -07:00
parent fcc5866881
commit a4d6a595c2
4 changed files with 24 additions and 7 deletions

View File

@ -150,9 +150,9 @@ _check_symlinks_prescript()
if not match: if not match:
print dep print dep
raise Exception('Unknown Qt dependency') raise Exception('Unknown Qt dependency')
module = match.group(1) module = match.group(1)
newpath = fp + '%s.framework/Versions/Current/%s'%(module, module) newpath = fp + '%s.framework/Versions/Current/%s'%(module, module)
cmd = ' '.join(['/usr/bin/install_name_tool', '-change', dep, newpath, path]) cmd = ' '.join(['/usr/bin/install_name_tool', '-change', dep, newpath, path])
subprocess.check_call(cmd, shell=True) subprocess.check_call(cmd, shell=True)
@ -218,9 +218,16 @@ _check_symlinks_prescript()
self.fix_misc_dependencies(deps) self.fix_misc_dependencies(deps)
def fix_lxml_dependencies(self, resource_dir):
for f in glob.glob(os.path.join(resource_dir, 'lib', 'python*', 'lxml', '*.so')):
print 'Fixing dependencies of', os.path.basename(f)
for lib in ('libxml2.2.dylib', 'libxslt.1.dylib', 'libexslt.0.dylib'):
subprocess.check_call(['/usr/bin/install_name_tool', '-change',
'/usr/local/lib/%s'%lib, '@executable_path/../Frameworks/%s'%lib, f])
def run(self): def run(self):
py2app.run(self) py2app.run(self)
resource_dir = os.path.join(self.dist_dir, resource_dir = os.path.join(self.dist_dir,
APPNAME + '.app', 'Contents', 'Resources') APPNAME + '.app', 'Contents', 'Resources')
frameworks_dir = os.path.join(os.path.dirname(resource_dir), 'Frameworks') frameworks_dir = os.path.join(os.path.dirname(resource_dir), 'Frameworks')
all_scripts = scripts['console'] + scripts['gui'] all_scripts = scripts['console'] + scripts['gui']
@ -235,7 +242,7 @@ _check_symlinks_prescript()
path = os.path.join(loader_path, name) path = os.path.join(loader_path, name)
print 'Creating loader:', path print 'Creating loader:', path
f = open(path, 'w') f = open(path, 'w')
f.write(BuildAPP.LOADER_TEMPLATE % dict(module=module, f.write(BuildAPP.LOADER_TEMPLATE % dict(module=module,
function=function)) function=function))
f.close() f.close()
os.chmod(path, stat.S_IXUSR|stat.S_IXGRP|stat.S_IXOTH|stat.S_IREAD\ os.chmod(path, stat.S_IXUSR|stat.S_IXGRP|stat.S_IXOTH|stat.S_IREAD\
@ -256,6 +263,12 @@ _check_symlinks_prescript()
shutil.rmtree(dst) shutil.rmtree(dst)
shutil.copytree('/usr/local/etc/fonts', dst, symlinks=False) shutil.copytree('/usr/local/etc/fonts', dst, symlinks=False)
print
print 'Adding libxml2'
for f in glob.glob(os.path.expanduser('~/libxml2/*')):
shutil.copyfile(f, os.path.join(frameworks_dir, os.path.basename(f)))
self.fix_lxml_dependencies(resource_dir)
print print
print 'Adding IPython' print 'Adding IPython'
dst = os.path.join(resource_dir, 'lib', 'python2.5', 'IPython') dst = os.path.join(resource_dir, 'lib', 'python2.5', 'IPython')
@ -313,12 +326,12 @@ def main():
'iconfile' : 'icons/library.icns', 'iconfile' : 'icons/library.icns',
'frameworks': ['libusb.dylib', 'libunrar.dylib'], 'frameworks': ['libusb.dylib', 'libunrar.dylib'],
'includes' : ['sip', 'pkg_resources', 'PyQt4.QtXml', 'includes' : ['sip', 'pkg_resources', 'PyQt4.QtXml',
'PyQt4.QtSvg', 'PyQt4.QtWebKit', 'PyQt4.QtSvg', 'PyQt4.QtWebKit', 'commands',
'mechanize', 'ClientForm', 'usbobserver', 'mechanize', 'ClientForm', 'usbobserver',
'genshi', 'calibre.web.feeds.recipes.*', 'genshi', 'calibre.web.feeds.recipes.*',
'calibre.ebooks.lrf.any.*', 'calibre.ebooks.lrf.feeds.*', 'calibre.ebooks.lrf.any.*', 'calibre.ebooks.lrf.feeds.*',
'keyword', 'codeop', 'pydoc', 'readline'], 'keyword', 'codeop', 'pydoc', 'readline'],
'packages' : ['PIL', 'Authorization', 'rtf2xml', 'lxml'], 'packages' : ['PIL', 'Authorization', 'lxml'],
'excludes' : ['IPython'], 'excludes' : ['IPython'],
'plist' : { 'CFBundleGetInfoString' : '''calibre, an E-book management application.''' 'plist' : { 'CFBundleGetInfoString' : '''calibre, an E-book management application.'''
''' Visit http://calibre.kovidgoyal.net for details.''', ''' Visit http://calibre.kovidgoyal.net for details.''',

View File

@ -14,6 +14,9 @@ from calibre.startup import get_lang
from calibre.utils.config import Config, ConfigProxy, dynamic from calibre.utils.config import Config, ConfigProxy, dynamic
import calibre.resources as resources import calibre.resources as resources
if isosx:
from lxml import html # Needed otherwise the GUI segfaults
NONE = QVariant() #: Null value to return from the data function of item models NONE = QVariant() #: Null value to return from the data function of item models
def _config(): def _config():

View File

@ -108,7 +108,7 @@ class _Canvas(QGraphicsRectItem):
line = block.peek() line = block.peek()
y += block.bs.topskip y += block.bs.topskip
block_consumed = False block_consumed = False
line.height = min(line.height, self.max_y-y) # LRF files from TOR have Plot elements with their height set to 800 line.height = min(line.height, self.max_y-block.bs.topskip) # LRF files from TOR have Plot elements with their height set to 800
while y + line.height <= self.max_y: while y + line.height <= self.max_y:
block.commit() block.commit()
if isinstance(line, QGraphicsItem): if isinstance(line, QGraphicsItem):

View File

@ -1,5 +1,6 @@
__license__ = 'GPL v3' __license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>' __copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
from lxml import html # Needed otherwise the GUI segfaults on OS X
import os, sys, textwrap, collections, traceback, time, re import os, sys, textwrap, collections, traceback, time, re
from xml.parsers.expat import ExpatError from xml.parsers.expat import ExpatError
from functools import partial from functools import partial