summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Le Cuirot <chewi@gentoo.org>2020-04-25 16:36:59 +0100
committerJames Le Cuirot <chewi@gentoo.org>2020-04-25 16:48:23 +0100
commitb6ba553e726506205668460edba8a6895996c595 (patch)
treee267566e6cbac67e1e53c4a28bfc43b58689c988 /games-board
parentdev-python/websockets: New package required by pychess (diff)
downloadgentoo-b6ba553e726506205668460edba8a6895996c595.tar.gz
gentoo-b6ba553e726506205668460edba8a6895996c595.tar.bz2
gentoo-b6ba553e726506205668460edba8a6895996c595.zip
games-board/pychess: Version bump to 1.0.0
I can't add Python 3.8 until gst-python has been bumped, which should happen soon. Bug: https://bugs.gentoo.org/718310 Package-Manager: Portage-2.3.99, Repoman-2.3.22 Signed-off-by: James Le Cuirot <chewi@gentoo.org>
Diffstat (limited to 'games-board')
-rw-r--r--games-board/pychess/Manifest1
-rw-r--r--games-board/pychess/files/pychess-gtk-compat.patch46
-rw-r--r--games-board/pychess/files/pychess-setup-no-display.patch136
-rw-r--r--games-board/pychess/metadata.xml2
-rw-r--r--games-board/pychess/pychess-1.0.0.ebuild56
5 files changed, 240 insertions, 1 deletions
diff --git a/games-board/pychess/Manifest b/games-board/pychess/Manifest
index cf02b110ce87..9b065a912a34 100644
--- a/games-board/pychess/Manifest
+++ b/games-board/pychess/Manifest
@@ -1 +1,2 @@
DIST pychess-0.99.4.tar.gz 12318797 BLAKE2B ae0741d724516b85c4158e25bc7a2ea1f7642bfa165365d6022c6de6c4447b5f9d3baa2f801bdcbf2449de53f95df3ec68d9a5c898d962c1864a5a2b0c5183b6 SHA512 79b5a3a780864ca8b92be19b213442030752694fa9cd3a4bf71140d2364042521f534adf94843094531550b1029bb6f80150953dd661631ec45b1b08014cf9dc
+DIST pychess-1.0.0.tar.gz 12853354 BLAKE2B 1e5f3c219bce10f3cd9e68b873634742d4b673e93adb00cfcc84fcbc6ca5c7ce0534feecca3f8ddce6cd848074b84957db81f8c45841ffd7c4e1007672082840 SHA512 331765d22e2360dba145be5e22677d8676e1c7fcc8486d0e52e379b41c85bab782a5d548b93fe2f19de99ce0ccc4904e02fc8130de679ca534a211b579f1679a
diff --git a/games-board/pychess/files/pychess-gtk-compat.patch b/games-board/pychess/files/pychess-gtk-compat.patch
new file mode 100644
index 000000000000..fa7f2fc61033
--- /dev/null
+++ b/games-board/pychess/files/pychess-gtk-compat.patch
@@ -0,0 +1,46 @@
+From 6c840c9981f2077d0fa4436b30a2f2f6650e55fb Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micka=C3=ABl=20Schoentgen?= <contact@tiger-222.fr>
+Date: Mon, 13 Apr 2020 14:48:40 +0200
+Subject: [PATCH] Fix missing TreeModelFilter.sort_new_with_model() on some Gtk
+ versions
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This is due to API changes, but let's keep compatibility with older versions.
+That should fix #1811.
+
+Signed-off-by: Mickaël Schoentgen <contact@tiger-222.fr>
+---
+ lib/pychess/perspectives/fics/__init__.py | 18 ++++++++++++++++++
+ 1 file changed, 18 insertions(+)
+
+diff --git a/lib/pychess/perspectives/fics/__init__.py b/lib/pychess/perspectives/fics/__init__.py
+index 4f956b695..1518c21e0 100644
+--- a/lib/pychess/perspectives/fics/__init__.py
++++ b/lib/pychess/perspectives/fics/__init__.py
+@@ -27,6 +27,24 @@
+ from pychess.perspectives import Perspective, perspective_manager, panel_name
+
+
++if not hasattr(Gtk.TreeModelFilter, "new_with_model"):
++ # Fix #1811: TreeModelFilter.sort_new_with_model() is missing on some Gtk versions
++ # due to API changes. Let's keep compatibility with older versions.
++
++ def sort_new_with_model(self):
++ super_object = super(Gtk.TreeModel, self)
++ if hasattr(super_object, "sort_new_with_model"):
++ return super_object.sort_new_with_model()
++ return Gtk.TreeModelSort.new_with_model(self)
++
++ @classmethod
++ def new_with_model(self, child_model):
++ return Gtk.TreeModel.sort_new_with_model(child_model)
++
++ Gtk.TreeModel.sort_new_with_model = sort_new_with_model
++ Gtk.TreeModelFilter.new_with_model = new_with_model
++
++
+ class PlayerNotificationMessage(InfoBarMessage):
+
+ def __init__(self, message_type, content, callback, player, text):
diff --git a/games-board/pychess/files/pychess-setup-no-display.patch b/games-board/pychess/files/pychess-setup-no-display.patch
new file mode 100644
index 000000000000..29b06bd93fe8
--- /dev/null
+++ b/games-board/pychess/files/pychess-setup-no-display.patch
@@ -0,0 +1,136 @@
+From faf456bf2d081aa3cff52d0f9f714748a04628b1 Mon Sep 17 00:00:00 2001
+From: gbtami <gbtami@gmail.com>
+Date: Sat, 18 May 2019 18:50:17 +0200
+Subject: [PATCH] Fix bdist_rpm. Prevent importing GLib from setup.py
+
+---
+ lib/pychess/Savers/pgn.py | 8 ++++----
+ lib/pychess/Utils/__init__.py | 18 ++++++++++++++++++
+ lib/pychess/widgets/ChessClock.py | 20 ++------------------
+ 3 files changed, 24 insertions(+), 22 deletions(-)
+
+diff --git a/lib/pychess/Savers/pgn.py b/lib/pychess/Savers/pgn.py
+index ac4238471..2b089e1d1 100644
+--- a/lib/pychess/Savers/pgn.py
++++ b/lib/pychess/Savers/pgn.py
+@@ -10,8 +10,6 @@
+ import sys
+ import textwrap
+
+-from gi.repository import GLib
+-
+ import pexpect
+
+ from sqlalchemy import String
+@@ -23,7 +21,6 @@
+ WON_RESIGN, DRAW, BLACKWON, WHITEWON, NORMALCHESS, DRAW_AGREE, FIRST_PAGE, PREV_PAGE, NEXT_PAGE, \
+ ABORTED_REASONS, ADJOURNED_REASONS, WON_CALLFLAG, DRAW_ADJUDICATION, WON_ADJUDICATION, \
+ WHITE_ENGINE_DIED, BLACK_ENGINE_DIED, RUNNING, TOOL_NONE, TOOL_CHESSDB, TOOL_SCOUTFISH
+-
+ from pychess.System import conf
+ from pychess.System.Log import log
+ from pychess.System.protoopen import PGN_ENCODING
+@@ -35,7 +32,7 @@
+ from pychess.Utils.elo import get_elo_rating_change_pgn
+ from pychess.Utils.logic import getStatus
+ from pychess.Variants import name2variant, NormalBoard, variants
+-from pychess.widgets.ChessClock import formatTime
++from pychess.Utils import formatTime
+ from pychess.Savers.ChessFile import ChessFile, LoadingError
+ from pychess.Savers.database import col2label, TagDatabase, parseDateTag
+ from pychess.Database import model as dbmodel
+@@ -460,6 +457,7 @@ def init_tag_database(self, importer=None):
+ if size > 10000000:
+ drop_indexes(self.engine)
+ if self.progressbar is not None:
++ from gi.repository import GLib
+ GLib.idle_add(self.progressbar.set_text, _("Importing game headers..."))
+ if importer is None:
+ importer = PgnImport(self)
+@@ -477,6 +475,7 @@ def init_chess_db(self):
+ if chess_db_path is not None and self.path and self.size > 0:
+ try:
+ if self.progressbar is not None:
++ from gi.repository import GLib
+ GLib.idle_add(self.progressbar.set_text, _("Creating .bin index file..."))
+ self.chess_db = Parser(engine=(chess_db_path, ))
+ self.chess_db.open(self.path)
+@@ -503,6 +502,7 @@ def init_scoutfish(self):
+ if scoutfish_path is not None and self.path and self.size > 0:
+ try:
+ if self.progressbar is not None:
++ from gi.repository import GLib
+ GLib.idle_add(self.progressbar.set_text, _("Creating .scout index file..."))
+ self.scoutfish = Scoutfish(engine=(scoutfish_path, ))
+ self.scoutfish.open(self.path)
+diff --git a/lib/pychess/Utils/__init__.py b/lib/pychess/Utils/__init__.py
+index 481273854..038c798da 100755
+--- a/lib/pychess/Utils/__init__.py
++++ b/lib/pychess/Utils/__init__.py
+@@ -1,9 +1,27 @@
+ import asyncio
+ import weakref
++from math import ceil
+
+ from pychess.Utils.lutils.ldata import MATE_VALUE, MATE_DEPTH
+
+
++def formatTime(seconds, clk2pgn=False):
++ minus = ""
++ if seconds <= -10 or seconds >= 10:
++ seconds = ceil(seconds)
++ if seconds < 0:
++ minus = "-"
++ seconds = -seconds
++ hours, remainder = divmod(seconds, 3600)
++ minutes, seconds = divmod(remainder, 60)
++ if hours or clk2pgn:
++ return minus + "%d:%02d:%02d" % (hours, minutes, seconds)
++ elif not minutes and seconds < 10:
++ return minus + "%.1f" % seconds
++ else:
++ return minus + "%d:%02d" % (minutes, seconds)
++
++
+ def prettyPrintScore(s, depth, format_mate=False):
+ """The score parameter is an eval value from White point of view"""
+
+diff --git a/lib/pychess/widgets/ChessClock.py b/lib/pychess/widgets/ChessClock.py
+index 8811d13db..740e0828a 100644
+--- a/lib/pychess/widgets/ChessClock.py
++++ b/lib/pychess/widgets/ChessClock.py
+@@ -1,32 +1,16 @@
+ # -*- coding: UTF-8 -*-
+
+-from math import ceil, pi, cos, sin
++from math import pi, cos, sin
+
+ import cairo
+ from gi.repository import GLib, Gtk, Gdk, Pango, PangoCairo, GObject
+
+ from pychess.System import conf
++from pychess.Utils import formatTime
+ from pychess.Utils.const import BLACK, WHITE, LOCAL, UNFINISHED_STATES, DRAW, WHITEWON, BLACKWON, UNKNOWN_STATE
+ from . import preferencesDialog
+
+
+-def formatTime(seconds, clk2pgn=False):
+- minus = ""
+- if seconds <= -10 or seconds >= 10:
+- seconds = ceil(seconds)
+- if seconds < 0:
+- minus = "-"
+- seconds = -seconds
+- hours, remainder = divmod(seconds, 3600)
+- minutes, seconds = divmod(remainder, 60)
+- if hours or clk2pgn:
+- return minus + "%d:%02d:%02d" % (hours, minutes, seconds)
+- elif not minutes and seconds < 10:
+- return minus + "%.1f" % seconds
+- else:
+- return minus + "%d:%02d" % (minutes, seconds)
+-
+-
+ class ChessClock(Gtk.DrawingArea):
+ def __init__(self):
+ GObject.GObject.__init__(self)
diff --git a/games-board/pychess/metadata.xml b/games-board/pychess/metadata.xml
index 852efafb3934..652441d5c75c 100644
--- a/games-board/pychess/metadata.xml
+++ b/games-board/pychess/metadata.xml
@@ -6,6 +6,6 @@
<name>Gentoo Games Project</name>
</maintainer>
<upstream>
- <remote-id type="google-code">pychess</remote-id>
+ <remote-id type="github">pychess/pychess</remote-id>
</upstream>
</pkgmetadata>
diff --git a/games-board/pychess/pychess-1.0.0.ebuild b/games-board/pychess/pychess-1.0.0.ebuild
new file mode 100644
index 000000000000..39436e26bda7
--- /dev/null
+++ b/games-board/pychess/pychess-1.0.0.ebuild
@@ -0,0 +1,56 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_7 )
+DISTUTILS_SINGLE_IMPL=1
+DISTUTILS_USE_SETUPTOOLS=no
+PYTHON_REQ_USE="sqlite"
+
+inherit xdg distutils-r1
+
+DESCRIPTION="A chess client for GNOME"
+HOMEPAGE="https://github.com/pychess/pychess"
+SRC_URI="https://github.com/${PN}/${PN}/releases/download/${PV}/${P}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="gstreamer"
+
+DEPEND="
+ $(python_gen_cond_dep '
+ dev-python/pexpect[${PYTHON_USEDEP}]
+ dev-python/psutil[${PYTHON_USEDEP}]
+ dev-python/pycairo[${PYTHON_USEDEP}]
+ dev-python/pygobject:3[${PYTHON_USEDEP}]
+ dev-python/sqlalchemy[${PYTHON_USEDEP},sqlite]
+ dev-python/websockets[${PYTHON_USEDEP}]
+ ')
+ gnome-base/librsvg:2
+ x11-libs/gtksourceview:3.0
+ x11-libs/pango
+ x11-themes/adwaita-icon-theme
+ gstreamer? (
+ $(python_gen_cond_dep '
+ dev-python/gst-python:1.0[${PYTHON_USEDEP}]
+ ')
+ media-libs/gstreamer:1.0
+ media-libs/gst-plugins-base:1.0
+ )
+"
+
+RDEPEND="${DEPEND}"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-setup-no-display.patch
+ "${FILESDIR}"/${PN}-gtk-compat.patch
+)
+
+src_install() {
+ distutils-r1_src_install
+
+ mv -v "${ED}"/usr/share/{appdata,metainfo} || die
+ gunzip -v "${ED}"/usr/share/man/man1/${PN}.1.gz || die
+}