- add qt6.6-deprecations.patch to avoid deprecation warnings
with qt 6.6 * Add support for PySide2.QtOpenGL + New features macOS and Qt versions. + Issues Closed * Issue 123 - Wrap QWebChannel module (PR 157) + Pull Requests Merged * PR 157 - Add more Qt modules (123) * Changes to QDesktop split OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-QtPy?expand=0&rev=48
This commit is contained in:
parent
458767b735
commit
744ed83922
@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Nov 21 13:39:59 UTC 2023 - Dirk Müller <dmueller@suse.com>
|
||||
|
||||
- add qt6.6-deprecations.patch to avoid deprecation warnings
|
||||
with qt 6.6
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Nov 21 07:34:39 UTC 2023 - ecsos <ecsos@opensuse.org>
|
||||
|
||||
|
@ -44,6 +44,8 @@ License: MIT
|
||||
Group: Development/Languages/Python
|
||||
URL: https://github.com/spyder-ide/qtpy
|
||||
Source: https://files.pythonhosted.org/packages/source/Q/QtPy/QtPy-%{version}.tar.gz
|
||||
# from https://github.com/spyder-ide/qtpy/pull/466
|
||||
Patch1: qt6.6-deprecations.patch
|
||||
BuildRequires: %{python_module base >= 3.7}
|
||||
BuildRequires: %{python_module packaging}
|
||||
BuildRequires: %{python_module pip}
|
||||
@ -116,7 +118,7 @@ This subpackage separately provides the qtpy.tests module
|
||||
in order to avoid stupid rpmlint errors.
|
||||
|
||||
%prep
|
||||
%setup -q -n QtPy-%{version}
|
||||
%autosetup -p1 -n QtPy-%{version}
|
||||
# wrong EOL encondig
|
||||
sed -i 's/\r$//' LICENSE.txt *.md
|
||||
# qtcharts is present in our PyQt
|
||||
|
79
qt6.6-deprecations.patch
Normal file
79
qt6.6-deprecations.patch
Normal file
@ -0,0 +1,79 @@
|
||||
From ae51371ebb87f8f4038b0ab3ed5a5402be7610d4 Mon Sep 17 00:00:00 2001
|
||||
From: StSav012 <stsav012@gmail.com>
|
||||
Date: Fri, 27 Oct 2023 14:37:26 +0300
|
||||
Subject: [PATCH] Restore `QSqlDatabase.exec` deprecated in 6.6
|
||||
|
||||
---
|
||||
qtpy/QtSql.py | 49 ++++++++++++++++++++++++++++++++++++-------------
|
||||
1 file changed, 36 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/qtpy/QtSql.py b/qtpy/QtSql.py
|
||||
index 76a63760..d8e0f2d9 100644
|
||||
--- a/qtpy/QtSql.py
|
||||
+++ b/qtpy/QtSql.py
|
||||
@@ -6,29 +6,52 @@
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
"""Provides QtSql classes and functions."""
|
||||
+from functools import partialmethod
|
||||
|
||||
-from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6
|
||||
+from packaging.version import parse
|
||||
+
|
||||
+from . import PYQT5, PYQT6, PYSIDE2, PYSIDE6, QT_VERSION
|
||||
|
||||
if PYQT5:
|
||||
from PyQt5.QtSql import *
|
||||
elif PYQT6:
|
||||
from PyQt6.QtSql import *
|
||||
|
||||
- QSqlDatabase.exec_ = lambda self, *args, **kwargs: self.exec(
|
||||
- *args,
|
||||
- **kwargs,
|
||||
- )
|
||||
- QSqlQuery.exec_ = lambda self, *args, **kwargs: self.exec(*args, **kwargs)
|
||||
- QSqlResult.exec_ = lambda self, *args, **kwargs: self.exec(*args, **kwargs)
|
||||
+ if parse(QT_VERSION) >= parse("6.6"):
|
||||
+ # `QSqlDatabase.exec` is deprecated since 6.6
|
||||
+
|
||||
+ def database_exec(db, query):
|
||||
+ q = QSqlQuery(db)
|
||||
+ q.exec(query)
|
||||
+ return q
|
||||
+
|
||||
+ QSqlDatabase.exec = partialmethod(database_exec)
|
||||
+ del database_exec
|
||||
+
|
||||
+ QSqlDatabase.exec_ = partialmethod(QSqlDatabase.exec)
|
||||
+ QSqlQuery.exec_ = partialmethod(QSqlQuery.exec)
|
||||
+ QSqlResult.exec_ = partialmethod(QSqlResult.exec)
|
||||
elif PYSIDE6:
|
||||
from PySide6.QtSql import *
|
||||
|
||||
+ if parse(QT_VERSION) >= parse("6.6"):
|
||||
+ # `QSqlDatabase.exec` is deprecated since 6.6
|
||||
+
|
||||
+ def database_exec(db, query):
|
||||
+ q = QSqlQuery(db)
|
||||
+ q.exec(query)
|
||||
+ return q
|
||||
+
|
||||
+ QSqlDatabase.exec = partialmethod(database_exec)
|
||||
+ del database_exec
|
||||
+
|
||||
# Map DeprecationWarning methods
|
||||
- QSqlDatabase.exec_ = lambda self, *args, **kwargs: self.exec(
|
||||
- *args,
|
||||
- **kwargs,
|
||||
- )
|
||||
- QSqlQuery.exec_ = lambda self, *args, **kwargs: self.exec(*args, **kwargs)
|
||||
- QSqlResult.exec_ = lambda self, *args, **kwargs: self.exec(*args, **kwargs)
|
||||
+ QSqlDatabase.exec_ = partialmethod(QSqlDatabase.exec)
|
||||
+ QSqlQuery.exec_ = partialmethod(QSqlQuery.exec)
|
||||
+ QSqlResult.exec_ = partialmethod(QSqlResult.exec)
|
||||
elif PYSIDE2:
|
||||
from PySide2.QtSql import *
|
||||
+
|
||||
+del PYQT5, PYQT6, PYSIDE2, PYSIDE6, QT_VERSION
|
||||
+del parse
|
||||
+del partialmethod
|
Loading…
Reference in New Issue
Block a user