diff --git a/.pydevproject b/.pydevproject
index 416319d077..fba36e6fb7 100644
--- a/.pydevproject
+++ b/.pydevproject
@@ -5,9 +5,5 @@
python 2.5
/calibre/src
-/calibre/devices
-/calibre/libprs500.devices.prs500
-/calibre/prs500
-/calibre/gui2
diff --git a/installer/linux/freeze.py b/installer/linux/freeze.py
index 7fa6e4bbd6..4fdeb69c37 100644
--- a/installer/linux/freeze.py
+++ b/installer/linux/freeze.py
@@ -122,6 +122,8 @@ def freeze():
elif exe not in executables:
print >>sys.stderr, 'Invalid invocation of calibre loader. CALIBRE_CX_EXE=%%s is unknown'%%exe
else:
+ from PyQt4.QtCore import QCoreApplication
+ QCoreApplication.setLibraryPaths([sys.frozen_path, os.path.join(sys.frozen_path, "qtplugins")])
sys.argv[0] = exe
module, func = executables[exe]
module = __import__(module, fromlist=[1])
@@ -179,7 +181,7 @@ def freeze():
if not f.endswith('.so') or 'designer' in dirpath or 'codecs' in dirpath or 'sqldrivers' in dirpath:
continue
f = os.path.join(dirpath, f)
- dest_dir = dirpath.replace(plugdir, os.path.join(FREEZE_DIR, 'qtlugins'))
+ dest_dir = dirpath.replace(plugdir, os.path.join(FREEZE_DIR, 'qtplugins'))
copy_binary(f, dest_dir)
print 'Creating launchers'
diff --git a/src/calibre/constants.py b/src/calibre/constants.py
index 101f97f277..0bccd77c44 100644
--- a/src/calibre/constants.py
+++ b/src/calibre/constants.py
@@ -2,7 +2,7 @@ __license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net'
__docformat__ = 'restructuredtext en'
__appname__ = 'calibre'
-__version__ = '0.4.113'
+__version__ = '0.4.115'
__author__ = "Kovid Goyal "
'''
Various run time constants.
diff --git a/src/calibre/ebooks/epub/__init__.py b/src/calibre/ebooks/epub/__init__.py
index 7bd6eeab50..f1a60ab646 100644
--- a/src/calibre/ebooks/epub/__init__.py
+++ b/src/calibre/ebooks/epub/__init__.py
@@ -88,10 +88,10 @@ def initialize_container(path_to_container, opf_name='metadata.opf'):
zf.writestr('META-INF/container.xml', CONTAINER)
return zf
-def config(defaults=None):
+def config(defaults=None, name='epub'):
desc = _('Options to control the conversion to EPUB')
if defaults is None:
- c = Config('epub', desc)
+ c = Config(name, desc)
else:
c = StringConfig(defaults, desc)
diff --git a/src/calibre/ebooks/epub/from_any.py b/src/calibre/ebooks/epub/from_any.py
index b5c1f48937..6cf56aa43c 100644
--- a/src/calibre/ebooks/epub/from_any.py
+++ b/src/calibre/ebooks/epub/from_any.py
@@ -116,7 +116,8 @@ def unarchive(path, tdir):
return f, ext
return find_html_index(files)
-def any2epub(opts, path, notification=None):
+def any2epub(opts, path, notification=None, create_epub=True,
+ oeb_cover=False, extract_to=None):
ext = os.path.splitext(path)[1]
if not ext:
raise ValueError('Unknown file type: '+path)
@@ -139,7 +140,9 @@ def any2epub(opts, path, notification=None):
raise ValueError('Conversion from %s is not supported'%ext.upper())
print 'Creating EPUB file...'
- html2epub(path, opts, notification=notification)
+ html2epub(path, opts, notification=notification,
+ create_epub=create_epub, oeb_cover=oeb_cover,
+ extract_to=extract_to)
def config(defaults=None):
return common_config(defaults=defaults)
@@ -148,14 +151,14 @@ def config(defaults=None):
def formats():
return ['html', 'rar', 'zip', 'oebzip']+list(MAP.keys())
-def option_parser():
-
- return config().option_parser(usage=_('''\
+USAGE = _('''\
%%prog [options] filename
-Convert any of a large number of ebook formats to an epub file. Supported formats are: %s
-''')%formats()
-)
+Convert any of a large number of ebook formats to a %s file. Supported formats are: %s
+''')
+
+def option_parser(usage=USAGE):
+ return config().option_parser(usage=usage%('EPUB', formats()))
def main(args=sys.argv):
parser = option_parser()
diff --git a/src/calibre/ebooks/epub/from_html.py b/src/calibre/ebooks/epub/from_html.py
index 66a3cebbae..d62bb936b2 100644
--- a/src/calibre/ebooks/epub/from_html.py
+++ b/src/calibre/ebooks/epub/from_html.py
@@ -32,14 +32,14 @@ Conversion of HTML/OPF files follows several stages:
* The EPUB container is created.
'''
-import os, sys, cStringIO, logging, re, functools
+import os, sys, cStringIO, logging, re, functools, shutil
from lxml.etree import XPath
from lxml import html
from PyQt4.Qt import QApplication, QPixmap
from calibre.ebooks.html import Processor, merge_metadata, get_filelist,\
- opf_traverse, create_metadata, rebase_toc, Link
+ opf_traverse, create_metadata, rebase_toc, Link, parser
from calibre.ebooks.epub import config as common_config, tostring
from calibre.ptempfile import TemporaryDirectory
from calibre.ebooks.metadata.toc import TOC
@@ -62,9 +62,10 @@ def remove_bad_link(element, attribute, link, pos):
def check(opf_path, pretty_print):
'''
- Find a remove all invalid links in the HTML files
+ Find and remove all invalid links in the HTML files
'''
- print '\tChecking files for bad links...'
+ logger = logging.getLogger('html2epub')
+ logger.info('\tChecking files for bad links...')
pathtoopf = os.path.abspath(opf_path)
with CurrentDir(os.path.dirname(pathtoopf)):
opf = OPF(open(pathtoopf, 'rb'), os.path.dirname(pathtoopf))
@@ -76,7 +77,7 @@ def check(opf_path, pretty_print):
for path in html_files:
base = os.path.dirname(path)
- root = html.fromstring(open(content(path), 'rb').read())
+ root = html.fromstring(open(content(path), 'rb').read(), parser=parser)
for element, attribute, link, pos in list(root.iterlinks()):
link = to_unicode(link)
plink = Link(link, base)
@@ -209,17 +210,16 @@ TITLEPAGE = '''\