commit:     ea8ac0bb1e40d58112727a20ccb688b5c7968b47
Author:     Bernard Cafarelli <voyageur <AT> gentoo <DOT> org>
AuthorDate: Sat Jul  8 07:57:23 2023 +0000
Commit:     Bernard Cafarelli <voyageur <AT> gentoo <DOT> org>
CommitDate: Sat Jul  8 07:59:36 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ea8ac0bb

media-gfx/mcomix: fix pillow version check

Signed-off-by: Bernard Cafarelli <voyageur <AT> gentoo.org>

 .../mcomix/files/mcomix-2.1.1-pillow_version.patch | 15 +++++++
 media-gfx/mcomix/mcomix-2.1.1-r1.ebuild            | 47 ++++++++++++++++++++++
 2 files changed, 62 insertions(+)

diff --git a/media-gfx/mcomix/files/mcomix-2.1.1-pillow_version.patch 
b/media-gfx/mcomix/files/mcomix-2.1.1-pillow_version.patch
new file mode 100644
index 000000000000..b4e51d230292
--- /dev/null
+++ b/media-gfx/mcomix/files/mcomix-2.1.1-pillow_version.patch
@@ -0,0 +1,15 @@
+--- a/mcomix/run.py    2023-07-03 21:39:35.146479272 +0300
++++ b/mcomix/run.py    2023-07-03 21:40:16.742507561 +0300
+@@ -122,7 +122,11 @@
+     try:
+         import PIL.Image
+ 
+-        if PIL.__version__ < '6.0.0':
++        try:
++            pil_major_version = 
int(PIL.__version__[0:PIL.__version__.index('.')])
++        except (ValueError, IndexError):
++            pil_major_version = 0
++        if pil_major_version < 6:
+             log.error( _("You don't have the required version of the Python 
Imaging Library Fork (Pillow) installed."))
+             log.error( _('Installed Pillow version is: %s') % PIL.__version__ 
)
+             log.error( _('Required Pillow version is: 6.0.0 or higher') )

diff --git a/media-gfx/mcomix/mcomix-2.1.1-r1.ebuild 
b/media-gfx/mcomix/mcomix-2.1.1-r1.ebuild
new file mode 100644
index 000000000000..899761314205
--- /dev/null
+++ b/media-gfx/mcomix/mcomix-2.1.1-r1.ebuild
@@ -0,0 +1,47 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=setuptools
+PYTHON_COMPAT=( python3_{9..12} )
+inherit distutils-r1 optfeature xdg
+
+DESCRIPTION="GTK image viewer for comic book archives"
+HOMEPAGE="https://mcomix.sourceforge.net";
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm64 ~riscv ~x86"
+IUSE=""
+
+DEPEND="${PYTHON_DEPS}"
+RDEPEND="${DEPEND}
+       >=dev-python/pillow-6.0.0[${PYTHON_USEDEP}]
+       >=dev-python/pycairo-1.16.0[${PYTHON_USEDEP}]
+       >=dev-python/pygobject-3.36.0[${PYTHON_USEDEP}]
+       media-libs/libjpeg-turbo:0
+       x11-libs/gtk+:3[introspection]"
+BDEPEND="sys-devel/gettext"
+# Most tests are quite old and do not run
+RESTRICT="test"
+
+PATCHES=( "${FILESDIR}"/${P}-pillow_version.patch )
+
+src_prepare() {
+       default
+
+       # Uncompress man page
+       gunzip mcomix.1.gz || die
+       sed -e "s/mcomix.1.gz/mcomix.1/" -i setup.py || die
+}
+
+pkg_postinst() {
+       xdg_pkg_postinst
+
+       optfeature "RAR (.cbr) archives" app-arch/unrar
+       optfeature "7Zip archives" app-arch/p7zip
+       optfeature "LHA/LZA archives" app-arch/lha
+       optfeature "PDF files" app-text/mupdf
+}

Reply via email to