1 |
commit: b6ba553e726506205668460edba8a6895996c595 |
2 |
Author: James Le Cuirot <chewi <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Apr 25 15:36:59 2020 +0000 |
4 |
Commit: James Le Cuirot <chewi <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Apr 25 15:48:23 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b6ba553e |
7 |
|
8 |
games-board/pychess: Version bump to 1.0.0 |
9 |
|
10 |
I can't add Python 3.8 until gst-python has been bumped, which should |
11 |
happen soon. |
12 |
|
13 |
Bug: https://bugs.gentoo.org/718310 |
14 |
Package-Manager: Portage-2.3.99, Repoman-2.3.22 |
15 |
Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org> |
16 |
|
17 |
games-board/pychess/Manifest | 1 + |
18 |
games-board/pychess/files/pychess-gtk-compat.patch | 46 +++++++ |
19 |
.../pychess/files/pychess-setup-no-display.patch | 136 +++++++++++++++++++++ |
20 |
games-board/pychess/metadata.xml | 2 +- |
21 |
games-board/pychess/pychess-1.0.0.ebuild | 56 +++++++++ |
22 |
5 files changed, 240 insertions(+), 1 deletion(-) |
23 |
|
24 |
diff --git a/games-board/pychess/Manifest b/games-board/pychess/Manifest |
25 |
index cf02b110ce8..9b065a912a3 100644 |
26 |
--- a/games-board/pychess/Manifest |
27 |
+++ b/games-board/pychess/Manifest |
28 |
@@ -1 +1,2 @@ |
29 |
DIST pychess-0.99.4.tar.gz 12318797 BLAKE2B ae0741d724516b85c4158e25bc7a2ea1f7642bfa165365d6022c6de6c4447b5f9d3baa2f801bdcbf2449de53f95df3ec68d9a5c898d962c1864a5a2b0c5183b6 SHA512 79b5a3a780864ca8b92be19b213442030752694fa9cd3a4bf71140d2364042521f534adf94843094531550b1029bb6f80150953dd661631ec45b1b08014cf9dc |
30 |
+DIST pychess-1.0.0.tar.gz 12853354 BLAKE2B 1e5f3c219bce10f3cd9e68b873634742d4b673e93adb00cfcc84fcbc6ca5c7ce0534feecca3f8ddce6cd848074b84957db81f8c45841ffd7c4e1007672082840 SHA512 331765d22e2360dba145be5e22677d8676e1c7fcc8486d0e52e379b41c85bab782a5d548b93fe2f19de99ce0ccc4904e02fc8130de679ca534a211b579f1679a |
31 |
|
32 |
diff --git a/games-board/pychess/files/pychess-gtk-compat.patch b/games-board/pychess/files/pychess-gtk-compat.patch |
33 |
new file mode 100644 |
34 |
index 00000000000..fa7f2fc6103 |
35 |
--- /dev/null |
36 |
+++ b/games-board/pychess/files/pychess-gtk-compat.patch |
37 |
@@ -0,0 +1,46 @@ |
38 |
+From 6c840c9981f2077d0fa4436b30a2f2f6650e55fb Mon Sep 17 00:00:00 2001 |
39 |
+From: =?UTF-8?q?Micka=C3=ABl=20Schoentgen?= <contact@×××××××××.fr> |
40 |
+Date: Mon, 13 Apr 2020 14:48:40 +0200 |
41 |
+Subject: [PATCH] Fix missing TreeModelFilter.sort_new_with_model() on some Gtk |
42 |
+ versions |
43 |
+MIME-Version: 1.0 |
44 |
+Content-Type: text/plain; charset=UTF-8 |
45 |
+Content-Transfer-Encoding: 8bit |
46 |
+ |
47 |
+This is due to API changes, but let's keep compatibility with older versions. |
48 |
+That should fix #1811. |
49 |
+ |
50 |
+Signed-off-by: Mickaël Schoentgen <contact@×××××××××.fr> |
51 |
+--- |
52 |
+ lib/pychess/perspectives/fics/__init__.py | 18 ++++++++++++++++++ |
53 |
+ 1 file changed, 18 insertions(+) |
54 |
+ |
55 |
+diff --git a/lib/pychess/perspectives/fics/__init__.py b/lib/pychess/perspectives/fics/__init__.py |
56 |
+index 4f956b695..1518c21e0 100644 |
57 |
+--- a/lib/pychess/perspectives/fics/__init__.py |
58 |
++++ b/lib/pychess/perspectives/fics/__init__.py |
59 |
+@@ -27,6 +27,24 @@ |
60 |
+ from pychess.perspectives import Perspective, perspective_manager, panel_name |
61 |
+ |
62 |
+ |
63 |
++if not hasattr(Gtk.TreeModelFilter, "new_with_model"): |
64 |
++ # Fix #1811: TreeModelFilter.sort_new_with_model() is missing on some Gtk versions |
65 |
++ # due to API changes. Let's keep compatibility with older versions. |
66 |
++ |
67 |
++ def sort_new_with_model(self): |
68 |
++ super_object = super(Gtk.TreeModel, self) |
69 |
++ if hasattr(super_object, "sort_new_with_model"): |
70 |
++ return super_object.sort_new_with_model() |
71 |
++ return Gtk.TreeModelSort.new_with_model(self) |
72 |
++ |
73 |
++ @classmethod |
74 |
++ def new_with_model(self, child_model): |
75 |
++ return Gtk.TreeModel.sort_new_with_model(child_model) |
76 |
++ |
77 |
++ Gtk.TreeModel.sort_new_with_model = sort_new_with_model |
78 |
++ Gtk.TreeModelFilter.new_with_model = new_with_model |
79 |
++ |
80 |
++ |
81 |
+ class PlayerNotificationMessage(InfoBarMessage): |
82 |
+ |
83 |
+ def __init__(self, message_type, content, callback, player, text): |
84 |
|
85 |
diff --git a/games-board/pychess/files/pychess-setup-no-display.patch b/games-board/pychess/files/pychess-setup-no-display.patch |
86 |
new file mode 100644 |
87 |
index 00000000000..29b06bd93fe |
88 |
--- /dev/null |
89 |
+++ b/games-board/pychess/files/pychess-setup-no-display.patch |
90 |
@@ -0,0 +1,136 @@ |
91 |
+From faf456bf2d081aa3cff52d0f9f714748a04628b1 Mon Sep 17 00:00:00 2001 |
92 |
+From: gbtami <gbtami@×××××.com> |
93 |
+Date: Sat, 18 May 2019 18:50:17 +0200 |
94 |
+Subject: [PATCH] Fix bdist_rpm. Prevent importing GLib from setup.py |
95 |
+ |
96 |
+--- |
97 |
+ lib/pychess/Savers/pgn.py | 8 ++++---- |
98 |
+ lib/pychess/Utils/__init__.py | 18 ++++++++++++++++++ |
99 |
+ lib/pychess/widgets/ChessClock.py | 20 ++------------------ |
100 |
+ 3 files changed, 24 insertions(+), 22 deletions(-) |
101 |
+ |
102 |
+diff --git a/lib/pychess/Savers/pgn.py b/lib/pychess/Savers/pgn.py |
103 |
+index ac4238471..2b089e1d1 100644 |
104 |
+--- a/lib/pychess/Savers/pgn.py |
105 |
++++ b/lib/pychess/Savers/pgn.py |
106 |
+@@ -10,8 +10,6 @@ |
107 |
+ import sys |
108 |
+ import textwrap |
109 |
+ |
110 |
+-from gi.repository import GLib |
111 |
+- |
112 |
+ import pexpect |
113 |
+ |
114 |
+ from sqlalchemy import String |
115 |
+@@ -23,7 +21,6 @@ |
116 |
+ WON_RESIGN, DRAW, BLACKWON, WHITEWON, NORMALCHESS, DRAW_AGREE, FIRST_PAGE, PREV_PAGE, NEXT_PAGE, \ |
117 |
+ ABORTED_REASONS, ADJOURNED_REASONS, WON_CALLFLAG, DRAW_ADJUDICATION, WON_ADJUDICATION, \ |
118 |
+ WHITE_ENGINE_DIED, BLACK_ENGINE_DIED, RUNNING, TOOL_NONE, TOOL_CHESSDB, TOOL_SCOUTFISH |
119 |
+- |
120 |
+ from pychess.System import conf |
121 |
+ from pychess.System.Log import log |
122 |
+ from pychess.System.protoopen import PGN_ENCODING |
123 |
+@@ -35,7 +32,7 @@ |
124 |
+ from pychess.Utils.elo import get_elo_rating_change_pgn |
125 |
+ from pychess.Utils.logic import getStatus |
126 |
+ from pychess.Variants import name2variant, NormalBoard, variants |
127 |
+-from pychess.widgets.ChessClock import formatTime |
128 |
++from pychess.Utils import formatTime |
129 |
+ from pychess.Savers.ChessFile import ChessFile, LoadingError |
130 |
+ from pychess.Savers.database import col2label, TagDatabase, parseDateTag |
131 |
+ from pychess.Database import model as dbmodel |
132 |
+@@ -460,6 +457,7 @@ def init_tag_database(self, importer=None): |
133 |
+ if size > 10000000: |
134 |
+ drop_indexes(self.engine) |
135 |
+ if self.progressbar is not None: |
136 |
++ from gi.repository import GLib |
137 |
+ GLib.idle_add(self.progressbar.set_text, _("Importing game headers...")) |
138 |
+ if importer is None: |
139 |
+ importer = PgnImport(self) |
140 |
+@@ -477,6 +475,7 @@ def init_chess_db(self): |
141 |
+ if chess_db_path is not None and self.path and self.size > 0: |
142 |
+ try: |
143 |
+ if self.progressbar is not None: |
144 |
++ from gi.repository import GLib |
145 |
+ GLib.idle_add(self.progressbar.set_text, _("Creating .bin index file...")) |
146 |
+ self.chess_db = Parser(engine=(chess_db_path, )) |
147 |
+ self.chess_db.open(self.path) |
148 |
+@@ -503,6 +502,7 @@ def init_scoutfish(self): |
149 |
+ if scoutfish_path is not None and self.path and self.size > 0: |
150 |
+ try: |
151 |
+ if self.progressbar is not None: |
152 |
++ from gi.repository import GLib |
153 |
+ GLib.idle_add(self.progressbar.set_text, _("Creating .scout index file...")) |
154 |
+ self.scoutfish = Scoutfish(engine=(scoutfish_path, )) |
155 |
+ self.scoutfish.open(self.path) |
156 |
+diff --git a/lib/pychess/Utils/__init__.py b/lib/pychess/Utils/__init__.py |
157 |
+index 481273854..038c798da 100755 |
158 |
+--- a/lib/pychess/Utils/__init__.py |
159 |
++++ b/lib/pychess/Utils/__init__.py |
160 |
+@@ -1,9 +1,27 @@ |
161 |
+ import asyncio |
162 |
+ import weakref |
163 |
++from math import ceil |
164 |
+ |
165 |
+ from pychess.Utils.lutils.ldata import MATE_VALUE, MATE_DEPTH |
166 |
+ |
167 |
+ |
168 |
++def formatTime(seconds, clk2pgn=False): |
169 |
++ minus = "" |
170 |
++ if seconds <= -10 or seconds >= 10: |
171 |
++ seconds = ceil(seconds) |
172 |
++ if seconds < 0: |
173 |
++ minus = "-" |
174 |
++ seconds = -seconds |
175 |
++ hours, remainder = divmod(seconds, 3600) |
176 |
++ minutes, seconds = divmod(remainder, 60) |
177 |
++ if hours or clk2pgn: |
178 |
++ return minus + "%d:%02d:%02d" % (hours, minutes, seconds) |
179 |
++ elif not minutes and seconds < 10: |
180 |
++ return minus + "%.1f" % seconds |
181 |
++ else: |
182 |
++ return minus + "%d:%02d" % (minutes, seconds) |
183 |
++ |
184 |
++ |
185 |
+ def prettyPrintScore(s, depth, format_mate=False): |
186 |
+ """The score parameter is an eval value from White point of view""" |
187 |
+ |
188 |
+diff --git a/lib/pychess/widgets/ChessClock.py b/lib/pychess/widgets/ChessClock.py |
189 |
+index 8811d13db..740e0828a 100644 |
190 |
+--- a/lib/pychess/widgets/ChessClock.py |
191 |
++++ b/lib/pychess/widgets/ChessClock.py |
192 |
+@@ -1,32 +1,16 @@ |
193 |
+ # -*- coding: UTF-8 -*- |
194 |
+ |
195 |
+-from math import ceil, pi, cos, sin |
196 |
++from math import pi, cos, sin |
197 |
+ |
198 |
+ import cairo |
199 |
+ from gi.repository import GLib, Gtk, Gdk, Pango, PangoCairo, GObject |
200 |
+ |
201 |
+ from pychess.System import conf |
202 |
++from pychess.Utils import formatTime |
203 |
+ from pychess.Utils.const import BLACK, WHITE, LOCAL, UNFINISHED_STATES, DRAW, WHITEWON, BLACKWON, UNKNOWN_STATE |
204 |
+ from . import preferencesDialog |
205 |
+ |
206 |
+ |
207 |
+-def formatTime(seconds, clk2pgn=False): |
208 |
+- minus = "" |
209 |
+- if seconds <= -10 or seconds >= 10: |
210 |
+- seconds = ceil(seconds) |
211 |
+- if seconds < 0: |
212 |
+- minus = "-" |
213 |
+- seconds = -seconds |
214 |
+- hours, remainder = divmod(seconds, 3600) |
215 |
+- minutes, seconds = divmod(remainder, 60) |
216 |
+- if hours or clk2pgn: |
217 |
+- return minus + "%d:%02d:%02d" % (hours, minutes, seconds) |
218 |
+- elif not minutes and seconds < 10: |
219 |
+- return minus + "%.1f" % seconds |
220 |
+- else: |
221 |
+- return minus + "%d:%02d" % (minutes, seconds) |
222 |
+- |
223 |
+- |
224 |
+ class ChessClock(Gtk.DrawingArea): |
225 |
+ def __init__(self): |
226 |
+ GObject.GObject.__init__(self) |
227 |
|
228 |
diff --git a/games-board/pychess/metadata.xml b/games-board/pychess/metadata.xml |
229 |
index 852efafb393..652441d5c75 100644 |
230 |
--- a/games-board/pychess/metadata.xml |
231 |
+++ b/games-board/pychess/metadata.xml |
232 |
@@ -6,6 +6,6 @@ |
233 |
<name>Gentoo Games Project</name> |
234 |
</maintainer> |
235 |
<upstream> |
236 |
- <remote-id type="google-code">pychess</remote-id> |
237 |
+ <remote-id type="github">pychess/pychess</remote-id> |
238 |
</upstream> |
239 |
</pkgmetadata> |
240 |
|
241 |
diff --git a/games-board/pychess/pychess-1.0.0.ebuild b/games-board/pychess/pychess-1.0.0.ebuild |
242 |
new file mode 100644 |
243 |
index 00000000000..39436e26bda |
244 |
--- /dev/null |
245 |
+++ b/games-board/pychess/pychess-1.0.0.ebuild |
246 |
@@ -0,0 +1,56 @@ |
247 |
+# Copyright 1999-2020 Gentoo Authors |
248 |
+# Distributed under the terms of the GNU General Public License v2 |
249 |
+ |
250 |
+EAPI=7 |
251 |
+ |
252 |
+PYTHON_COMPAT=( python3_7 ) |
253 |
+DISTUTILS_SINGLE_IMPL=1 |
254 |
+DISTUTILS_USE_SETUPTOOLS=no |
255 |
+PYTHON_REQ_USE="sqlite" |
256 |
+ |
257 |
+inherit xdg distutils-r1 |
258 |
+ |
259 |
+DESCRIPTION="A chess client for GNOME" |
260 |
+HOMEPAGE="https://github.com/pychess/pychess" |
261 |
+SRC_URI="https://github.com/${PN}/${PN}/releases/download/${PV}/${P}.tar.gz" |
262 |
+ |
263 |
+LICENSE="GPL-3" |
264 |
+SLOT="0" |
265 |
+KEYWORDS="~amd64 ~x86" |
266 |
+IUSE="gstreamer" |
267 |
+ |
268 |
+DEPEND=" |
269 |
+ $(python_gen_cond_dep ' |
270 |
+ dev-python/pexpect[${PYTHON_USEDEP}] |
271 |
+ dev-python/psutil[${PYTHON_USEDEP}] |
272 |
+ dev-python/pycairo[${PYTHON_USEDEP}] |
273 |
+ dev-python/pygobject:3[${PYTHON_USEDEP}] |
274 |
+ dev-python/sqlalchemy[${PYTHON_USEDEP},sqlite] |
275 |
+ dev-python/websockets[${PYTHON_USEDEP}] |
276 |
+ ') |
277 |
+ gnome-base/librsvg:2 |
278 |
+ x11-libs/gtksourceview:3.0 |
279 |
+ x11-libs/pango |
280 |
+ x11-themes/adwaita-icon-theme |
281 |
+ gstreamer? ( |
282 |
+ $(python_gen_cond_dep ' |
283 |
+ dev-python/gst-python:1.0[${PYTHON_USEDEP}] |
284 |
+ ') |
285 |
+ media-libs/gstreamer:1.0 |
286 |
+ media-libs/gst-plugins-base:1.0 |
287 |
+ ) |
288 |
+" |
289 |
+ |
290 |
+RDEPEND="${DEPEND}" |
291 |
+ |
292 |
+PATCHES=( |
293 |
+ "${FILESDIR}"/${PN}-setup-no-display.patch |
294 |
+ "${FILESDIR}"/${PN}-gtk-compat.patch |
295 |
+) |
296 |
+ |
297 |
+src_install() { |
298 |
+ distutils-r1_src_install |
299 |
+ |
300 |
+ mv -v "${ED}"/usr/share/{appdata,metainfo} || die |
301 |
+ gunzip -v "${ED}"/usr/share/man/man1/${PN}.1.gz || die |
302 |
+} |