From 42e6fb932b7b23fd180598873e92866de1e72ff6 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 18 Dec 2008 13:20:38 -0800 Subject: [PATCH 1/7] Fix device detection on OS X when users have a customized environment.plist --- src/calibre/devices/prs505/driver.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/calibre/devices/prs505/driver.py b/src/calibre/devices/prs505/driver.py index dd4b8d575a..0f60d7238b 100644 --- a/src/calibre/devices/prs505/driver.py +++ b/src/calibre/devices/prs505/driver.py @@ -19,10 +19,10 @@ class File(object): self.is_readonly = not os.access(path, os.W_OK) self.ctime = stats.st_ctime self.wtime = stats.st_mtime - self.size = stats.st_size - if path.endswith(os.sep): + self.size = stats.st_size + if path.endswith(os.sep): path = path[:-1] - self.path = path + self.path = path self.name = os.path.basename(path) @@ -108,7 +108,10 @@ class PRS505(Device): @classmethod def get_osx_mountpoints(cls, raw=None): if raw is None: - raw = subprocess.Popen('ioreg -w 0 -S -c IOMedia'.split(), + ioreg = '/usr/sbin/ioreg' + if not os.access(ioreg, os.X_OK): + ioreg = 'ioreg' + raw = subprocess.Popen((ioreg+' -w 0 -S -c IOMedia').split(), stdout=subprocess.PIPE).stdout.read() lines = raw.splitlines() names = {} From 75f2a220bc1d52aba229f590f62ba4eb0f25feff Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 18 Dec 2008 14:25:42 -0800 Subject: [PATCH 2/7] Strip soft hyphens before creating LRF as the SONY LRF renderer renders them as hard hyphens --- src/calibre/ebooks/lrf/html/convert_from.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/ebooks/lrf/html/convert_from.py b/src/calibre/ebooks/lrf/html/convert_from.py index 8eeff46d79..ae2ab233a5 100644 --- a/src/calibre/ebooks/lrf/html/convert_from.py +++ b/src/calibre/ebooks/lrf/html/convert_from.py @@ -813,7 +813,7 @@ class HTMLConverter(object, LoggingInterface): def append_text(src): fp, key, variant = self.font_properties(css) - for x, y in [(u'\xa0', ' '), (u'\ufb00', 'ff'), (u'\ufb01', 'fi'), (u'\ufb02', 'fl'), (u'\ufb03', 'ffi'), (u'\ufb04', 'ffl')]: + for x, y in [(u'\xad', ''), (u'\xa0', ' '), (u'\ufb00', 'ff'), (u'\ufb01', 'fi'), (u'\ufb02', 'fl'), (u'\ufb03', 'ffi'), (u'\ufb04', 'ffl')]: src = src.replace(x, y) valigner = lambda x: x From 092cc40e1f7584daeedca0770820578364540cdd Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 18 Dec 2008 14:29:15 -0800 Subject: [PATCH 3/7] version 0.4.117 --- src/calibre/constants.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/constants.py b/src/calibre/constants.py index d49f97f48e..01f77f9cfb 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.116' +__version__ = '0.4.117' __author__ = "Kovid Goyal " ''' Various run time constants. From 4ce36e8225f00ad9c783c359158d1b4b65233603 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 18 Dec 2008 14:36:13 -0800 Subject: [PATCH 4/7] IGN:Tag release From 99bdab5d699f740b053f6201e3e57de64c9c1d0f Mon Sep 17 00:00:00 2001 From: "Marshall T. Vandegrift" Date: Thu, 18 Dec 2008 22:31:23 -0500 Subject: [PATCH 5/7] Fix Windows LZX compression endianness bug --- src/calibre/utils/lzx/lzxc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/calibre/utils/lzx/lzxc.c b/src/calibre/utils/lzx/lzxc.c index 1617e544d2..626c829480 100644 --- a/src/calibre/utils/lzx/lzxc.c +++ b/src/calibre/utils/lzx/lzxc.c @@ -32,9 +32,11 @@ #include #include -#if BYTE_ORDER == BIG_ENDIAN -#define LZX_BIG_ENDIAN -#endif +#ifdef BYTE_ORDER +# if BYTE_ORDER == BIG_ENDIAN +# define LZX_BIG_ENDIAN +# endif /* BYTE_ORDER == BIG_ENDIAN */ +#endif /* BYTE_ORDER */ #ifdef NONSLIDE #include "lzc.h" From 9a30cdc3f2a7812ffc1d4b3a30ac6d4fe33e2616 Mon Sep 17 00:00:00 2001 From: "Marshall T. Vandegrift" Date: Thu, 18 Dec 2008 22:37:04 -0500 Subject: [PATCH 6/7] Fix invalid /guide/reference detection bug. --- src/calibre/ebooks/lit/oeb.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/lit/oeb.py b/src/calibre/ebooks/lit/oeb.py index 339783f350..9bf1eb8c82 100644 --- a/src/calibre/ebooks/lit/oeb.py +++ b/src/calibre/ebooks/lit/oeb.py @@ -583,7 +583,8 @@ class OEBBook(object): self.guide = guide = Guide(self) for elem in xpath(opf, '/o2:package/o2:guide/o2:reference'): href = elem.get('href') - if href not in self.manifest.hrefs: + path, frag = urldefrag(href) + if path not in self.manifest.hrefs: self.logger.log_warn(u'Guide reference %r not found' % href) continue guide.add(elem.get('type'), elem.get('title'), href) From 6550c18745c5eb6b4b424f5a9b9bcb96fa5fe6d2 Mon Sep 17 00:00:00 2001 From: "Marshall T. Vandegrift" Date: Thu, 18 Dec 2008 22:51:25 -0500 Subject: [PATCH 7/7] Detect an NCX TOC which isn't mentioned by the /spine/@toc. --- src/calibre/ebooks/lit/oeb.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/lit/oeb.py b/src/calibre/ebooks/lit/oeb.py index 9bf1eb8c82..acc3275876 100644 --- a/src/calibre/ebooks/lit/oeb.py +++ b/src/calibre/ebooks/lit/oeb.py @@ -602,7 +602,10 @@ class OEBBook(object): def _toc_from_ncx(self, opf): result = xpath(opf, '/o2:package/o2:spine/@toc') if not result: - return False + expr = '/o2:package/o2:manifest/o2:item[@media-type="%s"]/@id' + result = xpath(opf, expr % NCX_MIME) + if len(result) != 1: + return False id = result[0] ncx = self.manifest[id].data self.manifest.remove(id)