public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: kde-apps/kajongg/, kde-apps/kajongg/files/
@ 2021-12-29 15:42 Andreas Sturmlechner
  0 siblings, 0 replies; 2+ messages in thread
From: Andreas Sturmlechner @ 2021-12-29 15:42 UTC (permalink / raw
  To: gentoo-commits

commit:     391043355ed36e52482392f1911d4f0513d8d0a6
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 28 14:49:23 2021 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Wed Dec 29 15:41:21 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=39104335

kde-apps/kajongg: Fix running with Python 3.10

See also: https://invent.kde.org/games/kajongg/-/merge_requests/6

Upstream commit b647417e16f6146f4ae89608fd0494e7780da862

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 .../kajongg/files/kajongg-21.08.3-python3.10.patch | 109 +++++++++++++++++++++
 ...gg-21.08.3.ebuild => kajongg-21.08.3-r1.ebuild} |   2 +
 ...gg-21.12.0.ebuild => kajongg-21.12.0-r1.ebuild} |   2 +
 3 files changed, 113 insertions(+)

diff --git a/kde-apps/kajongg/files/kajongg-21.08.3-python3.10.patch b/kde-apps/kajongg/files/kajongg-21.08.3-python3.10.patch
new file mode 100644
index 000000000000..d9f7e100309d
--- /dev/null
+++ b/kde-apps/kajongg/files/kajongg-21.08.3-python3.10.patch
@@ -0,0 +1,109 @@
+From b647417e16f6146f4ae89608fd0494e7780da862 Mon Sep 17 00:00:00 2001
+From: Antonio Rojas <arojas@archlinux.org>
+Date: Sat, 18 Dec 2021 10:13:32 +0000
+Subject: [PATCH] Fix running with Python 3.10
+
+---
+ src/board.py            | 10 +++++-----
+ src/genericdelegates.py |  2 +-
+ src/humanclient.py      |  4 ++--
+ src/qtreactor.py        |  2 +-
+ src/uitile.py           |  4 ++--
+ 5 files changed, 11 insertions(+), 11 deletions(-)
+
+diff --git a/src/board.py b/src/board.py
+index 2f52a47d..ed432c22 100644
+--- a/src/board.py
++++ b/src/board.py
+@@ -102,7 +102,7 @@ class PlayerWind(AnimatedMixin, QGraphicsObject, StrMixin):
+         """paint the marker"""
+         with Painter(painter):
+             painter.setBrush(self.__brush)
+-            size = Internal.scene.windTileset.faceSize.height()
++            size = int(Internal.scene.windTileset.faceSize.height())
+             ellRect = QRectF(QPoint(), QPoint(size, size))
+             painter.drawEllipse(ellRect)
+             renderer = Internal.scene.windTileset.renderer()
+@@ -112,7 +112,7 @@ class PlayerWind(AnimatedMixin, QGraphicsObject, StrMixin):
+ 
+     def boundingRect(self): # pylint: disable=no-self-use
+         """define the part of the tile we want to see"""
+-        size = Internal.scene.windTileset.faceSize.height() * 1.1
++        size = int(Internal.scene.windTileset.faceSize.height() * 1.1)
+         return QRectF(QPoint(), QPoint(size, size))
+ 
+     def __str__(self):
+@@ -878,11 +878,11 @@ class FittingView(QGraphicsView):
+         tRect = uiTile.boundingRect()
+         tRect = self.viewportTransform().mapRect(tRect)
+         pmapSize = QSize(
+-            tRect.width() * uiTile.scale,
+-            tRect.height() * uiTile.scale)
++            int(tRect.width() * uiTile.scale),
++            int(tRect.height() * uiTile.scale))
+         pMap = uiTile.pixmapFromSvg(pmapSize)
+         drag.setPixmap(pMap)
+-        drag.setHotSpot(QPoint(pMap.width() / 2, pMap.height() / 2))
++        drag.setHotSpot(QPoint(int(pMap.width() / 2), int(pMap.height() / 2)))
+         return drag
+ 
+ 
+diff --git a/src/genericdelegates.py b/src/genericdelegates.py
+index be99eb57..a4521177 100644
+--- a/src/genericdelegates.py
++++ b/src/genericdelegates.py
+@@ -64,7 +64,7 @@ class RichTextColumnDelegate(QStyledItemDelegate):
+         text = index.model().data(index)
+         self.document.setDefaultFont(option.font)
+         self.document.setHtml(text)
+-        return QSize(self.document.idealWidth() + 5,
++        return QSize(int(self.document.idealWidth()) + 5,
+                      option.fontMetrics.height())
+ 
+ 
+diff --git a/src/humanclient.py b/src/humanclient.py
+index 1d3f58f3..8edf848b 100644
+--- a/src/humanclient.py
++++ b/src/humanclient.py
+@@ -321,8 +321,8 @@ class ClientDialog(QDialog):
+             idx if vertical else 0,
+             idx if not vertical else 0)
+ 
+-        geometry.setWidth(width)
+-        geometry.setHeight(height)
++        geometry.setWidth(int(width))
++        geometry.setHeight(int(height))
+         self.setGeometry(geometry)
+ 
+     def showEvent(self, dummyEvent):
+diff --git a/src/qtreactor.py b/src/qtreactor.py
+index bda4782f..c24d01d0 100644
+--- a/src/qtreactor.py
++++ b/src/qtreactor.py
+@@ -250,7 +250,7 @@ class QtReactor(posixbase.PosixReactorBase):
+             timeout = 0
+         else:
+             timeout = self.timeout()
+-        self._timer.setInterval(timeout * 1000)
++        self._timer.setInterval(int(timeout * 1000))
+         self._timer.start()
+ 
+     def runReturn(self, installSignalHandlers=True):
+diff --git a/src/uitile.py b/src/uitile.py
+index 57e322bb..9e4b3f9d 100644
+--- a/src/uitile.py
++++ b/src/uitile.py
+@@ -250,8 +250,8 @@ class UITile(AnimatedMixin, QGraphicsObject, StrMixin):
+         if self.showFace():
+             faceSize = self.tileset.faceSize.toSize()
+             faceSize = QSize(
+-                faceSize.width() * xScale,
+-                faceSize.height() * yScale)
++                int(faceSize.width() * xScale),
++                int(faceSize.height() * yScale))
+             painter.translate(self.facePos())
+             renderer.render(painter, self.tileset.svgName[self.tile.exposed],
+                             QRectF(QPointF(), QSizeF(faceSize)))
+-- 
+GitLab
+

