FreeBSD Bugzilla – Attachment 204364 Details for
Bug 237887
graphics/py-mcomix: Fix runtime with graphics/py-pillow 6.0
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
py-mcomix-fix-runtime-with-pillow-6.0.patch
py-mcomix-fix-runtime-with-pillow-6.0.patch (text/plain), 6.29 KB, created by
Kai Knoblich
on 2019-05-13 19:37:03 UTC
(
hide
)
Description:
py-mcomix-fix-runtime-with-pillow-6.0.patch
Filename:
MIME Type:
Creator:
Kai Knoblich
Created:
2019-05-13 19:37:03 UTC
Size:
6.29 KB
patch
obsolete
>Index: graphics/py-mcomix/Makefile >=================================================================== >--- graphics/py-mcomix/Makefile (revision 501580) >+++ graphics/py-mcomix/Makefile (working copy) >@@ -3,7 +3,7 @@ > > PORTNAME= mcomix > PORTVERSION= 1.2.1 >-PORTREVISION= 1 >+PORTREVISION= 2 > CATEGORIES= graphics > MASTER_SITES= SF/${PORTNAME}/MComix-${PORTVERSION} > PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} >@@ -14,10 +14,10 @@ > LICENSE= GPLv2 > LICENSE_FILE= ${WRKSRC}/COPYING > >-BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}pillow>0:graphics/py-pillow@${PY_FLAVOR} >+BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}pillow>=5.2.0:graphics/py-pillow@${PY_FLAVOR} > RUN_DEPENDS:= ${BUILD_DEPENDS} > >-USES= python:2.7 tar:bzip2 >+USES= gnome python:2.7 tar:bzip2 > USE_GNOME= pygtk2 > USE_PYTHON= autoplist distutils > >Index: graphics/py-mcomix/files/patch-mcomix_image__tools.py >=================================================================== >--- graphics/py-mcomix/files/patch-mcomix_image__tools.py (nonexistent) >+++ graphics/py-mcomix/files/patch-mcomix_image__tools.py (working copy) >@@ -0,0 +1,115 @@ >+--- mcomix/image_tools.py.orig 2016-02-12 18:51:58 UTC >++++ mcomix/image_tools.py >+@@ -9,7 +9,6 @@ import gtk >+ from PIL import Image >+ from PIL import ImageEnhance >+ from PIL import ImageOps >+-from PIL.JpegImagePlugin import _getexif >+ try: >+ from PIL import PILLOW_VERSION >+ PIL_VERSION = ('Pillow', PILLOW_VERSION) >+@@ -51,7 +50,38 @@ assert MISSING_IMAGE_ICON >+ GTK_GDK_COLOR_BLACK = gtk.gdk.color_parse('black') >+ GTK_GDK_COLOR_WHITE = gtk.gdk.color_parse('white') >+ >++def _getexif(im): >++ exif={} >++ try: >++ exif.update(im.getexif()) >++ except AttributeError: >++ pass >++ if exif: >++ return exif >+ >++ # Exif of PNG is still buggy in Pillow 6.0.0 >++ try: >++ l1,l2,size,lines=im.info.get('Raw profile type exif').splitlines() >++ if l2!='exif': >++ # Not valid Exif data. >++ return {} >++ size=int(size) >++ data=binascii.unhexlify(''.join(lines)) >++ if len(data)!=size: >++ # Size not match. >++ return {} >++ im.info['exif']=data >++ except: >++ # Not valid Exif data. >++ return {} >++ >++ # load Exif again >++ try: >++ exif.update(im.getexif()) >++ except AttributeError: >++ pass >++ return exif >++ >+ def rotate_pixbuf(src, rotation): >+ rotation %= 360 >+ if 0 == rotation: >+@@ -300,14 +330,7 @@ def pil_to_pixbuf(im, keep_orientation=False): >+ ) >+ if keep_orientation: >+ # Keep orientation metadata. >+- orientation = None >+- exif = im.info.get('exif') >+- if exif is not None: >+- exif = _getexif(im) >+- orientation = exif.get(274, None) >+- if orientation is None: >+- # Maybe it's a PNG? Try alternative method. >+- orientation = _get_png_implied_rotation(im) >++ orientation = _getexit(im).get(274, None) >+ if orientation is not None: >+ setattr(pixbuf, 'orientation', str(orientation)) >+ return pixbuf >+@@ -385,39 +408,6 @@ def enhance(pixbuf, brightness=1.0, contrast=1.0, satu >+ im = ImageEnhance.Sharpness(im).enhance(sharpness) >+ return pil_to_pixbuf(im) >+ >+-def _get_png_implied_rotation(pixbuf_or_image): >+- """Same as <get_implied_rotation> for PNG files. >+- >+- Lookup for Exif data in the tEXt chunk. >+- """ >+- if isinstance(pixbuf_or_image, gtk.gdk.Pixbuf): >+- exif = pixbuf_or_image.get_option('tEXt::Raw profile type exif') >+- elif isinstance(pixbuf_or_image, Image.Image): >+- exif = pixbuf_or_image.info.get('Raw profile type exif') >+- else: >+- raise ValueError() >+- if exif is None: >+- return None >+- exif = exif.split('\n') >+- if len(exif) < 4 or 'exif' != exif[1]: >+- # Not valid Exif data. >+- return None >+- size = int(exif[2]) >+- try: >+- data = binascii.unhexlify(''.join(exif[3:])) >+- except TypeError: >+- # Not valid hexadecimal content. >+- return None >+- if size != len(data): >+- # Sizes should match. >+- return None >+- im = namedtuple('FakeImage', 'info')({ 'exif': data }) >+- exif = _getexif(im) >+- orientation = exif.get(274, None) >+- if orientation is not None: >+- orientation = str(orientation) >+- return orientation >+- >+ def get_implied_rotation(pixbuf): >+ """Return the implied rotation in degrees: 0, 90, 180, or 270. >+ >+@@ -429,9 +419,6 @@ def get_implied_rotation(pixbuf): >+ orientation = getattr(pixbuf, 'orientation', None) >+ if orientation is None: >+ orientation = pixbuf.get_option('orientation') >+- if orientation is None: >+- # Maybe it's a PNG? Try alternative method. >+- orientation = _get_png_implied_rotation(pixbuf) >+ if orientation == '3': >+ return 180 >+ elif orientation == '6': > >Property changes on: graphics/py-mcomix/files/patch-mcomix_image__tools.py >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: graphics/py-mcomix/files/patch-mcomix_run.py >=================================================================== >--- graphics/py-mcomix/files/patch-mcomix_run.py (nonexistent) >+++ graphics/py-mcomix/files/patch-mcomix_run.py (working copy) >@@ -0,0 +1,15 @@ >+--- mcomix/run.py.orig 2016-02-12 18:52:12 UTC >++++ mcomix/run.py >+@@ -203,7 +203,11 @@ def run(): >+ >+ try: >+ import PIL.Image >+- assert PIL.Image.VERSION >= '1.1.5' >++ try: >++ assert PIL.Image.VERSION >= '1.1.5' >++ except AttributeError: >++ # Field VERSION deprecated in Pillow 5.2.0 and dropped in 6.0.0 >++ assert PIL.__version__ >= '5.2.0' >+ >+ except AssertionError: >+ log.error( _("You don't have the required version of the Python Imaging"), end=' ') > >Property changes on: graphics/py-mcomix/files/patch-mcomix_run.py >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
ashish
:
maintainer-approval+
Actions:
View
|
Diff
Attachments on
bug 237887
: 204364