From e43e22dafa62244ad9835335d4dc2733bd1a7b83 Mon Sep 17 00:00:00 2001 From: "Lee, Cheon-il" Date: Sat, 13 Sep 2014 03:13:38 +0000 Subject: [PATCH 1/6] Add default value to Font.size --- wand/font.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wand/font.py b/wand/font.py index 67e36d2d..7ffd5191 100644 --- a/wand/font.py +++ b/wand/font.py @@ -44,12 +44,12 @@ class Font(tuple): """Font struct which is a subtype of :class:`tuple`. Its constructor - takes :attr:`path`, :attr:`size`, :attr:`color` (black by default), and - :attr:`antialias` (``True`` by default). + takes :attr:`path`, :attr:`size` (0 by default), :attr:`color` + (black by default), and :attr:`antialias` (``True`` by default). """ - def __new__(cls, path, size, color=None, antialias=True): + def __new__(cls, path, size=0, color=None, antialias=True): if not isinstance(path, string_type): raise TypeError('path must be a string, not ' + repr(path)) if not isinstance(size, numbers.Real): From 53d74105accd65308f90aa88ade6ccc401c397fc Mon Sep 17 00:00:00 2001 From: Hong Minhee Date: Sun, 14 Sep 2014 13:51:03 +0900 Subject: [PATCH 2/6] Suggest libmagickcore5-extra package for delegates --- docs/guide/install.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/guide/install.rst b/docs/guide/install.rst index c8f2a7f5..1ebedefe 100644 --- a/docs/guide/install.rst +++ b/docs/guide/install.rst @@ -38,6 +38,13 @@ easily installed using APT: $ sudo apt-get install libmagickwand-dev +If you need SVG, WMF, OpenEXR, DjVu, and Graphviz support you have to install +``libmagickcore5-extra`` as well: + +.. sourcecode:: console + + $ sudo apt-get install libmagickcore5-extra + .. _install-imagemagick-redhat: From 64ab5a5377296e25401a64ef7ac0e03aaa30e068 Mon Sep 17 00:00:00 2001 From: Hong Minhee Date: Sun, 14 Sep 2014 14:35:04 +0900 Subject: [PATCH 3/6] Skip if non-Unicode filesystem encoding. Fix #193 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=761325 --- tests/image_test.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/image_test.py b/tests/image_test.py index 8d1d3100..58aacf9a 100644 --- a/tests/image_test.py +++ b/tests/image_test.py @@ -1,8 +1,10 @@ # -*- coding: utf-8 -*- +import codecs import io import os import os.path import shutil +import sys import tempfile import warnings @@ -15,6 +17,23 @@ from wand.font import Font +try: + filesystem_encoding = sys.getfilesystemencoding() +except RuntimeError: + unicode_filesystem_encoding = False +else: + try: + codec_info = codecs.lookup(filesystem_encoding) + except LookupError: + unicode_filesystem_encoding = False + else: + unicode_filesystem_encoding = codec_info.name in ( + 'utf-8', 'utf-16', 'utf-16-be', 'utf-16-le', + 'utf-32', 'utf-32-be', 'utf-32-le', + 'mbcs' # for Windows + ) + + def test_empty_image(): with Image() as img: assert img.size == (0,0) @@ -58,6 +77,8 @@ def test_read_from_filename(fx_asset): assert img.width == 402 +@mark.skipif(not unicode_filesystem_encoding, + reason='Unicode filesystem encoding needed') def test_read_from_unicode_filename(fx_asset, tmpdir): """https://github.com/dahlia/wand/issues/122""" filename = '모나리자.jpg' @@ -97,6 +118,8 @@ def test_new_from_filename(fx_asset): Image(filename=str(fx_asset.join('not-exists.jpg'))) +@mark.skipif(not unicode_filesystem_encoding, + reason='Unicode filesystem encoding needed') def test_new_from_unicode_filename(fx_asset, tmpdir): """https://github.com/dahlia/wand/issues/122""" filename = '모나리자.jpg' @@ -155,6 +178,8 @@ def test_save_to_filename(fx_asset): os.remove(savefile) +@mark.skipif(not unicode_filesystem_encoding, + reason='Unicode filesystem encoding needed') def test_save_to_unicode_filename(fx_asset, tmpdir): filename = '모나리자.jpg' if not PY3: From 3028bbff2df95a3c33fb3c552e1c281b4113091f Mon Sep 17 00:00:00 2001 From: Hong Minhee Date: Sat, 13 Dec 2014 16:35:54 +0900 Subject: [PATCH 4/6] Several typos --- docs/changes.rst | 2 +- docs/roadmap.rst | 2 +- wand/api.py | 2 +- wand/image.py | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/changes.rst b/docs/changes.rst index e351ca35..731a1624 100644 --- a/docs/changes.rst +++ b/docs/changes.rst @@ -261,7 +261,7 @@ Released on January 25, 2013. ` method (and :meth:`Image.watermark() ` method which internally uses it) didn't work. -- Fixed segmentation fault occured when :attr:`Color.red +- Fixed segmentation fault occurred when :attr:`Color.red `, :attr:`Color.green `, or :attr:`Color.blue ` is accessed. - Added :attr:`Color.alpha ` property. diff --git a/docs/roadmap.rst b/docs/roadmap.rst index 985cf310..e54c7994 100644 --- a/docs/roadmap.rst +++ b/docs/roadmap.rst @@ -18,7 +18,7 @@ Very future versions PIL compatibility layer PIL has very long history and the most of Python projects still - depend on it. We will work on PIL compatiblity layer using Wand. + depend on it. We will work on PIL compatibility layer using Wand. It will provide two ways to emulate PIL: - Module-level compatibility which can be used by changing diff --git a/wand/api.py b/wand/api.py index bf0a8a15..303c8bb1 100644 --- a/wand/api.py +++ b/wand/api.py @@ -41,7 +41,7 @@ def __del__(self): def find_library(suffix=''): """Finds library path to try loading. The result paths are not - guarenteed that they exist. + guaranteed that they exist. :param suffix: optional suffix e.g. ``'-Q16'`` :type suffix: :class:`basestring` diff --git a/wand/image.py b/wand/image.py index fe780d8e..b762f62f 100644 --- a/wand/image.py +++ b/wand/image.py @@ -1870,7 +1870,7 @@ class Image(BaseImage): default is transparent :type background: :class:`wand.color.Color` :param resolution: set a resolution value (dpi), - usefull for vectorial formats (like pdf) + useful for vectorial formats (like pdf) :type resolution: :class:`collections.Sequence`, :Class:`numbers.Integral` @@ -1940,7 +1940,7 @@ def __init__(self, image=None, blob=None, file=None, filename=None, open_args = image, blob, file, filename if (any(a is not None for a in new_args) and any(a is not None for a in open_args)): - raise TypeError('blank image parameters cant be used with image ' + raise TypeError("blank image parameters can't be used with image " 'opening parameters') elif any(a is not None and b is not None for i, a in enumerate(open_args) @@ -2004,7 +2004,7 @@ def read(self, file=None, filename=None, blob=None, resolution=None): :param filename: reads an image from the ``filename`` string :type filename: :class:`basestring` :param resolution: set a resolution value (DPI), - usefull for vectorial formats (like PDF) + useful for vectorial formats (like PDF) :type resolution: :class:`collections.Sequence`, :class:`numbers.Integral` From 0e2a9337d9cbae363dea602f25b8ee143c2aeac9 Mon Sep 17 00:00:00 2001 From: "Stephen J. Fuhry" Date: Thu, 18 Dec 2014 14:32:03 -0500 Subject: [PATCH 5/6] HTTPResponse is not guaranteed to have mode --- wand/image.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wand/image.py b/wand/image.py index b762f62f..ed661d84 100644 --- a/wand/image.py +++ b/wand/image.py @@ -2024,7 +2024,7 @@ def read(self, file=None, filename=None, blob=None, resolution=None): 'integer of the same x/y') if file is not None: if (isinstance(file, file_types) and - hasattr(libc, 'fdopen')): + hasattr(libc, 'fdopen') and hasattr(file, 'mode')): fd = libc.fdopen(file.fileno(), file.mode) r = library.MagickReadImageFile(self.wand, fd) elif not callable(getattr(file, 'read', None)): From 46a33c3758403c273218a4f5ac54aebcc0721353 Mon Sep 17 00:00:00 2001 From: Hong Minhee Date: Sat, 20 Dec 2014 05:27:39 +0900 Subject: [PATCH 6/6] Release 0.3.9 --- docs/changes.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changes.rst b/docs/changes.rst index e996dd45..ecb278d9 100644 --- a/docs/changes.rst +++ b/docs/changes.rst @@ -7,7 +7,7 @@ Wand Changelog Version 0.3.9 ------------- -To be released. +Released on December 20, 2014. - Added ``'pdf:use-cropbox'`` option to :attr:`Image.options ` dictionary (and :const:`~wand.image.OPTIONS`