diff --git a/kde-apps/kajongg/kajongg-21.08.3.ebuild b/kde-apps/kajongg/kajongg-21.08.3-r1.ebuild
similarity index 95%
rename from kde-apps/kajongg/kajongg-21.08.3.ebuild
rename to kde-apps/kajongg/kajongg-21.08.3-r1.ebuild
index 7bb25ba3b606..254228048ce3 100644
--- a/kde-apps/kajongg/kajongg-21.08.3.ebuild
+++ b/kde-apps/kajongg/kajongg-21.08.3-r1.ebuild
@@ -37,6 +37,8 @@ RDEPEND="${DEPEND}
 	>=kde-apps/libkmahjongg-${PVCUT}:5
 "
 
+PATCHES=( "${FILESDIR}/${P}-python3.10.patch" )
+
 pkg_setup() {
 	python-single-r1_pkg_setup
 	ecm_pkg_setup

diff --git a/kde-apps/kajongg/kajongg-21.12.0.ebuild b/kde-apps/kajongg/kajongg-21.12.0-r1.ebuild
similarity index 94%
rename from kde-apps/kajongg/kajongg-21.12.0.ebuild
rename to kde-apps/kajongg/kajongg-21.12.0-r1.ebuild
index e6e07170fdd6..698f5a8e9bcd 100644
--- a/kde-apps/kajongg/kajongg-21.12.0.ebuild
+++ b/kde-apps/kajongg/kajongg-21.12.0-r1.ebuild
@@ -37,6 +37,8 @@ RDEPEND="${DEPEND}
 	>=kde-apps/libkmahjongg-${PVCUT}:5
 "
 
+PATCHES=( "${FILESDIR}/${PN}-21.08.3-python3.10.patch" )
+
 pkg_setup() {
 	python-single-r1_pkg_setup
 	ecm_pkg_setup


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: kde-apps/kajongg/, kde-apps/kajongg/files/
@ 2024-09-14 13:43 Andreas Sturmlechner
  0 siblings, 0 replies; 2+ messages in thread
From: Andreas Sturmlechner @ 2024-09-14 13:43 UTC (permalink / raw
  To: gentoo-commits

commit:     8749fab502c985af1c3dde0b573de4d5bad45770
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 14 13:41:37 2024 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Sat Sep 14 13:43:23 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8749fab5

kde-apps/kajongg: Fix runtime w/ dev-python/QtPy[pyside6] (w/o PyQt6)

Closes: https://bugs.gentoo.org/939423
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 .../files/kajongg-24.08.1-fix-w-o-pyqt6.patch      | 156 +++++++++++++++++++++
 kde-apps/kajongg/kajongg-24.08.1-r1.ebuild         |  49 +++++++
 2 files changed, 205 insertions(+)

diff --git a/kde-apps/kajongg/files/kajongg-24.08.1-fix-w-o-pyqt6.patch b/kde-apps/kajongg/files/kajongg-24.08.1-fix-w-o-pyqt6.patch
new file mode 100644
index 000000000000..5ac159bd13c3
--- /dev/null
+++ b/kde-apps/kajongg/files/kajongg-24.08.1-fix-w-o-pyqt6.patch
@@ -0,0 +1,156 @@
+From 2628e367759fab2ff9365b4ebaf1b76cc3e8c301 Mon Sep 17 00:00:00 2001
+From: Wolfgang Rohdewald <wolfgang@rohdewald.de>
+Date: Tue, 10 Sep 2024 22:07:43 +0200
+Subject: [PATCH 1/4] did not work with QT=API=PYSIDE2 anymore
+
+(cherry picked from commit 8354d9b0fda654c0520c6c97d96f8b9a2f1eec34)
+---
+ src/kajongg.py | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/src/kajongg.py b/src/kajongg.py
+index 5f369889..139a061c 100755
+--- a/src/kajongg.py
++++ b/src/kajongg.py
+@@ -15,7 +15,7 @@ import os
+ import logging
+ from typing import Tuple, List, Optional, Type, Any
+ 
+-from qtpy import QT5
++from qtpy import QT5, PYSIDE2
+ from qt import QObject, QCommandLineParser, QCommandLineOption, Qt, QGuiApplication
+ from kde import KApplication
+ from mi18n import i18n, MLocale
+@@ -190,4 +190,7 @@ from mainwindow import MainWindow
+ if QT5:
+     QGuiApplication.setAttribute(Qt.ApplicationAttribute.AA_UseHighDpiPixmaps, True)  # type:ignore[attr-defined]
+ MainWindow()
+-Internal.app.exec()
++if PYSIDE2:
++    Internal.app.exec_()
++else:
++    Internal.app.exec()
+-- 
+2.46.0
+
+
+From f47761e86c1c97fcce543437a580051f5bfdf6e1 Mon Sep 17 00:00:00 2001
+From: Wolfgang Rohdewald <wolfgang@rohdewald.de>
+Date: Tue, 10 Sep 2024 22:09:13 +0200
+Subject: [PATCH 2/4] Help/About did not work with QT5 anymore
+
+(cherry picked from commit 7b69cc0a7fd8a999a41b1f874460f9634d1b1bd9)
+---
+ src/kdestub.py | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/src/kdestub.py b/src/kdestub.py
+index 651137a8..0985b75f 100644
+--- a/src/kdestub.py
++++ b/src/kdestub.py
+@@ -42,7 +42,7 @@ from configparser import ConfigParser, NoSectionError, NoOptionError
+ 
+ # pylint: disable=wildcard-import,unused-wildcard-import
+ from qt import *
+-from qtpy import QT6, PYSIDE2, PYSIDE6, QT_VERSION, API_NAME, PYQT_VERSION
++from qtpy import QT5, QT6, PYSIDE2, PYSIDE6, QT_VERSION, API_NAME, PYQT_VERSION
+ if QT6:
+     # pylint:disable=no-name-in-module
+     from qtpy.QtCore import QKeyCombination  # type: ignore
+@@ -1130,7 +1130,11 @@ class AboutKajonggDialog(KDialog):
+     @staticmethod
+     def licenseFile() ->Optional[str]:
+         """which may currently only be 1: GPL_V2"""
+-        prefix = QLibraryInfo.location(QLibraryInfo.LibraryPath.PrefixPath)  # type:ignore[attr-defined]
++        if QT5:
++            # pyqt 2.3.0 does not seem to handle this
++            prefix = QLibraryInfo.location(QLibraryInfo.LibraryLocation.PrefixPath)  # type:ignore[attr-defined]
++        else:
++            prefix = QLibraryInfo.path(QLibraryInfo.LibraryPath.PrefixPath)  # type:ignore[attr-defined]
+         for path in ('COPYING', '../COPYING',
+                      f'{prefix}/share/kf5/licenses/GPL_V2'):
+             path = os.path.abspath(path)
+-- 
+2.46.0
+
+
+From 534d598b4d19149e984cce22fc5431091dd2d47c Mon Sep 17 00:00:00 2001
+From: Wolfgang Rohdewald <wolfgang@rohdewald.de>
+Date: Tue, 10 Sep 2024 22:10:23 +0200
+Subject: [PATCH 3/4] this should work with PYSIDE6 without PyQt6 being
+ installed
+
+(cherry picked from commit 3f12d305cc56814b72c561b36271494a21cf236d)
+---
+ src/qt.py | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/src/qt.py b/src/qt.py
+index 38679abc..b9cf96ca 100644
+--- a/src/qt.py
++++ b/src/qt.py
+@@ -150,6 +150,9 @@ elif QT6:
+         return sip.cast(obj, _type)
+ else:
+     HAVE_SIP = False
++    def sip_cast(obj, _type):
++        """hide not so nice things in qt.py"""
++        raise NotImplementedError
+ 
+ def modeltest_is_supported() ->bool:
+     """Is the QT binding supported."""
+@@ -158,7 +161,7 @@ def modeltest_is_supported() ->bool:
+     try:
+         _ = sip_cast(QSize(), QSize)
+         return True
+-    except TypeError:
++    except (TypeError, NotImplementedError):
+         return False
+ 
+ SIP_VERSION_STR = 'no sip'
+-- 
+2.46.0
+
+
+From b025fef86626f7b3af17924de8ca7ae1cdde6b87 Mon Sep 17 00:00:00 2001
+From: Wolfgang Rohdewald <wolfgang@rohdewald.de>
+Date: Thu, 12 Sep 2024 21:09:54 +0200
+Subject: [PATCH 4/4] workaround: qtpy sometimes uses PYQT6 bindings even if it
+ cannot find module PyQt6. See KDE bug 486171
+
+(cherry picked from commit 88a0beb61b97682307d5cd70aa61dd832759f293)
+---
+ src/qt.py | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/qt.py b/src/qt.py
+index b9cf96ca..0799f6c2 100644
+--- a/src/qt.py
++++ b/src/qt.py
+@@ -9,7 +9,7 @@ SPDX-License-Identifier: GPL-2.0
+ 
+ # pylint: disable=unused-import
+ 
+-from qtpy import uic, QT5, QT6
++from qtpy import uic, QT5, QT6, PYQT5, PYQT6
+ from qtpy.QtCore import QAbstractAnimation
+ from qtpy.QtCore import QAbstractItemModel
+ from qtpy.QtCore import QAbstractTableModel
+@@ -138,12 +138,12 @@ from qtpy.QtSvg import QSvgRenderer
+ # pylint:disable=c-extension-no-member
+ 
+ HAVE_SIP = True
+-if QT5:
++if PYQT5:
+     from PyQt5 import sip
+     def sip_cast(obj, _type):
+         """hide not so nice things in qt.py"""
+         return sip.cast(obj, _type)
+-elif QT6:
++elif PYQT6:
+     from PyQt6 import sip  # type:ignore[no-redef]
+     def sip_cast(obj, _type):
+         """hide not so nice things in qt.py"""
+-- 
+2.46.0
+

diff --git a/kde-apps/kajongg/kajongg-24.08.1-r1.ebuild b/kde-apps/kajongg/kajongg-24.08.1-r1.ebuild
new file mode 100644
index 000000000000..b33c2a7a6bca
--- /dev/null
+++ b/kde-apps/kajongg/kajongg-24.08.1-r1.ebuild
@@ -0,0 +1,49 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+ECM_HANDBOOK="forceoptional"
+PYTHON_COMPAT=( python3_{10..12} )
+PVCUT=$(ver_cut 1-3)
+KFMIN=6.5.0
+QTMIN=6.7.2
+inherit python-single-r1 ecm gear.kde.org
+
+DESCRIPTION="Classical Mah Jongg for four players"
+HOMEPAGE="https://apps.kde.org/kajongg/"
+
+LICENSE="GPL-2" # TODO: CHECK
+SLOT="6"
+KEYWORDS="~amd64 ~arm64"
+IUSE=""
+
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+DEPEND="${PYTHON_DEPS}
+	dev-db/sqlite:3
+	>=dev-qt/qtbase-${QTMIN}:6[gui,widgets]
+	>=dev-qt/qtsvg-${QTMIN}:6
+	>=kde-apps/libkdegames-${PVCUT}:6
+	>=kde-frameworks/ki18n-${KFMIN}:6
+	|| ( dev-python/QtPy[pyqt6] dev-python/QtPy[pyside6] )
+	$(python_gen_cond_dep '
+		dev-python/QtPy[gui,svg,widgets,${PYTHON_USEDEP}]
+		>=dev-python/twisted-16.6.0[${PYTHON_USEDEP}]
+	')
+"
+RDEPEND="${DEPEND}
+	>=kde-apps/libkmahjongg-${PVCUT}:6
+"
+
+PATCHES=( "${FILESDIR}/${P}-fix-w-o-pyqt6.patch" ) # bug 939423
+
+pkg_setup() {
+	python-single-r1_pkg_setup
+	ecm_pkg_setup
+}
+
+src_prepare() {
+	python_fix_shebang src
+	ecm_src_prepare
+}


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-09-14 13:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-14 13:43 [gentoo-commits] repo/gentoo:master commit in: kde-apps/kajongg/, kde-apps/kajongg/files/ Andreas Sturmlechner
  -- strict thread matches above, loose matches on Subject: below --
2021-12-29 15:42 Andreas Sturmlechner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox