Windows 64bit build: Fix corrupted images in MOBI files causing crash. Fixes #1264534 [calibre-parallel has stopped working](https://bugs.launchpad.net/calibre/+bug/1264534)

Loads the PIL C extensions from the file system as they apparently use
exceptions that cause crash with MemoryModule
This commit is contained in:
Kovid Goyal 2013-12-31 10:20:33 +05:30
parent 25f8ba4abd
commit 78911d6077
2 changed files with 11 additions and 1 deletions

View File

@ -671,7 +671,10 @@ class Win32Freeze(Command, WixMixIn):
sp = self.j(self.lib_dir, 'site-packages')
# Special handling for PIL and pywin32
handled = set(['PIL.pth', 'pywin32.pth', 'PIL', 'win32'])
if not is64bit:
if is64bit:
# PIL can raise exceptions, which cause crashes on 64bit
shutil.copytree(self.j(sp, 'PIL'), self.j(self.dll_dir, 'PIL'))
else:
self.add_to_zipfile(zf, 'PIL', sp)
base = self.j(sp, 'win32', 'lib')
for x in os.listdir(base):

View File

@ -414,6 +414,13 @@ Build and install with::
Note that the lcms module will not be built. PIL requires lcms-1.x but only
lcms-2.x can be compiled as a 64 bit library.
Pillow >= 2.2 installs itself as a .egg file. calibre needs it to be a PIL
directory. Extract the PIL directory as follows:
cd /cygdrive/c/Python27/Lib/site-packages
mkdir p && cd p
unzip ../Pillow-*.egg
cd .. && rm Pillow-*.egg && mv p/PIL . && chmod +x PIL/*.pyd
Test it on the target system with
calibre-debug -c "from PIL import Image; import _imaging, _imagingmath, _imagingft"