This commit is contained in:
Kovid Goyal 2008-07-30 15:49:26 -07:00
parent 8944c7e984
commit a05d1b3614
3 changed files with 30 additions and 15 deletions

View File

@ -267,6 +267,15 @@ _check_symlinks_prescript()
dst = os.path.join(resource_dir, 'lib', 'python2.5', 'IPython') dst = os.path.join(resource_dir, 'lib', 'python2.5', 'IPython')
if os.path.exists(dst): shutil.rmtree(dst) if os.path.exists(dst): shutil.rmtree(dst)
shutil.copytree(os.path.expanduser('~/build/ipython/IPython'), dst) shutil.copytree(os.path.expanduser('~/build/ipython/IPython'), dst)
print
print 'Adding ImageMagick'
dest = os.path.join(frameworks_dir, 'ImageMagick')
if os.path.exists(dest):
sutil.rmtree(dest)
shutil.copytree(os.path.expanduser('~/ImageMagick'), dest, True)
shutil.copyfile('/usr/local/lib/libpng12.0.dylib', os.path.join(dest, 'lib', 'libpng12.0.dylib'))
print print
print 'Installing prescipt' print 'Installing prescipt'
sf = [os.path.basename(s) for s in all_names] sf = [os.path.basename(s) for s in all_names]

View File

@ -16,20 +16,24 @@ from calibre.ptempfile import PersistentTemporaryDirectory
from calibre.utils.threadpool import ThreadPool, WorkRequest from calibre.utils.threadpool import ThreadPool, WorkRequest
from calibre.utils.terminfo import ProgressBar from calibre.utils.terminfo import ProgressBar
from calibre.ebooks.lrf.pylrs.pylrs import Book, BookSetting, ImageStream, ImageBlock from calibre.ebooks.lrf.pylrs.pylrs import Book, BookSetting, ImageStream, ImageBlock
from calibre.utils.PythonMagickWand import \ try:
NewMagickWand, NewPixelWand, \ from calibre.utils.PythonMagickWand import \
MagickSetImageBorderColor, \ NewMagickWand, NewPixelWand, \
MagickReadImage, MagickRotateImage, \ MagickSetImageBorderColor, \
MagickTrimImage, \ MagickReadImage, MagickRotateImage, \
MagickNormalizeImage, MagickGetImageWidth, \ MagickTrimImage, \
MagickGetImageHeight, \ MagickNormalizeImage, MagickGetImageWidth, \
MagickResizeImage, MagickSetImageType, \ MagickGetImageHeight, \
GrayscaleType, CatromFilter, MagickSetImagePage, \ MagickResizeImage, MagickSetImageType, \
MagickBorderImage, MagickSharpenImage, \ GrayscaleType, CatromFilter, MagickSetImagePage, \
MagickQuantizeImage, RGBColorspace, \ MagickBorderImage, MagickSharpenImage, \
MagickWriteImage, DestroyPixelWand, \ MagickQuantizeImage, RGBColorspace, \
DestroyMagickWand, CloneMagickWand, \ MagickWriteImage, DestroyPixelWand, \
MagickThumbnailImage, MagickCropImage, initialize, finalize DestroyMagickWand, CloneMagickWand, \
MagickThumbnailImage, MagickCropImage, initialize, finalize
_imagemagick_loaded = True
except:
_imagemagick_loaded = False
PROFILES = { PROFILES = {
'prs500':(584, 754), 'prs500':(584, 754),
@ -198,6 +202,8 @@ def process_pages(pages, opts, update):
''' '''
Render all identified comic pages. Render all identified comic pages.
''' '''
if not _imagemagick_loaded:
raise RuntimeError('Failed to load ImageMagick')
initialize() initialize()
try: try:
tdir = PersistentTemporaryDirectory('_comic2lrf_pp') tdir = PersistentTemporaryDirectory('_comic2lrf_pp')

2
src/calibre/utils/PythonMagickWand.py Executable file → Normal file
View File

@ -73,7 +73,7 @@ isosx = 'darwin' in sys.platform
isfrozen = getattr(sys, 'frozen', False) isfrozen = getattr(sys, 'frozen', False)
if isosx: if isosx:
_lib = os.path.join(getattr(sys, 'frameworks_dir'), 'ImageMagick', 'libWand.dylib') \ _lib = os.path.join(getattr(sys, 'frameworks_dir'), 'ImageMagick', 'libMagickWand.dylib') \
if isfrozen else util.find_library('Wand') if isfrozen else util.find_library('Wand')
elif iswindows: elif iswindows:
_lib = os.path.join(os.path.dirname(sys.executable), 'ImageMagick', 'CORE_RL_wand_.dll') \ _lib = os.path.join(os.path.dirname(sys.executable), 'ImageMagick', 'CORE_RL_wand_.dll') \