Merge remote-tracking branch 'upstream/master' into wiredfool-multiline_text

This commit is contained in:
hugovk 2015-12-06 18:05:25 +02:00
commit d52e58dbbd
21 changed files with 37 additions and 37 deletions

View File

@ -19,6 +19,7 @@ python:
- nightly - nightly
install: install:
- "travis_retry sudo apt-get update"
- "travis_retry sudo apt-get -qq install libfreetype6-dev liblcms2-dev python-qt4 ghostscript libffi-dev libjpeg-turbo-progs cmake imagemagick" - "travis_retry sudo apt-get -qq install libfreetype6-dev liblcms2-dev python-qt4 ghostscript libffi-dev libjpeg-turbo-progs cmake imagemagick"
- "travis_retry pip install cffi" - "travis_retry pip install cffi"
- "travis_retry pip install nose" - "travis_retry pip install nose"

View File

@ -4,6 +4,12 @@ Changelog (Pillow)
3.1.0 (unreleased) 3.1.0 (unreleased)
------------------ ------------------
- Docs and code health fixes #1565 #1566
[radarhere]
- Updated freetype to 2.6.2 #1564
[radarhere]
- Updated WebP to 0.4.4 for Travis #1515 - Updated WebP to 0.4.4 for Travis #1515
[radarhere] [radarhere]
@ -31,9 +37,6 @@ Changelog (Pillow)
- Added Usage message to painter script #1482 - Added Usage message to painter script #1482
[radarhere] [radarhere]
- Updated freetype to 2.6.1 #1479
[radarhere]
- Add tag info for iccprofile, fixes #1462. #1465 - Add tag info for iccprofile, fixes #1462. #1465
[wiredfool] [wiredfool]

View File

@ -151,7 +151,7 @@ def Ghostscript(tile, size, fp, scale=1):
os.unlink(outfile) os.unlink(outfile)
if infile_temp: if infile_temp:
os.unlink(infile_temp) os.unlink(infile_temp)
except: except OSError:
pass pass
return im return im

View File

@ -518,7 +518,7 @@ def _save_netpbm(im, fp, filename):
try: try:
os.unlink(file) os.unlink(file)
except: except OSError:
pass pass

View File

@ -550,7 +550,7 @@ class Image(object):
try: try:
self.fp.close() self.fp.close()
except Exception as msg: except Exception as msg:
logger.debug("Error closing: %s" % msg) logger.debug("Error closing: %s", msg)
# Instead of simply setting to None, we're setting up a # Instead of simply setting to None, we're setting up a
# deferred error that will better explain that the core image # deferred error that will better explain that the core image

View File

@ -16,6 +16,7 @@
# below for the original description. # below for the original description.
from __future__ import print_function from __future__ import print_function
import sys
DESCRIPTION = """ DESCRIPTION = """
pyCMS pyCMS
@ -240,7 +241,6 @@ def get_display_profile(handle=None):
:returns: None if the profile is not known. :returns: None if the profile is not known.
""" """
import sys
if sys.platform == "win32": if sys.platform == "win32":
from PIL import ImageWin from PIL import ImageWin
if isinstance(handle, ImageWin.HDC): if isinstance(handle, ImageWin.HDC):
@ -943,7 +943,6 @@ def versions():
(pyCMS) Fetches versions. (pyCMS) Fetches versions.
""" """
import sys
return ( return (
VERSION, core.littlecms_version, VERSION, core.littlecms_version,
sys.version.split()[0], Image.VERSION sys.version.split()[0], Image.VERSION
@ -954,10 +953,9 @@ def versions():
if __name__ == "__main__": if __name__ == "__main__":
# create a cheap manual from the __doc__ strings for the functions above # create a cheap manual from the __doc__ strings for the functions above
from PIL import ImageCms
print(__doc__) print(__doc__)
for f in dir(ImageCms): for f in dir(sys.modules[__name__]):
doc = None doc = None
try: try:
exec("doc = %s.__doc__" % (f)) exec("doc = %s.__doc__" % (f))

View File

@ -200,7 +200,6 @@ class MorphOp(object):
if image.mode != 'L': if image.mode != 'L':
raise Exception('Image must be binary, meaning it must use mode L') raise Exception('Image must be binary, meaning it must use mode L')
return
outimage = Image.new(image.mode, image.size, None) outimage = Image.new(image.mode, image.size, None)
count = _imagingmorph.apply( count = _imagingmorph.apply(
bytes(self.lut), image.im.id, outimage.im.id) bytes(self.lut), image.im.id, outimage.im.id)
@ -217,7 +216,6 @@ class MorphOp(object):
if image.mode != 'L': if image.mode != 'L':
raise Exception('Image must be binary, meaning it must use mode L') raise Exception('Image must be binary, meaning it must use mode L')
return
return _imagingmorph.match(bytes(self.lut), image.im.id) return _imagingmorph.match(bytes(self.lut), image.im.id)
def get_on_pixels(self, image): def get_on_pixels(self, image):
@ -228,7 +226,6 @@ class MorphOp(object):
if image.mode != 'L': if image.mode != 'L':
raise Exception('Image must be binary, meaning it must use mode L') raise Exception('Image must be binary, meaning it must use mode L')
return
return _imagingmorph.get_on_pixels(image.im.id) return _imagingmorph.get_on_pixels(image.im.id)
def load_lut(self, filename): def load_lut(self, filename):

View File

@ -179,7 +179,7 @@ class IptcImageFile(ImageFile.ImageFile):
finally: finally:
try: try:
os.unlink(outfile) os.unlink(outfile)
except: except OSError:
pass pass

View File

@ -379,7 +379,7 @@ class JpegImageFile(ImageFile.ImageFile):
finally: finally:
try: try:
os.unlink(path) os.unlink(path)
except: except OSError:
pass pass
self.mode = self.im.mode self.mode = self.im.mode
@ -699,7 +699,7 @@ def _save_cjpeg(im, fp, filename):
subprocess.check_call(["cjpeg", "-outfile", filename, tempfile]) subprocess.check_call(["cjpeg", "-outfile", filename, tempfile])
try: try:
os.unlink(tempfile) os.unlink(tempfile)
except: except OSError:
pass pass

View File

@ -152,7 +152,8 @@ class PILDriver(object):
self.push(Image.composite(image1, image2, mask)) self.push(Image.composite(image1, image2, mask))
def do_merge(self): def do_merge(self):
"""usage: merge <string:mode> <image:pic1> [<image:pic2> [<image:pic3> [<image:pic4>]]] """usage: merge <string:mode> <image:pic1>
[<image:pic2> [<image:pic3> [<image:pic4>]]]
Merge top-of stack images in a way described by the mode. Merge top-of stack images in a way described by the mode.
""" """
@ -181,7 +182,8 @@ class PILDriver(object):
self.dup() self.dup()
def do_crop(self): def do_crop(self):
"""usage: crop <int:left> <int:upper> <int:right> <int:lower> <image:pic1> """usage: crop <int:left> <int:upper> <int:right> <int:lower>
<image:pic1>
Crop and push a rectangular region from the current image. Crop and push a rectangular region from the current image.
""" """
@ -243,7 +245,8 @@ class PILDriver(object):
self.push(image.offset(xoff, yoff)) self.push(image.offset(xoff, yoff))
def do_paste(self): def do_paste(self):
"""usage: paste <image:figure> <int:xoffset> <int:yoffset> <image:ground> """usage: paste <image:figure> <int:xoffset> <int:yoffset>
<image:ground>
Paste figure image into ground with upper left at given offsets. Paste figure image into ground with upper left at given offsets.
""" """

View File

@ -6,7 +6,8 @@ iterations = 5000
""" """
When run on a system without the jpeg leak fixes, the valgrind runs look like this. When run on a system without the jpeg leak fixes,
the valgrind runs look like this.
NOSE_PROCESSES=0 NOSE_TIMEOUT=600 valgrind --tool=massif \ NOSE_PROCESSES=0 NOSE_TIMEOUT=600 valgrind --tool=massif \
python test-installed.py -s -v Tests/check_jpeg_leaks.py python test-installed.py -s -v Tests/check_jpeg_leaks.py

View File

@ -110,7 +110,7 @@ class TestFileTiff(PillowTestCase):
def test_bad_exif(self): def test_bad_exif(self):
i = Image.open('Tests/images/hopper_bad_exif.jpg') i = Image.open('Tests/images/hopper_bad_exif.jpg')
try: try:
self.assert_warning(UserWarning, lambda: i._getexif()) self.assert_warning(UserWarning, i._getexif)
except struct.error: except struct.error:
self.fail( self.fail(
"Bad EXIF data passed incorrect values to _binary unpack") "Bad EXIF data passed incorrect values to _binary unpack")

View File

@ -24,7 +24,7 @@ class TestImageSequence(PillowTestCase):
self.assertRaises(AttributeError, lambda: ImageSequence.Iterator(0)) self.assertRaises(AttributeError, lambda: ImageSequence.Iterator(0))
def _test_multipage_tiff(self, dbg=False): def _test_multipage_tiff(self):
im = Image.open('Tests/images/multipage.tiff') im = Image.open('Tests/images/multipage.tiff')
for index, frame in enumerate(ImageSequence.Iterator(im)): for index, frame in enumerate(ImageSequence.Iterator(im)):
frame.load() frame.load()
@ -32,8 +32,7 @@ class TestImageSequence(PillowTestCase):
frame.convert('RGB') frame.convert('RGB')
def test_tiff(self): def test_tiff(self):
# self._test_multipage_tiff(True) self._test_multipage_tiff()
self._test_multipage_tiff(False)
def test_libtiff(self): def test_libtiff(self):
codecs = dir(Image.core) codecs = dir(Image.core)
@ -42,8 +41,7 @@ class TestImageSequence(PillowTestCase):
self.skipTest("tiff support not available") self.skipTest("tiff support not available")
TiffImagePlugin.READ_LIBTIFF = True TiffImagePlugin.READ_LIBTIFF = True
# self._test_multipage_tiff(True) self._test_multipage_tiff()
self._test_multipage_tiff(False)
TiffImagePlugin.READ_LIBTIFF = False TiffImagePlugin.READ_LIBTIFF = False
if __name__ == '__main__': if __name__ == '__main__':

View File

@ -114,7 +114,7 @@ class TestImageWinDib(PillowTestCase):
# Act/Assert # Act/Assert
self.assertRaises(Exception, dib.tostring) self.assertRaises(Exception, dib.tostring)
self.assertRaises(Exception, lambda: dib.fromstring(test_buffer)) self.assertRaises(Exception, dib.fromstring)
if __name__ == '__main__': if __name__ == '__main__':

View File

@ -104,7 +104,7 @@ if sys.platform.startswith('win32'):
DeleteObject(dib) DeleteObject(dib)
DeleteDC(hdc) DeleteDC(hdc)
reloaded = Image.open(BytesIO(bitmap)).save(opath) Image.open(BytesIO(bitmap)).save(opath)
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()

View File

@ -11,7 +11,7 @@ against 64-bit Windows 7 Professional and Windows Server 2012
64-bit version on Amazon EC2. 64-bit version on Amazon EC2.
Prerequisites Prerequisites
------------ -------------
Extra Build Helpers Extra Build Helpers
^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^

View File

@ -283,7 +283,7 @@ current versions of Linux, OS X, and Windows.
+----------------------------------+-------------+------------------------------+--------------------------------+-----------------------+ +----------------------------------+-------------+------------------------------+--------------------------------+-----------------------+
|**Operating system** |**Supported**|**Tested Python versions** |**Latest tested Pillow version**|**Tested processors** | |**Operating system** |**Supported**|**Tested Python versions** |**Latest tested Pillow version**|**Tested processors** |
+----------------------------------+-------------+------------------------------+--------------------------------+-----------------------+ +----------------------------------+-------------+------------------------------+--------------------------------+-----------------------+
| Mac OS X 10.11 El Capitan |Yes | 2.7 | 3.0.0 |x86-64 | | Mac OS X 10.11 El Capitan |Yes | 2.7,3.3,3.4,3.5 | 3.0.0 |x86-64 |
+----------------------------------+-------------+------------------------------+--------------------------------+-----------------------+ +----------------------------------+-------------+------------------------------+--------------------------------+-----------------------+
| Mac OS X 10.10 Yosemite |Yes | 2.7,3.3,3.4 | 3.0.0 |x86-64 | | Mac OS X 10.10 Yosemite |Yes | 2.7,3.3,3.4 | 3.0.0 |x86-64 |
+----------------------------------+-------------+------------------------------+--------------------------------+-----------------------+ +----------------------------------+-------------+------------------------------+--------------------------------+-----------------------+

View File

@ -2,7 +2,7 @@
.. py:currentmodule:: PIL.ImageGrab .. py:currentmodule:: PIL.ImageGrab
:py:mod:`ImageGrab` Module (OS X and Windows only) :py:mod:`ImageGrab` Module (OS X and Windows only)
========================================= ==================================================
The :py:mod:`ImageGrab` module can be used to copy the contents of the screen The :py:mod:`ImageGrab` module can be used to copy the contents of the screen
or the clipboard to a PIL image memory. or the clipboard to a PIL image memory.

View File

@ -9,7 +9,7 @@ Structured Storage or Microsoft Compound Document File Format), such
as Microsoft Office documents, Image Composer and FlashPix files, and as Microsoft Office documents, Image Composer and FlashPix files, and
Outlook messages. Outlook messages.
This module is the `OleFileIO\_PL`_ project by Philippe Lagadec, v0.30, This module is the `OleFileIO\_PL`_ project by Philippe Lagadec, v0.42,
merged back into Pillow. merged back into Pillow.
.. _OleFileIO\_PL: http://www.decalage.info/python/olefileio .. _OleFileIO\_PL: http://www.decalage.info/python/olefileio

View File

@ -206,9 +206,8 @@ if __name__ == "__main__":
# use doctest to make sure the test program behaves as documented! # use doctest to make sure the test program behaves as documented!
import doctest import doctest
import selftest
print("Running selftest:") print("Running selftest:")
status = doctest.testmod(selftest) status = doctest.testmod(sys.modules[__name__])
if status[0]: if status[0]:
print("*** %s tests of %d failed." % status) print("*** %s tests of %d failed." % status)
exit_status = 1 exit_status = 1

View File

@ -28,9 +28,9 @@ libs = {
'dir': 'tiff-4.0.6', 'dir': 'tiff-4.0.6',
}, },
'freetype': { 'freetype': {
'url': 'http://download.savannah.gnu.org/releases/freetype/freetype-2.6.1.tar.gz', 'url': 'http://download.savannah.gnu.org/releases/freetype/freetype-2.6.2.tar.gz',
'hash': 'md5:348e667d728c597360e4a87c16556597', 'hash': 'md5:c408547878f1f5a3700881a8bbf1c644',
'dir': 'freetype-2.6.1', 'dir': 'freetype-2.6.2',
}, },
'lcms': { 'lcms': {
'url': SF_MIRROR+'/project/lcms/lcms/2.7/lcms2-2.7.zip', 'url': SF_MIRROR+'/project/lcms/lcms/2.7/lcms2-2.7.zip',