public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: games-board/pysolfc/files/, games-board/pysolfc/
Date: Sun,  9 Jul 2023 08:13:08 +0000 (UTC)	[thread overview]
Message-ID: <1688890122.43e257ac22ca19d6f9594eb9a6ccde4401dd11c6.sam@gentoo> (raw)

commit:     43e257ac22ca19d6f9594eb9a6ccde4401dd11c6
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Jul  9 08:05:33 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Jul  9 08:08:42 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=43e257ac

games-board/pysolfc: fix compat w/ pillow 10

Closes: https://bugs.gentoo.org/910081
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../pysolfc/files/pysolfc-2.20.1-pillow-10.patch   | 138 +++++++++++++++++++++
 games-board/pysolfc/pysolfc-2.20.1-r1.ebuild       |  72 +++++++++++
 2 files changed, 210 insertions(+)

diff --git a/games-board/pysolfc/files/pysolfc-2.20.1-pillow-10.patch b/games-board/pysolfc/files/pysolfc-2.20.1-pillow-10.patch
new file mode 100644
index 000000000000..d4a803b97aec
--- /dev/null
+++ b/games-board/pysolfc/files/pysolfc-2.20.1-pillow-10.patch
@@ -0,0 +1,138 @@
+https://bugs.gentoo.org/910081
+https://github.com/shlomif/PySolFC/commit/75a3000ca1301e15d5fdbc6bae6df8dbf1cac066
+
+From 75a3000ca1301e15d5fdbc6bae6df8dbf1cac066 Mon Sep 17 00:00:00 2001
+From: Joe R <joeraz5@verizon.net>
+Date: Sun, 2 Jul 2023 11:07:24 -0400
+Subject: [PATCH] New logic for getting resampling method, for compatibility
+ with newer Pillow versions.
+
+--- a/pysollib/mfxutil.py
++++ b/pysollib/mfxutil.py
+@@ -106,6 +106,17 @@ def format_time(t):
+     return "%d:%02d:%02d" % (t // 3600, (t % 3600) // 60, t % 60)
+ 
+ 
++def get_default_resampling():
++    if not USE_PIL:
++        return 0
++    elif hasattr(Image, "ANTIALIAS"):
++        return Image.ANTIALIAS
++    elif hasattr(Image, "LANCZOS"):
++        return Image.LANCZOS
++    else:
++        return Image.NEAREST
++
++
+ def print_err(s, level=1):
+     if level == 0:
+         ss = PACKAGE+': ERROR:'
+--- a/pysollib/options.py
++++ b/pysollib/options.py
+@@ -28,7 +28,8 @@
+ import configobj
+ 
+ import pysollib.settings
+-from pysollib.mfxutil import Image, USE_PIL, print_err
++from pysollib.mfxutil import USE_PIL,\
++    get_default_resampling, print_err
+ from pysollib.mygettext import _
+ from pysollib.mygettext import myGettext
+ from pysollib.pysoltk import STATUSBAR_ITEMS, TOOLBAR_BUTTONS, TOOLKIT
+@@ -474,7 +475,8 @@ def __init__(self):
+         self.tabletile_scale_method = 0
+         self.resampling = 0
+         if USE_PIL:
+-            self.resampling = int(Image.ANTIALIAS)
++            self.resampling = int(get_default_resampling())
++
+         # solver
+         self.solver_presets = [
+             'none',
+--- a/pysollib/ui/tktile/menubar.py
++++ b/pysollib/ui/tktile/menubar.py
+@@ -94,32 +94,32 @@ def createResamplingMenu(menubar, menu):
+                             variable=menubar.tkopt.resampling,
+                             value=int(Image.NEAREST),
+                             command=menubar.mOptResampling)
+-    if Image.BILINEAR:
++    if hasattr(Image, "BILINEAR"):
+         submenu.add_radiobutton(label=n_("&Bilinear"),
+                                 variable=menubar.tkopt.resampling,
+                                 value=int(Image.BILINEAR),
+                                 command=menubar.mOptResampling)
+-    if Image.BICUBIC:
++    if hasattr(Image, "BICUBIC"):
+         submenu.add_radiobutton(label=n_("B&icubic"),
+                                 variable=menubar.tkopt.resampling,
+                                 value=int(Image.BICUBIC),
+                                 command=menubar.mOptResampling)
+-    if Image.LANCZOS:
++    if hasattr(Image, "LANCZOS"):
+         submenu.add_radiobutton(label=n_("&Lanczos"),
+                                 variable=menubar.tkopt.resampling,
+                                 value=int(Image.LANCZOS),
+                                 command=menubar.mOptResampling)
+-    elif Image.ANTIALIAS:
++    elif hasattr(Image, "ANTIALIAS"):
+         submenu.add_radiobutton(label=n_("&Antialiasing"),
+                                 variable=menubar.tkopt.resampling,
+                                 value=int(Image.ANTIALIAS),
+                                 command=menubar.mOptResampling)
+-    if Image.BOX:
++    if hasattr(Image, "BOX"):
+         submenu.add_radiobutton(label=n_("B&ox"),
+                                 variable=menubar.tkopt.resampling,
+                                 value=int(Image.BOX),
+                                 command=menubar.mOptResampling)
+-    if Image.HAMMING:
++    if hasattr(Image, "HAMMING"):
+         submenu.add_radiobutton(label=n_("&Hamming"),
+                                 variable=menubar.tkopt.resampling,
+                                 value=int(Image.HAMMING),
+--- a/pysollib/ui/tktile/tkutil.py
++++ b/pysollib/ui/tktile/tkutil.py
+@@ -24,7 +24,8 @@
+ import os
+ import re
+ 
+-from pysollib.mfxutil import Image, ImageDraw, ImageOps, ImageTk
++from pysollib.mfxutil import Image, ImageDraw, ImageOps, ImageTk, \
++    get_default_resampling
+ from pysollib.settings import TITLE, WIN_SYSTEM
+ 
+ from six.moves import tkinter
+@@ -288,7 +289,10 @@ def subsample(self, r):
+             im = PIL_Image(image=im)
+             return im
+ 
+-        def resize(self, xf, yf, resample=Image.ANTIALIAS):
++        def resize(self, xf, yf, resample=-1):
++
++            if resample == -1:
++                resample = get_default_resampling()
+ 
+             w, h = self._pil_image_orig.size
+             w0, h0 = int(w*xf), int(h*yf)
+@@ -456,7 +460,10 @@ def _createBottomImage(image, color='white', backfile=None):
+     size = (w-th*2, h-th*2)
+     tmp = Image.new('RGBA', size, color)
+     tmp.putalpha(60)
+-    mask = out.resize(size, Image.ANTIALIAS)
++
++    resampling = get_default_resampling()
++
++    mask = out.resize(size, resampling)
+     out.paste(tmp, (th, th), mask)
+     if backfile:
+         back = Image.open(backfile).convert('RGBA')
+@@ -465,7 +472,7 @@ def _createBottomImage(image, color='white', backfile=None):
+         a = min(float(w1)/w0, float(h1)/h0)
+         a = a*0.9
+         w0, h0 = int(w0*a), int(h0*a)
+-        back = back.resize((w0, h0), Image.ANTIALIAS)
++        back = back.resize((w0, h0), resampling)
+         x, y = (w1 - w0) // 2, (h1 - h0) // 2
+         out.paste(back, (x, y), back)
+     return out
+

diff --git a/games-board/pysolfc/pysolfc-2.20.1-r1.ebuild b/games-board/pysolfc/pysolfc-2.20.1-r1.ebuild
new file mode 100644
index 000000000000..e4a685a7a5c3
--- /dev/null
+++ b/games-board/pysolfc/pysolfc-2.20.1-r1.ebuild
@@ -0,0 +1,72 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_SINGLE_IMPL=1
+DISTUTILS_USE_PEP517=setuptools
+PYTHON_COMPAT=( python3_{9..11} )
+PYTHON_REQ_USE="tk"
+inherit distutils-r1 xdg
+
+MY_PN="PySolFC"
+MY_P="${MY_PN}-${PV}"
+PS_CARD_P="${MY_PN}-Cardsets-2.2"
+PS_CARD_MIN_P="${MY_PN}-Cardsets--Minimal-2.2.0"
+
+DESCRIPTION="Exciting collection of more than 1000 solitaire card games"
+HOMEPAGE="https://pysolfc.sourceforge.io/"
+SRC_URI="mirror://sourceforge/pysolfc/${MY_P}.tar.xz
+	extra-cardsets? ( mirror://sourceforge/pysolfc/${PS_CARD_P}.tar.bz2 )
+	!extra-cardsets? ( mirror://sourceforge/pysolfc/${PS_CARD_MIN_P}.tar.xz )"
+S="${WORKDIR}/${MY_P}"
+
+LICENSE="GPL-3+ GPL-2+"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="extra-cardsets minimal +sound"
+
+RDEPEND="
+	$(python_gen_cond_dep '
+		dev-python/attrs[${PYTHON_USEDEP}]
+		dev-python/configobj[${PYTHON_USEDEP}]
+		dev-python/pysol_cards[${PYTHON_USEDEP}]
+		dev-python/random2[${PYTHON_USEDEP}]
+		dev-python/six[${PYTHON_USEDEP}]
+		sound? ( dev-python/pygame[${PYTHON_USEDEP}] )
+		!minimal? ( dev-python/pillow[jpeg,tk,${PYTHON_USEDEP}] )')
+	!minimal? ( dev-tcltk/tktable )"
+
+PATCHES=(
+	"${FILESDIR}"/${P}-pillow-10.patch
+)
+
+distutils_enable_tests unittest
+
+src_prepare() {
+	distutils-r1_src_prepare
+
+	# make pip check happier, pycotap is not needed
+	sed -i "/'pycotap'/d" setup.py || die
+
+	if use extra-cardsets; then
+		find ../${PS_CARD_P} -type d -name .thumbnails -exec rm -r {} + || die
+	fi
+}
+
+python_install_all() {
+	local DOCS=( AUTHORS.md NEWS.asciidoc README.md )
+	distutils-r1_python_install_all
+
+	doman docs/pysol{,fc}.6
+
+	insinto /usr/share/${MY_PN}
+	doins -r ../$(usex extra-cardsets ${PS_CARD_P} ${PS_CARD_MIN_P})/.
+
+	# html files are used at runtime, keep at default location
+	dosym -r /usr/share/{${MY_PN},doc/${PF}}/html
+
+	# russian translation is not currently displaying right
+	# https://forums.gentoo.org/viewtopic-t-1142910.html
+	rm "${ED}"/usr/share/locale/ru/LC_MESSAGES/pysol.mo || die
+}


             reply	other threads:[~2023-07-09  8:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-09  8:13 Sam James [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-08-06  4:32 [gentoo-commits] repo/gentoo:master commit in: games-board/pysolfc/files/, games-board/pysolfc/ Ionen Wolkens
2021-09-12 19:19 Ionen Wolkens
2019-07-29 22:24 James Le Cuirot
2018-05-20  8:44 Andrey Grozin
2016-09-06  4:15 Austin English
2016-08-02 16:59 Austin English

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1688890122.43e257ac22ca19d6f9594eb9a6ccde4401dd11c6.sam@gentoo \
    --to=sam@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox