Sync to trunk.

This commit is contained in:
John Schember 2009-08-31 07:23:26 -04:00
commit 681fcf1f4d
9 changed files with 46 additions and 40 deletions

View File

@ -52,7 +52,7 @@ def freeze():
'/usr/lib/libxslt.so.1',
'/usr/lib/libgthread-2.0.so.0',
'/usr/lib/gcc/***-pc-linux-gnu/4.4.1/libstdc++.so.6'.replace('***',
arch).replace('i686', 'i486'),
arch),
'/usr/lib/libpng12.so.0',
'/usr/lib/libexslt.so.0',
'/usr/lib/libMagickWand.so',

View File

@ -35,12 +35,12 @@ class PRS505(CLI, Device):
VENDOR_NAME = 'SONY'
WINDOWS_MAIN_MEM = re.compile('PRS-(505|300)')
WINDOWS_CARD_A_MEM = re.compile(r'PRS-(505|300)/\S+:MS')
WINDOWS_CARD_B_MEM = re.compile(r'PRS-(505|300)/\S+:SD')
WINDOWS_CARD_A_MEM = re.compile(r'PRS-505/\S+:MS')
WINDOWS_CARD_B_MEM = re.compile(r'PRS-505/\S+:SD')
OSX_MAIN_MEM = re.compile(r'Sony PRS-(505|300)/[^:]+ Media')
OSX_CARD_A_MEM = re.compile(r'Sony PRS-(505|300)/[^:]+:MS Media')
OSX_CARD_B_MEM = re.compile(r'Sony PRS-(505|300)/[^:]+:SD Media')
OSX_CARD_A_MEM = re.compile(r'Sony PRS-505/[^:]+:MS Media')
OSX_CARD_B_MEM = re.compile(r'Sony PRS-505/[^:]+:SD Media')
MAIN_MEMORY_VOLUME_LABEL = 'Sony Reader Main Memory'
STORAGE_CARD_VOLUME_LABEL = 'Sony Reader Storage Card'

View File

@ -58,8 +58,8 @@ class DeviceScanner(object):
def __init__(self, *args):
if isosx and osx_scanner is None:
raise RuntimeError('The Python extension usbobserver must be available on OS X.')
if not (isosx or iswindows) and not os.access(_DEVICES, os.R_OK):
raise RuntimeError('DeviceScanner requires %s to work.'%_DEVICES)
if not (isosx or iswindows) and (not os.access(_DEVICES, os.R_OK) and not libusb.has_library):
raise RuntimeError('DeviceScanner requires %s or libusb to work.'%_DEVICES)
self.scanner = win_scanner if iswindows else osx_scanner if isosx else linux_scanner
self.devices = []

View File

@ -50,7 +50,7 @@ class Reader132(FormatReader):
def __init__(self, header, stream, log, options):
self.log = log
self.encoding = options.input_encoding
self.log.debug('132 byte header version found.')
self.sections = []
@ -105,7 +105,10 @@ class Reader132(FormatReader):
if not os.path.exists(output_dir):
os.makedirs(output_dir)
html = u'<html><head><title>%s</title></head><body>' % self.mi.title.decode('utf-8', 'replace')
title = self.mi.title
if not isinstance(title, unicode):
title = title.decode('utf-8', 'replace')
html = u'<html><head><title>%s</title></head><body>' % title
pml = u''
for i in range(1, self.header_record.num_text_pages + 1):

View File

@ -92,8 +92,12 @@ class Reader202(FormatReader):
self.log.debug('Extracting text page %i' % i)
pml += self.get_text_page(i)
title = self.mi.title
if not isinstance(title, unicode):
title = title.decode('utf-8', 'replace')
html = u'<html><head><title>%s</title></head><body>%s</body></html>' % \
(self.mi.title.decode('utf-8', 'replace'), pml_to_html(pml))
(title, pml_to_html(pml))
with CurrentDir(output_dir):
with open('index.html', 'wb') as index:

View File

@ -1703,10 +1703,14 @@ books_series_link feeds
ndb = DBThread(dest, None)
ndb.connect()
conn = ndb.conn
conn.execute('create table temp_sequence(id INTEGER PRIMARY KEY AUTOINCREMENT)')
conn.commit()
conn.executescript(sql)
conn.commit()
conn.execute('pragma user_version=%d'%user_version)
conn.commit()
conn.execute('drop table temp_sequence')
conn.commit()
conn.close()
except:
if conn is not None:

View File

