Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package krita for openSUSE:Factory checked in at 2026-04-21 12:45:56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/krita (Old) and /work/SRC/openSUSE:Factory/.krita.new.11940 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "krita" Tue Apr 21 12:45:56 2026 rev:91 rq:1348169 version:5.3.1 Changes: -------- --- /work/SRC/openSUSE:Factory/krita/krita.changes 2026-04-07 16:47:42.977589508 +0200 +++ /work/SRC/openSUSE:Factory/.krita.new.11940/krita.changes 2026-04-21 12:47:55.498150328 +0200 @@ -1,0 +2,6 @@ +Mon Apr 20 08:29:55 UTC 2026 - Christophe Marin <[email protected]> + +- Add upstream fix to fix PyQt initialization (kde#518163) + * 0001-Disallow-importing-conflicting-version-of-PyQt.patch + +------------------------------------------------------------------- New: ---- 0001-Disallow-importing-conflicting-version-of-PyQt.patch ----------(New B)---------- New:- Add upstream fix to fix PyQt initialization (kde#518163) * 0001-Disallow-importing-conflicting-version-of-PyQt.patch ----------(New E)---------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ krita.spec ++++++ --- /var/tmp/diff_new_pack.ZULwBc/_old 2026-04-21 12:47:57.398229145 +0200 +++ /var/tmp/diff_new_pack.ZULwBc/_new 2026-04-21 12:47:57.402229311 +0200 @@ -44,6 +44,8 @@ Source1: https://download.kde.org/stable/krita/%{pkg_version}/krita-%{pkg_version}.tar.xz.sig Source2: krita.keyring %endif +# PATCH-FIX-UPSTREAM +Patch0: 0001-Disallow-importing-conflicting-version-of-PyQt.patch BuildRequires: %{pyver}-devel BuildRequires: %{pyver}-qt5-devel BuildRequires: %{pyver}-sip-devel ++++++ 0001-Disallow-importing-conflicting-version-of-PyQt.patch ++++++ >From f6d7040613dd49aa47e74f7c55590f3e553125c9 Mon Sep 17 00:00:00 2001 From: Freya Lupen <[email protected]> Date: Fri, 27 Mar 2026 15:27:50 -0500 Subject: [PATCH] Disallow importing conflicting version of PyQt This replaces the sys.path modification with a better hack. Now we simply override builtins.__import__ to raise a ModuleNotFoundError if an attempt is made to load the wrong PyQt. BUG:518163 --- .../pykrita/plugin/krita/__init__.py | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/plugins/extensions/pykrita/plugin/krita/__init__.py b/plugins/extensions/pykrita/plugin/krita/__init__.py index 9ce40f2..b691691 100644 --- a/plugins/extensions/pykrita/plugin/krita/__init__.py +++ b/plugins/extensions/pykrita/plugin/krita/__init__.py @@ -8,18 +8,6 @@ import pykrita import os import sys -# Try to make sure there's no conflicting version of PyQt on sys.path, because -# loading that would load a conflicting version of Qt and crash Krita when used. -# However, this will also cause any neighboring modules to be removed. -import importlib.util -pyqt_wrong = "PyQt" + ("6" if pykrita.qt_major_version() == 5 else "5") -if (spec := importlib.util.find_spec(pyqt_wrong)): - parent_folder = os.path.dirname(os.path.dirname(spec.origin)) - if sys.path.__contains__(parent_folder): - print(f"Found {pyqt_wrong} in '{parent_folder}', " - "removing from Python's search path to avoid crashes.", file=sys.stderr) - sys.path.remove(parent_folder) - # Look for PyQt try: from PyQt6 import QtCore @@ -31,6 +19,21 @@ except ImportError: print("Please make sure, that the needed packages are installed.", file=sys.stderr) raise +import builtins + +# Disallow importing a conflicting version of PyQt, +# which would load a conflicting version of Qt and crash Krita when used. +pyqt_wrong = "PyQt" + ("6" if pykrita.qt_major_version() == 5 else "5") +import_real = builtins.__import__ +def importAvoidWrongPyQtHack(name, globals=None, locals=None, fromlist=(), level=0): + if name == pyqt_wrong or name.startswith(pyqt_wrong+"."): + raise(ModuleNotFoundError( + f"This version of Krita is not compatible with {pyqt_wrong}!", + name=name)) + else: + return import_real(name, globals, locals, fromlist, level) +builtins.__import__ = importAvoidWrongPyQtHack + from .api import * from .decorators import * from .dockwidgetfactory import * @@ -47,10 +50,6 @@ print("%s added to PYTHONPATH" % krita_path, file=sys.stderr) import excepthook excepthook.install() -if sys.version_info[0] > 2: - import builtins -else: - import __builtin__ as builtins builtins.i18n = Krita.krita_i18n builtins.i18nc = Krita.krita_i18nc builtins.Scripter = Krita.instance() -- 2.53.0
