mirror of
https://github.com/janeczku/calibre-web
synced 2025-01-12 02:10:30 +00:00
Updated wand (#116)
This commit is contained in:
parent
eaccc3f408
commit
02b0058546
8
vendor/wand/api.py
vendored
8
vendor/wand/api.py
vendored
@ -180,8 +180,8 @@ try:
|
|||||||
libraries = load_library()
|
libraries = load_library()
|
||||||
except (OSError, IOError):
|
except (OSError, IOError):
|
||||||
msg = 'http://docs.wand-py.org/en/latest/guide/install.html'
|
msg = 'http://docs.wand-py.org/en/latest/guide/install.html'
|
||||||
if sys.platform.startswith('freebsd'):
|
if sys.platform.startswith(('dragonfly', 'freebsd')):
|
||||||
msg = 'pkg_add -r'
|
msg = 'pkg install'
|
||||||
elif sys.platform == 'win32':
|
elif sys.platform == 'win32':
|
||||||
msg += '#install-imagemagick-on-windows'
|
msg += '#install-imagemagick-on-windows'
|
||||||
elif sys.platform == 'darwin':
|
elif sys.platform == 'darwin':
|
||||||
@ -1397,7 +1397,7 @@ try:
|
|||||||
library.MagickAutoOrientImage.argtypes = [ctypes.c_void_p]
|
library.MagickAutoOrientImage.argtypes = [ctypes.c_void_p]
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
# MagickAutoOrientImage was added in 6.8.9+, we have a fallback function
|
# MagickAutoOrientImage was added in 6.8.9+, we have a fallback function
|
||||||
# so we pass silently if we cant import it
|
# so we pass silently if we cannot import it
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@ -1418,7 +1418,7 @@ else:
|
|||||||
except OSError:
|
except OSError:
|
||||||
# In case of El Capitan SIP
|
# In case of El Capitan SIP
|
||||||
libc = ctypes.cdll.LoadLibrary('/usr/lib/libc.dylib')
|
libc = ctypes.cdll.LoadLibrary('/usr/lib/libc.dylib')
|
||||||
elif platform.system() == 'FreeBSD':
|
elif sys.platform.startswith(('dragonfly', 'freebsd')):
|
||||||
libc = ctypes.cdll.LoadLibrary(ctypes.util.find_library('c'))
|
libc = ctypes.cdll.LoadLibrary(ctypes.util.find_library('c'))
|
||||||
else:
|
else:
|
||||||
libc = ctypes.cdll.LoadLibrary('libc.so.6')
|
libc = ctypes.cdll.LoadLibrary('libc.so.6')
|
||||||
|
2
vendor/wand/drawing.py
vendored
2
vendor/wand/drawing.py
vendored
@ -1573,7 +1573,7 @@ class Drawing(Resource):
|
|||||||
def rectangle(self, left=None, top=None, right=None, bottom=None,
|
def rectangle(self, left=None, top=None, right=None, bottom=None,
|
||||||
width=None, height=None, radius=None, xradius=None,
|
width=None, height=None, radius=None, xradius=None,
|
||||||
yradius=None):
|
yradius=None):
|
||||||
"""Draws a rectangle using the current :attr:`stoke_color`,
|
"""Draws a rectangle using the current :attr:`stroke_color`,
|
||||||
:attr:`stroke_width`, and :attr:`fill_color`.
|
:attr:`stroke_width`, and :attr:`fill_color`.
|
||||||
|
|
||||||
.. sourcecode:: text
|
.. sourcecode:: text
|
||||||
|
30
vendor/wand/exceptions.py
vendored
30
vendor/wand/exceptions.py
vendored
@ -18,16 +18,28 @@ class WandException(Exception):
|
|||||||
"""All Wand-related exceptions are derived from this class."""
|
"""All Wand-related exceptions are derived from this class."""
|
||||||
|
|
||||||
|
|
||||||
class WandWarning(WandException, Warning):
|
class BaseWarning(WandException, Warning):
|
||||||
"""Base class for Wand-related warnings."""
|
"""Base class for Wand-related warnings.
|
||||||
|
|
||||||
|
.. versionadded:: 0.4.4
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
class WandError(WandException):
|
class BaseError(WandException):
|
||||||
"""Base class for Wand-related errors."""
|
"""Base class for Wand-related errors.
|
||||||
|
|
||||||
|
.. versionadded:: 0.4.4
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
class WandFatalError(WandException):
|
class BaseFatalError(WandException):
|
||||||
"""Base class for Wand-related fatal errors."""
|
"""Base class for Wand-related fatal errors.
|
||||||
|
|
||||||
|
.. versionadded:: 0.4.4
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
class WandLibraryVersionError(WandException):
|
class WandLibraryVersionError(WandException):
|
||||||
@ -91,9 +103,9 @@ DOMAIN_MAP = [
|
|||||||
#: (:class:`list`) The list of (base_class, suffix) pairs (for each code).
|
#: (:class:`list`) The list of (base_class, suffix) pairs (for each code).
|
||||||
#: It would be zipped with :const:`DOMAIN_MAP` pairs' last element.
|
#: It would be zipped with :const:`DOMAIN_MAP` pairs' last element.
|
||||||
CODE_MAP = [
|
CODE_MAP = [
|
||||||
(WandWarning, 'Warning'),
|
(BaseWarning, 'Warning'),
|
||||||
(WandError, 'Error'),
|
(BaseError, 'Error'),
|
||||||
(WandFatalError, 'FatalError')
|
(BaseFatalError, 'FatalError')
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
11
vendor/wand/image.py
vendored
11
vendor/wand/image.py
vendored
@ -2757,6 +2757,17 @@ class Image(BaseImage):
|
|||||||
self.sequence = Sequence(self)
|
self.sequence = Sequence(self)
|
||||||
self.raise_exception()
|
self.raise_exception()
|
||||||
|
|
||||||
|
def destroy(self):
|
||||||
|
"""Manually remove :class:`~.sequence.SingleImage`'s in
|
||||||
|
the :class:`~.sequence.Sequence`, allowing it to
|
||||||
|
be properly garbage collected after using a ``with Image()`` context
|
||||||
|
manager.
|
||||||
|
|
||||||
|
"""
|
||||||
|
for i in range(0, len(self.sequence)):
|
||||||
|
self.sequence.pop()
|
||||||
|
super(Image, self).destroy()
|
||||||
|
|
||||||
def read(self, file=None, filename=None, blob=None, resolution=None):
|
def read(self, file=None, filename=None, blob=None, resolution=None):
|
||||||
"""Read new image into Image() object.
|
"""Read new image into Image() object.
|
||||||
|
|
||||||
|
20
vendor/wand/version.py
vendored
20
vendor/wand/version.py
vendored
@ -57,7 +57,7 @@ __all__ = ('VERSION', 'VERSION_INFO', 'MAGICK_VERSION',
|
|||||||
#:
|
#:
|
||||||
#: .. versionchanged:: 0.1.9
|
#: .. versionchanged:: 0.1.9
|
||||||
#: Becomes :class:`tuple`. (It was string before.)
|
#: Becomes :class:`tuple`. (It was string before.)
|
||||||
VERSION_INFO = (0, 4, 3)
|
VERSION_INFO = (0, 4, 4)
|
||||||
|
|
||||||
#: (:class:`basestring`) The version string e.g. ``'0.1.2'``.
|
#: (:class:`basestring`) The version string e.g. ``'0.1.2'``.
|
||||||
#:
|
#:
|
||||||
@ -94,20 +94,20 @@ if libmagick:
|
|||||||
#: .. versionadded:: 0.2.1
|
#: .. versionadded:: 0.2.1
|
||||||
MAGICK_VERSION_INFO = tuple(int(v or 0) for v in _match.groups())
|
MAGICK_VERSION_INFO = tuple(int(v or 0) for v in _match.groups())
|
||||||
|
|
||||||
#: (:class:`datetime.date`) The release date of the linked ImageMagick
|
|
||||||
#: library. The same to the result of :c:func:`GetMagickReleaseDate`
|
|
||||||
#: function.
|
|
||||||
#:
|
|
||||||
#: .. versionadded:: 0.2.1
|
|
||||||
MAGICK_RELEASE_DATE_STRING = text(libmagick.GetMagickReleaseDate())
|
|
||||||
|
|
||||||
#: (:class:`basestring`) The date string e.g. ``'2012-06-03'`` of
|
#: (:class:`basestring`) The date string e.g. ``'2012-06-03'`` of
|
||||||
#: :const:`MAGICK_RELEASE_DATE_STRING`. This value is the exactly same
|
#: :const:`MAGICK_RELEASE_DATE_STRING`. This value is the exactly same
|
||||||
#: string to the result of :c:func:`GetMagickReleaseDate` function.
|
#: string to the result of :c:func:`GetMagickReleaseDate` function.
|
||||||
#:
|
#:
|
||||||
#: .. versionadded:: 0.2.1
|
#: .. versionadded:: 0.2.1
|
||||||
MAGICK_RELEASE_DATE = datetime.date(
|
MAGICK_RELEASE_DATE_STRING = text(libmagick.GetMagickReleaseDate())
|
||||||
*map(int, MAGICK_RELEASE_DATE_STRING.split('-')))
|
|
||||||
|
_match = re.match(r'^(\d{4})-?(\d\d)-?(\d\d)$', MAGICK_RELEASE_DATE_STRING)
|
||||||
|
#: (:class:`datetime.date`) The release date of the linked ImageMagick
|
||||||
|
#: library. Equivalent to the result of :c:func:`GetMagickReleaseDate`
|
||||||
|
#: function.
|
||||||
|
#:
|
||||||
|
#: .. versionadded:: 0.2.1
|
||||||
|
MAGICK_RELEASE_DATE = datetime.date(*map(int, _match.groups()))
|
||||||
|
|
||||||
c_quantum_depth = ctypes.c_size_t()
|
c_quantum_depth = ctypes.c_size_t()
|
||||||
libmagick.GetMagickQuantumDepth(ctypes.byref(c_quantum_depth))
|
libmagick.GetMagickQuantumDepth(ctypes.byref(c_quantum_depth))
|
||||||
|
Loading…
Reference in New Issue
Block a user