diff --git a/installer/osx/freeze.py b/installer/osx/freeze.py index a57b3ce375..289f00e3fb 100644 --- a/installer/osx/freeze.py +++ b/installer/osx/freeze.py @@ -150,9 +150,9 @@ _check_symlinks_prescript() if not match: print dep raise Exception('Unknown Qt dependency') - module = match.group(1) + module = match.group(1) 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) @@ -218,9 +218,16 @@ _check_symlinks_prescript() 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): py2app.run(self) - resource_dir = os.path.join(self.dist_dir, + resource_dir = os.path.join(self.dist_dir, APPNAME + '.app', 'Contents', 'Resources') frameworks_dir = os.path.join(os.path.dirname(resource_dir), 'Frameworks') all_scripts = scripts['console'] + scripts['gui'] @@ -235,7 +242,7 @@ _check_symlinks_prescript() path = os.path.join(loader_path, name) print 'Creating loader:', path f = open(path, 'w') - f.write(BuildAPP.LOADER_TEMPLATE % dict(module=module, + f.write(BuildAPP.LOADER_TEMPLATE % dict(module=module, function=function)) f.close() 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.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 'Adding IPython' dst = os.path.join(resource_dir, 'lib', 'python2.5', 'IPython') @@ -313,12 +326,12 @@ def main(): 'iconfile' : 'icons/library.icns', 'frameworks': ['libusb.dylib', 'libunrar.dylib'], 'includes' : ['sip', 'pkg_resources', 'PyQt4.QtXml', - 'PyQt4.QtSvg', 'PyQt4.QtWebKit', + 'PyQt4.QtSvg', 'PyQt4.QtWebKit', 'commands', 'mechanize', 'ClientForm', 'usbobserver', 'genshi', 'calibre.web.feeds.recipes.*', 'calibre.ebooks.lrf.any.*', 'calibre.ebooks.lrf.feeds.*', 'keyword', 'codeop', 'pydoc', 'readline'], - 'packages' : ['PIL', 'Authorization', 'rtf2xml', 'lxml'], + 'packages' : ['PIL', 'Authorization', 'lxml'], 'excludes' : ['IPython'], 'plist' : { 'CFBundleGetInfoString' : '''calibre, an E-book management application.''' ''' Visit http://calibre.kovidgoyal.net for details.''', diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py index df2596564b..83c9caefcc 100644 --- a/src/calibre/gui2/__init__.py +++ b/src/calibre/gui2/__init__.py @@ -14,6 +14,9 @@ from calibre.startup import get_lang from calibre.utils.config import Config, ConfigProxy, dynamic 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 def _config(): diff --git a/src/calibre/gui2/lrf_renderer/document.py b/src/calibre/gui2/lrf_renderer/document.py index 031b19f6f4..691e1481ee 100644 --- a/src/calibre/gui2/lrf_renderer/document.py +++ b/src/calibre/gui2/lrf_renderer/document.py @@ -108,7 +108,7 @@ class _Canvas(QGraphicsRectItem): line = block.peek() y += block.bs.topskip 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: block.commit() if isinstance(line, QGraphicsItem): diff --git a/src/calibre/gui2/main.py b/src/calibre/gui2/main.py index 030d3e0250..6837457388 100644 --- a/src/calibre/gui2/main.py +++ b/src/calibre/gui2/main.py @@ -1,5 +1,6 @@ __license__ = 'GPL v3' __copyright__ = '2008, Kovid Goyal ' +from lxml import html # Needed otherwise the GUI segfaults on OS X import os, sys, textwrap, collections, traceback, time, re from xml.parsers.expat import ExpatError from functools import partial