media-video/photofilmstrip: fix tostring() runtime exception #584128
authorPhobosK <phobosk@fastmail.fm>
Mon, 10 Apr 2017 17:21:08 +0000 (13:21 -0400)
committerGöktürk Yüksek <gokturk@gentoo.org>
Mon, 10 Apr 2017 17:23:57 +0000 (13:23 -0400)
Thanks to Cyril42e for the initial patch.

Package-Manager: Portage-2.3.3, Repoman-2.3.2

media-video/photofilmstrip/files/photofilmstrip-2.1.0-PIL_tostring_fix.patch [new file with mode: 0644]
media-video/photofilmstrip/photofilmstrip-2.1.0-r1.ebuild [new file with mode: 0644]

diff --git a/media-video/photofilmstrip/files/photofilmstrip-2.1.0-PIL_tostring_fix.patch b/media-video/photofilmstrip/files/photofilmstrip-2.1.0-PIL_tostring_fix.patch
new file mode 100644 (file)
index 0000000..dc29c9c
--- /dev/null
@@ -0,0 +1,35 @@
+Gentoo-Bug: https://bugs.gentoo.org/584128
+
+--- a/photofilmstrip/core/ProjectFile.py
++++ b/photofilmstrip/core/ProjectFile.py
+@@ -196,7 +196,7 @@
+     def __ThumbToQuery(self, picId, pic):
+         pilThumb = PILBackend.GetThumbnail(pic, height=120)
+         thumbWidth, thumbHeight = pilThumb.size
+-        thumbData = buffer(pilThumb.tostring())
++        thumbData = buffer(pilThumb.tobytes())
+         
+         query = "INSERT INTO `thumbnail` (" \
+                     "picture_id, width, height, data" \
+--- a/photofilmstrip/core/renderer/CairoRenderer.py
++++ b/photofilmstrip/core/renderer/CairoRenderer.py
+@@ -121,7 +121,7 @@
+     def _PilToCairo(self, pilImg):
+         pilImg = pilImg.copy()
+         w, h = pilImg.size  
+-        data = pilImg.convert('RGBA').tostring()
++        data = pilImg.convert('RGBA').tobytes()
+         buff = array.array('B', data)
+         cairoImage = cairo.ImageSurface.create_for_data(buff, cairo.FORMAT_ARGB32, w, h)
+ #        cairoImage = cairo.ImageSurface.create_for_data(buff, cairo.FORMAT_RGB24, w, h)
+--- a/photofilmstrip/core/renderer/PyGameRenderer.py
++++ b/photofilmstrip/core/renderer/PyGameRenderer.py
+@@ -100,7 +100,7 @@
+     def _PilToPyGame(self, pilImg):
+         mode = pilImg.mode
+         assert mode in "RGB", "RGBA"
+-        return pygame.image.fromstring(pilImg.tostring(), pilImg.size, mode)
++        return pygame.image.frombytes(pilImg.tobytes(), pilImg.size, mode)
+ 
+ 
+ #    def CropAndResize(self, ctx, rect):
diff --git a/media-video/photofilmstrip/photofilmstrip-2.1.0-r1.ebuild b/media-video/photofilmstrip/photofilmstrip-2.1.0-r1.ebuild
new file mode 100644 (file)
index 0000000..ea403b0
--- /dev/null
@@ -0,0 +1,62 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="6"
+PYTHON_COMPAT=( python2_7 )
+PYTHON_REQ_USE="sqlite"
+DISTUTILS_SINGLE_IMPL=1
+
+inherit distutils-r1
+
+DESCRIPTION="Movie slideshow creator using Ken Burns effect"
+HOMEPAGE="http://www.photofilmstrip.org"
+SRC_URI="mirror://sourceforge/photostoryx/${PN}/${PV}/${P}.tar.gz"
+LICENSE="GPL-2+"
+SLOT="0"
+
+KEYWORDS="~amd64 ~x86"
+IUSE="cairo sdl"
+
+RDEPEND="dev-python/wxpython:2.8[cairo?,${PYTHON_USEDEP}]
+       dev-python/pillow[${PYTHON_USEDEP}]
+       media-video/mplayer[encode]
+       sdl? ( dev-python/pygame[${PYTHON_USEDEP}] )"
+
+DEPEND="${RDEPEND}"
+
+# Fix bug #472774 (https://bugs.gentoo.org/show_bug.cgi?id=472774)
+PATCHES=(
+       "${FILESDIR}/${P}-PIL_modules_imports_fix.patch"
+       "${FILESDIR}/${P}-PIL_tostring_fix.patch"
+)
+
+DOCS=( CHANGES COPYING README )
+
+src_prepare() {
+       # Remove unneeded icon resources update needing running X
+       # Fix app doc/help files paths
+       sed -i \
+               -e '/self\._make_resources\(\)/d' \
+               -e "s:\(os\.path\.join(\"share\", \"doc\", \"\)photofilmstrip:\1${PF}:" \
+               setup.py || die
+
+       sed -i \
+                -e "s:\"photofilmstrip\":\"${PF}\":" \
+                photofilmstrip/gui/HelpViewer.py || die
+
+       # Fix desktop file entry
+       sed -i \
+               -e '/^Version.*/d' \
+               data/photofilmstrip.desktop || die
+
+       distutils-r1_src_prepare
+}
+
+src_install() {
+       doman docs/manpage/*
+
+       # Do not compress the apps help files
+       docompress -x /usr/share/doc/${PF}/${PN}.hh{c,k,p}
+
+       distutils-r1_src_install
+}