diff --git a/src/calibre/constants.py b/src/calibre/constants.py index 0444550597..a4a35210ed 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.84b5' +__version__ = '0.4.84b6' __author__ = "Kovid Goyal " ''' Various run time constants. @@ -16,7 +16,7 @@ terminal_controller = TerminalController(sys.stdout) iswindows = 'win32' in sys.platform.lower() or 'win64' in sys.platform.lower() isosx = 'darwin' in sys.platform.lower() islinux = not(iswindows or isosx) -isfrozen = hasattr(sys, 'frozen') +isfrozen = hasattr(sys, 'frozen') try: preferred_encoding = locale.getpreferredencoding() diff --git a/src/calibre/ebooks/lrf/html/convert_from.py b/src/calibre/ebooks/lrf/html/convert_from.py index b79dbe3bee..456cfc409f 100644 --- a/src/calibre/ebooks/lrf/html/convert_from.py +++ b/src/calibre/ebooks/lrf/html/convert_from.py @@ -1446,7 +1446,7 @@ class HTMLConverter(object, LoggingInterface): pass if not self.disable_chapter_detection and \ (self.chapter_attr[0].match(tagname) and \ - (self.chapter_attr[1].pattern.lower() == 'none' or \ + (self.chapter_attr[1].lower() == 'none' or \ (tag.has_key(self.chapter_attr[1]) and \ self.chapter_attr[2].match(tag[self.chapter_attr[1]])))): self.log_debug('Detected chapter %s', tagname) diff --git a/src/calibre/gui2/images/add_book.svg b/src/calibre/gui2/images/add_book.svg index a2b1a1901d..b0633d48d3 100644 --- a/src/calibre/gui2/images/add_book.svg +++ b/src/calibre/gui2/images/add_book.svg @@ -1991,7 +1991,7 @@ cx="343.99899" rx="8.0010004" r="36" - style="fill:url(#linearGradient5167);fill-opacity:1" + style="fill-opacity:1" sodipodi:cx="343.99899" sodipodi:cy="92" sodipodi:rx="36" diff --git a/src/calibre/library/database2.py b/src/calibre/library/database2.py index 1e3b577ead..b28406dca4 100644 --- a/src/calibre/library/database2.py +++ b/src/calibre/library/database2.py @@ -274,6 +274,7 @@ class LibraryDatabase2(LibraryDatabase): if not os.path.exists(tpath): os.makedirs(tpath) spath = os.path.join(self.library_path, *current_path.split('/')) + if current_path and os.path.exists(spath): # Migrate existing files cdata = self.cover(id, index_is_id=True) if cdata is not None: @@ -288,11 +289,13 @@ class LibraryDatabase2(LibraryDatabase): self.conn.execute('UPDATE books SET path=? WHERE id=?', (path, id)) self.conn.commit() # Delete not needed directories + norm = lambda x : os.path.abspath(os.path.normcase(x)) if current_path and os.path.exists(spath): - shutil.rmtree(spath) - parent = os.path.dirname(spath) - if len(os.listdir(parent)) == 0: - shutil.rmtree(parent) + if norm(spath) != norm(tpath): + shutil.rmtree(spath) + parent = os.path.dirname(spath) + if len(os.listdir(parent)) == 0: + shutil.rmtree(parent) def cover(self, index, index_is_id=False, as_file=False, as_image=False): ''' @@ -382,7 +385,8 @@ class LibraryDatabase2(LibraryDatabase): def remove_format(self, index, format, index_is_id=False): id = index if index_is_id else self.id(index) path = os.path.join(self.library_path, self.path(id, index_is_id=True)) - name = self.conn.execute('SELECT name FROM data WHERE book=? AND format=?', (id, format)).fetchone()[0] + name = self.conn.execute('SELECT name FROM data WHERE book=? AND format=?', (id, format)).fetchone() + name = name[0] if name else False if name: ext = ('.' + format.lower()) if format else '' path = os.path.join(path, name+ext) diff --git a/upload.py b/upload.py index eede28bec1..70c2d7db3f 100644 --- a/upload.py +++ b/upload.py @@ -102,7 +102,7 @@ def build_osx(shutdown=True): def build_linux(shutdown=True): installer = installer_name('tar.bz2') vm = '/vmware/linux/libprs500-gentoo.vmx' - start_vm(vm, 'linux', (BUILD_SCRIPT%('sudo python setup.py develop', 'python','installer/linux/freeze.py')).replace('rm ', 'sudo rm ')) + start_vm(vm, 'linux', (BUILD_SCRIPT%('sudo python setup.py develop', 'python','installer/linux/freeze.py')).replace('rm ', 'sudo rm '), sleep=100) subprocess.check_call(('scp', 'linux:/tmp/%s'%os.path.basename(installer), 'dist')) if not os.path.exists(installer): raise Exception('Failed to build installer '+installer)