* Re: Fix #13143 by patching MComix for PIL-6.0.0 compat.
2019-07-16 4:41 [PR PATCH] Fix #13143 by patching MComix for PIL-6.0.0 compat voidlinux-github
@ 2019-07-16 4:43 ` voidlinux-github
2019-07-16 4:48 ` voidlinux-github
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: voidlinux-github @ 2019-07-16 4:43 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 210 bytes --]
New comment by seisatsu on void-packages repository
https://github.com/void-linux/void-packages/pull/13148#issuecomment-511662559
Comment:
Give me a moment, I may have screwed something up. Double checking.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Fix #13143 by patching MComix for PIL-6.0.0 compat.
2019-07-16 4:41 [PR PATCH] Fix #13143 by patching MComix for PIL-6.0.0 compat voidlinux-github
2019-07-16 4:43 ` voidlinux-github
@ 2019-07-16 4:48 ` voidlinux-github
2019-07-16 5:08 ` voidlinux-github
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: voidlinux-github @ 2019-07-16 4:48 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 295 bytes --]
New comment by seisatsu on void-packages repository
https://github.com/void-linux/void-packages/pull/13148#issuecomment-511663524
Comment:
Everything's tested and works, but the package version needs to be bumped from `mcomix-1.2.1_1` to `mcomix-1.2.1_2` in the template, which I forgot to do.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Fix #13143 by patching MComix for PIL-6.0.0 compat.
2019-07-16 4:41 [PR PATCH] Fix #13143 by patching MComix for PIL-6.0.0 compat voidlinux-github
2019-07-16 4:43 ` voidlinux-github
2019-07-16 4:48 ` voidlinux-github
@ 2019-07-16 5:08 ` voidlinux-github
2019-07-16 5:08 ` voidlinux-github
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: voidlinux-github @ 2019-07-16 5:08 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 441 bytes --]
New comment by seisatsu on void-packages repository
https://github.com/void-linux/void-packages/pull/13148#issuecomment-511663524
Comment:
Everything's tested and works, but the package version needs to be bumped from `mcomix-1.2.1_1` to `mcomix-1.2.1_2` in the template, which I forgot to do. Looking at other pull requests I think I also didn't follow the naming convention for my commit. Let me know if I should make a new pull request.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Fix #13143 by patching MComix for PIL-6.0.0 compat.
2019-07-16 4:41 [PR PATCH] Fix #13143 by patching MComix for PIL-6.0.0 compat voidlinux-github
` (2 preceding siblings ...)
2019-07-16 5:08 ` voidlinux-github
@ 2019-07-16 5:08 ` voidlinux-github
2019-07-16 9:35 ` voidlinux-github
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: voidlinux-github @ 2019-07-16 5:08 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 478 bytes --]
New comment by seisatsu on void-packages repository
https://github.com/void-linux/void-packages/pull/13148#issuecomment-511663524
Comment:
Everything's tested and works, but the package version needs to be bumped from `mcomix-1.2.1_1` to `mcomix-1.2.1_2` in the template, which I forgot to do. Looking at other pull requests I think I also didn't follow the naming convention for my commit. Let me know if I should make a new pull request of if it can be fixed up on your end.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Fix #13143 by patching MComix for PIL-6.0.0 compat.
2019-07-16 4:41 [PR PATCH] Fix #13143 by patching MComix for PIL-6.0.0 compat voidlinux-github
` (3 preceding siblings ...)
2019-07-16 5:08 ` voidlinux-github
@ 2019-07-16 9:35 ` voidlinux-github
2019-07-16 22:22 ` [PR PATCH] [Updated] " voidlinux-github
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: voidlinux-github @ 2019-07-16 9:35 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 241 bytes --]
New comment by seisatsu on void-packages repository
https://github.com/void-linux/void-packages/pull/13148#issuecomment-511662559
Comment:
Give me a moment, I may have screwed something up. Double checking. It's my first time doing this.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PR PATCH] [Updated] Fix #13143 by patching MComix for PIL-6.0.0 compat.
2019-07-16 4:41 [PR PATCH] Fix #13143 by patching MComix for PIL-6.0.0 compat voidlinux-github
` (4 preceding siblings ...)
2019-07-16 9:35 ` voidlinux-github
@ 2019-07-16 22:22 ` voidlinux-github
2019-07-16 22:22 ` voidlinux-github
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: voidlinux-github @ 2019-07-16 22:22 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 584 bytes --]
There is an updated pull request by seisatsu against master on the void-packages repository
https://github.com/seisatsu/void-packages mcomix-pil-patch
https://github.com/void-linux/void-packages/pull/13148
Fix #13143 by patching MComix for PIL-6.0.0 compat.
Fixes the incompatibility issue between MComix and Python-Pillow-6.0.0 described in issue #13143 using patches found at https://github.com/mat813/freebsd-ports/tree/d9a5e385afb3dab755ebe5138b09cf7351f992d9/graphics/py-mcomix/files
A patch file from https://github.com/void-linux/void-packages/pull/13148.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-mcomix-pil-patch-13148.patch --]
[-- Type: application/text/x-diff, Size: 5969 bytes --]
From 48d2317882f54955629b2afc48a2bb315a6a6c91 Mon Sep 17 00:00:00 2001
From: "Michael D. Reiley" <seisatsu@seisat.su>
Date: Mon, 15 Jul 2019 21:37:05 -0700
Subject: [PATCH] mcomix: fix python-pillow-6.0.0 compatibility
---
srcpkgs/mcomix/patches/image_tools.py.patch | 116 ++++++++++++++++++++
srcpkgs/mcomix/patches/run.py.patch | 16 +++
srcpkgs/mcomix/template | 2 +-
3 files changed, 133 insertions(+), 1 deletion(-)
create mode 100644 srcpkgs/mcomix/patches/image_tools.py.patch
create mode 100644 srcpkgs/mcomix/patches/run.py.patch
diff --git a/srcpkgs/mcomix/patches/image_tools.py.patch b/srcpkgs/mcomix/patches/image_tools.py.patch
new file mode 100644
index 00000000000..9928ed8228d
--- /dev/null
+++ b/srcpkgs/mcomix/patches/image_tools.py.patch
@@ -0,0 +1,116 @@
+Grabbed from https://github.com/mat813/freebsd-ports/tree/d9a5e385afb3dab755ebe5138b09cf7351f992d9/graphics/py-mcomix/files
+--- 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':
diff --git a/srcpkgs/mcomix/patches/run.py.patch b/srcpkgs/mcomix/patches/run.py.patch
new file mode 100644
index 00000000000..09f952775ca
--- /dev/null
+++ b/srcpkgs/mcomix/patches/run.py.patch
@@ -0,0 +1,16 @@
+Grabbed from https://github.com/mat813/freebsd-ports/tree/d9a5e385afb3dab755ebe5138b09cf7351f992d9/graphics/py-mcomix/files
+--- 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=' ')
diff --git a/srcpkgs/mcomix/template b/srcpkgs/mcomix/template
index fb03976f8c9..3179b451be1 100644
--- a/srcpkgs/mcomix/template
+++ b/srcpkgs/mcomix/template
@@ -1,7 +1,7 @@
# Template file for 'mcomix'
pkgname=mcomix
version=1.2.1
-revision=1
+revision=2
archs=noarch
build_style=python2-module
pycompile_module="${pkgname}"
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PR PATCH] [Updated] Fix #13143 by patching MComix for PIL-6.0.0 compat.
2019-07-16 4:41 [PR PATCH] Fix #13143 by patching MComix for PIL-6.0.0 compat voidlinux-github
` (5 preceding siblings ...)
2019-07-16 22:22 ` [PR PATCH] [Updated] " voidlinux-github
@ 2019-07-16 22:22 ` voidlinux-github
2019-07-16 22:23 ` mcomix: fix python-pillow-6.0.0 compatibility voidlinux-github
2019-07-18 5:22 ` [PR PATCH] [Merged]: " voidlinux-github
8 siblings, 0 replies; 10+ messages in thread
From: voidlinux-github @ 2019-07-16 22:22 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 584 bytes --]
There is an updated pull request by seisatsu against master on the void-packages repository
https://github.com/seisatsu/void-packages mcomix-pil-patch
https://github.com/void-linux/void-packages/pull/13148
Fix #13143 by patching MComix for PIL-6.0.0 compat.
Fixes the incompatibility issue between MComix and Python-Pillow-6.0.0 described in issue #13143 using patches found at https://github.com/mat813/freebsd-ports/tree/d9a5e385afb3dab755ebe5138b09cf7351f992d9/graphics/py-mcomix/files
A patch file from https://github.com/void-linux/void-packages/pull/13148.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-mcomix-pil-patch-13148.patch --]
[-- Type: application/text/x-diff, Size: 5969 bytes --]
From 48d2317882f54955629b2afc48a2bb315a6a6c91 Mon Sep 17 00:00:00 2001
From: "Michael D. Reiley" <seisatsu@seisat.su>
Date: Mon, 15 Jul 2019 21:37:05 -0700
Subject: [PATCH] mcomix: fix python-pillow-6.0.0 compatibility
---
srcpkgs/mcomix/patches/image_tools.py.patch | 116 ++++++++++++++++++++
srcpkgs/mcomix/patches/run.py.patch | 16 +++
srcpkgs/mcomix/template | 2 +-
3 files changed, 133 insertions(+), 1 deletion(-)
create mode 100644 srcpkgs/mcomix/patches/image_tools.py.patch
create mode 100644 srcpkgs/mcomix/patches/run.py.patch
diff --git a/srcpkgs/mcomix/patches/image_tools.py.patch b/srcpkgs/mcomix/patches/image_tools.py.patch
new file mode 100644
index 00000000000..9928ed8228d
--- /dev/null
+++ b/srcpkgs/mcomix/patches/image_tools.py.patch
@@ -0,0 +1,116 @@
+Grabbed from https://github.com/mat813/freebsd-ports/tree/d9a5e385afb3dab755ebe5138b09cf7351f992d9/graphics/py-mcomix/files
+--- 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':
diff --git a/srcpkgs/mcomix/patches/run.py.patch b/srcpkgs/mcomix/patches/run.py.patch
new file mode 100644
index 00000000000..09f952775ca
--- /dev/null
+++ b/srcpkgs/mcomix/patches/run.py.patch
@@ -0,0 +1,16 @@
+Grabbed from https://github.com/mat813/freebsd-ports/tree/d9a5e385afb3dab755ebe5138b09cf7351f992d9/graphics/py-mcomix/files
+--- 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=' ')
diff --git a/srcpkgs/mcomix/template b/srcpkgs/mcomix/template
index fb03976f8c9..3179b451be1 100644
--- a/srcpkgs/mcomix/template
+++ b/srcpkgs/mcomix/template
@@ -1,7 +1,7 @@
# Template file for 'mcomix'
pkgname=mcomix
version=1.2.1
-revision=1
+revision=2
archs=noarch
build_style=python2-module
pycompile_module="${pkgname}"
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: mcomix: fix python-pillow-6.0.0 compatibility
2019-07-16 4:41 [PR PATCH] Fix #13143 by patching MComix for PIL-6.0.0 compat voidlinux-github
` (6 preceding siblings ...)
2019-07-16 22:22 ` voidlinux-github
@ 2019-07-16 22:23 ` voidlinux-github
2019-07-18 5:22 ` [PR PATCH] [Merged]: " voidlinux-github
8 siblings, 0 replies; 10+ messages in thread
From: voidlinux-github @ 2019-07-16 22:23 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 166 bytes --]
New comment by seisatsu on void-packages repository
https://github.com/void-linux/void-packages/pull/13148#issuecomment-512018825
Comment:
There, that should do it.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PR PATCH] [Merged]: mcomix: fix python-pillow-6.0.0 compatibility
2019-07-16 4:41 [PR PATCH] Fix #13143 by patching MComix for PIL-6.0.0 compat voidlinux-github
` (7 preceding siblings ...)
2019-07-16 22:23 ` mcomix: fix python-pillow-6.0.0 compatibility voidlinux-github
@ 2019-07-18 5:22 ` voidlinux-github
8 siblings, 0 replies; 10+ messages in thread
From: voidlinux-github @ 2019-07-18 5:22 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 410 bytes --]
There's a merged pull request on the void-packages repository
mcomix: fix python-pillow-6.0.0 compatibility
https://github.com/void-linux/void-packages/pull/13148
Description: Fixes the incompatibility issue between MComix and Python-Pillow-6.0.0 described in issue #13143 using patches found at https://github.com/mat813/freebsd-ports/tree/d9a5e385afb3dab755ebe5138b09cf7351f992d9/graphics/py-mcomix/files
^ permalink raw reply [flat|nested] 10+ messages in thread