View | Details | Raw Unified | Return to bug 245738 | Differences between
and this patch

Collapse All | Expand All

(-)Makefile (-14 / +19 lines)
Lines 2-31 Link Here
2
# $FreeBSD$
2
# $FreeBSD$
3
3
4
PORTNAME=	mcomix
4
PORTNAME=	mcomix
5
PORTVERSION=	1.2.1
5
PORTVERSION=	1.2.1g20200418
6
PORTREVISION=	3
7
CATEGORIES=	graphics
6
CATEGORIES=	graphics
8
MASTER_SITES=	SF/${PORTNAME}/MComix-${PORTVERSION}
9
PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
7
PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
10
8
11
MAINTAINER=	ashish@FreeBSD.org
9
MAINTAINER=	ashish@FreeBSD.org
12
COMMENT=	GTK2 comic book viewer
10
COMMENT=	GTK3 comic book viewer
13
11
14
LICENSE=	GPLv2
12
LICENSE=	GPLv2
15
LICENSE_FILE=	${WRKSRC}/COPYING
13
LICENSE_FILE=	${WRKSRC}/COPYING
16
14
17
DEPRECATED=	Old, uses EOLed python27
15
BUILD_DEPENDS=	${PYTHON_PKGNAMEPREFIX}pillow>=5.2.0:graphics/py-pillow@${PY_FLAVOR}
18
EXPIRATION_DATE=	2020-03-01
19
20
BUILD_DEPENDS=	${PYTHON_PKGNAMEPREFIX}pillow6>=5.2.0:graphics/py-pillow6@${PY_FLAVOR}
21
RUN_DEPENDS:=	${BUILD_DEPENDS}
16
RUN_DEPENDS:=	${BUILD_DEPENDS}
17
NO_ARCH=	yes
18
NO_BUILD=	yes
22
19
23
USES=		gnome python:2.7 tar:bzip2
20
USES=		gnome python shebangfix
24
USE_GNOME=	pygtk2
21
USE_GNOME=	gtk30 pygobject3
25
USE_PYTHON=	autoplist distutils
22
USE_PYTHON=	flavors
23
USE_GITHUB=	yes
24
GH_ACCOUNT=	multiSnow
25
GH_PROJECT=	mcomix3
26
GH_TAGNAME=	cd39ae5
26
27
27
post-patch:
28
SHEBANG_FILES=	mcomix/mcomixstarter.py
28
	@${REINPLACE_CMD} -e 's|share/man/man1|man/man1|g' \
29
		${WRKSRC}/setup.py
30
29
30
do-install:
31
	${MKDIR} ${STAGEDIR}${PYTHON_SITELIBDIR}/mcomix
32
	(cd ${WRKSRC}/mcomix/mcomix && ${COPYTREE_SHARE} . ${STAGEDIR}${PYTHON_SITELIBDIR}/mcomix)
33
	${PYTHON_CMD} -m compileall -d ${PYTHON_SITELIBDIR} ${STAGEDIR}${PYTHON_SITELIBDIR}/mcomix
34
	${INSTALL} ${WRKSRC}/mcomix/mcomixstarter.py ${STAGEDIR}/${PREFIX}/bin/mcomix
35
31
.include <bsd.port.mk>
36
.include <bsd.port.mk>
(-)distinfo (-2 / +3 lines)
Lines 1-2 Link Here
1
SHA256 (mcomix-1.2.1.tar.bz2) = 7e43159dc585bc9bc31970a44bd2b4e42c303660c4c8cf7f0eda413a6f72fa3b
1
TIMESTAMP = 1587280741
2
SIZE (mcomix-1.2.1.tar.bz2) = 571128
2
SHA256 (multiSnow-mcomix3-1.2.1g20200418-cd39ae5_GH0.tar.gz) = d76951a703d17af8bca6fe4ea9d72b8a1797971447bd235cb490afb7e4f7e376
3
SIZE (multiSnow-mcomix3-1.2.1g20200418-cd39ae5_GH0.tar.gz) = 3885475
(-)files/patch-mcomix_image__tools.py (-115 lines)
Lines 1-115 Link Here
1
--- mcomix/image_tools.py.orig	2016-02-12 18:51:58 UTC
2
+++ mcomix/image_tools.py
3
@@ -9,7 +9,6 @@ import gtk
4
 from PIL import Image
5
 from PIL import ImageEnhance
6
 from PIL import ImageOps
7
-from PIL.JpegImagePlugin import _getexif
8
 try:
9
     from PIL import PILLOW_VERSION
10
     PIL_VERSION = ('Pillow', PILLOW_VERSION)
11
@@ -51,7 +50,38 @@ assert MISSING_IMAGE_ICON
12
 GTK_GDK_COLOR_BLACK = gtk.gdk.color_parse('black')
13
 GTK_GDK_COLOR_WHITE = gtk.gdk.color_parse('white')
14
 
15
+def _getexif(im):
16
+    exif={}
17
+    try:
18
+        exif.update(im.getexif())
19
+    except AttributeError:
20
+        pass
21
+    if exif:
22
+        return exif
23
 