@ -97,6 +97,8 @@ def get_components(template, mi, id, timefmt='%b %Y', length=250,
format_args['author_sort'] = mi.author_sort
if mi.tags:
format_args['tags'] = mi.format_tags()
if format_args['tags'].startswith('/'):
format_args['tags'] = format_args['tags'][1:]
if mi.series:
format_args['series'] = mi.series
if mi.series_index is not None:

View File

@ -808,6 +808,9 @@ class BasicNewsRecipe(Recipe):
'''
Create a generic cover for recipes that dont have a cover
'''
from calibre.gui2 import is_ok_to_use_qt
if not is_ok_to_use_qt():
return False
from calibre.gui2 import images_rc # Needed for access to logo
images_rc
if QApplication.instance() is None: QApplication([])
@ -868,6 +871,7 @@ class BasicNewsRecipe(Recipe):
else:
cover_file.write(renderer.data)
cover_file.flush()
return True
def create_opf(self, feeds, dir=None):
@ -892,8 +896,8 @@ class BasicNewsRecipe(Recipe):
cpath = getattr(self, 'cover_path', None)
if cpath is None:
pf = open(os.path.join(dir, 'cover.jpg'), 'wb')
self.default_cover(pf)
cpath = pf.name
if self.default_cover(pf):
cpath = pf.name
if cpath is not None and os.access(cpath, os.R_OK):
opf.cover = cpath
manifest.append(cpath)

View File

@ -487,7 +487,10 @@ def installer_name(ext):
ans = ans.replace('i686', 'x86_64')
return ans
def _build_linux():
class build_linux64(OptionlessCommand):
description = 'Build linux 64bit installer'
def run(self):
installer = installer_name('tar.bz2')
locals = {}
exec open('installer/linux/freeze.py') in locals
@ -496,12 +499,6 @@ def _build_linux():
raise Exception('Failed to build installer '+installer)
return os.path.basename(installer)
class build_linux64(OptionlessCommand):
description = 'Build linux 64bit installer'
def run(self):
return _build_linux()
class VMInstaller(OptionlessCommand):
user_options = [('dont-shutdown', 'd', 'Dont shutdown VM after build')]
@ -518,7 +515,7 @@ class VMInstaller(OptionlessCommand):
rsync -avz --exclude src/calibre/plugins \
--exclude calibre/src/calibre.egg-info --exclude docs \
--exclude .bzr --exclude .build --exclude build --exclude dist \
--exclude "*.pyc" --exclude "*.pyo" \
--exclude "*.pyc" --exclude "*.pyo" --exclude "*.swp" --exclude "*.swo" \
rsync://%(host)s/work/%(project)s . && \
cd %(project)s && \
%%s && \
@ -550,7 +547,7 @@ class VMInstaller(OptionlessCommand):
def run_vm(self):
self.__p = Popen(self.VM)
self.__p = Popen([self.VM])
def start_vm(self, ssh_host, build_script, sleep=75):
self.run_vm()
@ -576,28 +573,21 @@ class KVMInstaller(VMInstaller):
class build_linux32(KVMInstaller):
class build_linux32(VMInstaller):
description = 'Build linux 32bit installer'
VM = '/vmware/bin/linux_build'
def run_vm(self):
self.__p = Popen('/vmware/bin/linux_build')
VM = '/vmware/bin/gentoo32_build'
def run(self):
if is64bit:
installer = installer_name('tar.bz2').replace('x86_64', 'i686')
self.start_vm('linux_build', ('python setup.py build_ext',
'python', 'setup.py build_linux32'))
check_call(('scp', 'linux_build:build/calibre/dist/*.tar.bz2', 'dist'))
if not os.path.exists(installer):
raise Exception('Failed to build installer '+installer)
if not self.dont_shutdown:
Popen(('ssh', 'linux_build', 'sudo', '/sbin/poweroff'))
return os.path.basename(installer)
else:
return _build_linux()
installer = installer_name('tar.bz2').replace('x86_64', 'i686')
self.start_vm('gentoo32_build', ('sudo python setup.py develop && sudo chown -R kovid:users *',
'python', 'installer/linux/freeze.py'))
check_call(('scp', 'gentoo32_build:build/calibre/dist/*.dmg', 'dist'))
if not os.path.exists(installer):
raise Exception('Failed to build installer '+installer)
if not self.dont_shutdown:
Popen(('ssh', 'gentoo32_build', 'sudo', '/sbin/poweroff'))
return os.path.basename(installer)
class build_windows(VMInstaller):
description = 'Build windows installer'
@ -641,7 +631,6 @@ class build_osx(VMInstaller):
def run(self):
installer = installer_name('dmg')
python = '/Library/Frameworks/Python.framework/Versions/Current/bin/python'
self.start_vmware()
self.start_vm('tiger_build', ('sudo %s setup.py develop'%python, python,
'installer/osx/freeze.py'))
check_call(('scp', 'tiger_build:build/calibre/dist/*.dmg', 'dist'))