- 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:
Dirk Mueller 2023-11-21 13:40:17 +00:00 committed by Git OBS Bridge
parent 458767b735
commit 744ed83922
3 changed files with 96 additions and 9 deletions

View File

@ -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>
@ -380,23 +386,23 @@ Thu Nov 8 17:02:01 UTC 2018 - Todd R <toddrme2178@gmail.com>
- Update to Version 1.5.2
* Fix tests
* Add support for PySide2.QtOpenGL
* Add support for PySide2.QtOpenGL
- Update to Version 1.5.1
* Make PythonQtError inherit from RuntimeError to be easily
catchable
- Update to Version 1.5
+ New features
+ New features
* Add support for QtLocation, QtMultimediaWidgets, QtQml,
QtQuick, QtWebChannel, QtWebSockets and QtXmlPatterns.
* Raise an error when trying to use the wrong combination of
macOS and Qt versions.
+ Issues Closed
macOS and Qt versions.
+ Issues Closed
* Issue 155 - Add warnings for Qt 5.9 in macOS 10.9 and
Qt 5.11 and macOS 10.11 (PR 168)
* Issue 153 - Shim PyQt5 ToPyDateTime for compatibility with
PySide2 (PR 169)
* Issue 123 - Wrap QWebChannel module (PR 157)
+ Pull Requests Merged
* Issue 123 - Wrap QWebChannel module (PR 157)
+ Pull Requests Merged
* PR 169 - Shim PyQt5 QDateTime.toPyDateTime to
QDateTime.toPython for compatibility with PySide2 (153)
* PR 168 - Raise error when trying to use the wrong
@ -406,7 +412,7 @@ Thu Nov 8 17:02:01 UTC 2018 - Todd R <toddrme2178@gmail.com>
* PR 162 - Update readme to remove funding appeal, harmonize
with other readmes and minor fixes
* PR 161 - Fix pyside2 wheels install
* PR 157 - Add more Qt modules (123)
* PR 157 - Add more Qt modules (123)
-------------------------------------------------------------------
Thu May 31 15:38:45 UTC 2018 - toddrme2178@gmail.com
@ -450,7 +456,7 @@ Sat Apr 28 19:47:37 UTC 2018 - toddrme2178@gmail.com
* Pin PyQt5 to 5.9.2 in CircleCI because 5.10 is generating segfaults
* If a Qt binding is already imported, then use it.
* Add QtSql wrapper (incl. test)
* Changes to QDesktop split
* Changes to QDesktop split
* Add QtHelp Wrapper
-------------------------------------------------------------------

View File

@ -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
View 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