24
+    # Exif of PNG is still buggy in Pillow 6.0.0
25
+    try:
26
+        l1,l2,size,lines=im.info.get('Raw profile type exif').splitlines()
27
+        if l2!='exif':
28
+            # Not valid Exif data.
29
+            return {}
30
+        size=int(size)
31
+        data=binascii.unhexlify(''.join(lines))
32
+        if len(data)!=size:
33
+            # Size not match.
34
+            return {}
35
+        im.info['exif']=data
36
+    except:
37
+        # Not valid Exif data.
38
+        return {}
39
+
40
+    # load Exif again
41
+    try:
42
+        exif.update(im.getexif())
43
+    except AttributeError:
44
+        pass
45
+    return exif
46
+
47
 def rotate_pixbuf(src, rotation):
48
     rotation %= 360
49
     if 0 == rotation:
50
@@ -300,14 +330,7 @@ def pil_to_pixbuf(im, keep_orientation=False):
51
     )
52
     if keep_orientation:
53
         # Keep orientation metadata.
54
-        orientation = None
55
-        exif = im.info.get('exif')
56
-        if exif is not None:
57
-            exif = _getexif(im)
58
-            orientation = exif.get(274, None)
59
-        if orientation is None:
60
-            # Maybe it's a PNG? Try alternative method.
61
-            orientation = _get_png_implied_rotation(im)
62
+        orientation = _getexit(im).get(274, None)
63
         if orientation is not None:
64
             setattr(pixbuf, 'orientation', str(orientation))
65
     return pixbuf
66
@@ -385,39 +408,6 @@ def enhance(pixbuf, brightness=1.0, contrast=1.0, satu
67
         im = ImageEnhance.Sharpness(im).enhance(sharpness)
68
     return pil_to_pixbuf(im)
69
 
70
-def _get_png_implied_rotation(pixbuf_or_image):
71
-    """Same as <get_implied_rotation> for PNG files.
72
-
73
-    Lookup for Exif data in the tEXt chunk.
74
-    """
75
-    if isinstance(pixbuf_or_image, gtk.gdk.Pixbuf):
76
-        exif = pixbuf_or_image.get_option('tEXt::Raw profile type exif')
77
-    elif isinstance(pixbuf_or_image, Image.Image):
78
-        exif = pixbuf_or_image.info.get('Raw profile type exif')
79
-    else:
80
-        raise ValueError()
81
-    if exif is None:
82
-        return None
83
-    exif = exif.split('\n')
84
-    if len(exif) < 4 or 'exif' != exif[1]:
85
-        # Not valid Exif data.
86
-        return None
87
-    size = int(exif[2])
88
-    try:
89
-        data = binascii.unhexlify(''.join(exif[3:]))
90
-    except TypeError:
91
-        # Not valid hexadecimal content.
92
-        return None
93
-    if size != len(data):
94
-        # Sizes should match.
95
-        return None
96
-    im = namedtuple('FakeImage', 'info')({ 'exif': data })
97
-    exif = _getexif(im)
98
-    orientation = exif.get(274, None)
99
-    if orientation is not None:
100
-        orientation = str(orientation)
101
-    return orientation
102
-
103
 def get_implied_rotation(pixbuf):
104
     """Return the implied rotation in degrees: 0, 90, 180, or 270.
105
 
106
@@ -429,9 +419,6 @@ def get_implied_rotation(pixbuf):
107
     orientation = getattr(pixbuf, 'orientation', None)
108
     if orientation is None:
109
         orientation = pixbuf.get_option('orientation')
110
-    if orientation is None:
111
-        # Maybe it's a PNG? Try alternative method.
112
-        orientation = _get_png_implied_rotation(pixbuf)
113
     if orientation == '3':
114
         return 180
115
     elif orientation == '6':
(-)files/patch-mcomix_run.py (-15 lines)
Lines 1-15 Link Here
1
--- mcomix/run.py.orig	2016-02-12 18:52:12 UTC
2
+++ mcomix/run.py
3
@@ -203,7 +203,11 @@ def run():
4
 
5
     try:
6
         import PIL.Image
7
-        assert PIL.Image.VERSION >= '1.1.5'
8
+        try:
9
+            assert PIL.Image.VERSION >= '1.1.5'
10
+        except AttributeError:
11
+            # Field VERSION deprecated in Pillow 5.2.0 and dropped in 6.0.0
12
+            assert PIL.__version__ >= '5.2.0'
13
 
14
     except AssertionError:
15
         log.error( _("You don't have the required version of the Python Imaging"), end=' ')
(-)pkg-descr (-1 / +1 lines)
Lines 3-6 Link Here
3
generic viewer. It reads images in ZIP, RAR, 7Zip or tar archives as
3
generic viewer. It reads images in ZIP, RAR, 7Zip or tar archives as
4
well as plain image files.
4
well as plain image files.
5
5
6
WWW: https://sourceforge.net/projects/mcomix/
6
WWW: https://github.com/multiSnow/mcomix3

Return to bug 245738