[kde-workspace] fix loading of Python2 plasmoids

Lukas Tinkl ltinkl at fedoraproject.org
Mon Oct 1 11:04:18 UTC 2012


commit bed89b564a4945423987c8fa56a822372b2fd858
Author: Lukas Tinkl <lukas at kde.org>
Date:   Mon Oct 1 13:04:11 2012 +0200

    fix loading of Python2 plasmoids

 kde-workspace-4.9.2-devicenotifier-freespace.patch |   43 -------------------
 kde-workspace-4.9.3-py2plasmoids.patch             |   44 ++++++++++++++++++++
 kde-workspace.spec                                 |   10 +++-
 3 files changed, 51 insertions(+), 46 deletions(-)
---
diff --git a/kde-workspace-4.9.3-py2plasmoids.patch b/kde-workspace-4.9.3-py2plasmoids.patch
new file mode 100644
index 0000000..db5c2bf
--- /dev/null
+++ b/kde-workspace-4.9.3-py2plasmoids.patch
@@ -0,0 +1,44 @@
+commit 92c79ebd767fd90eafa1e3865bfbbddcfa695c08
+Author: Luca Beltrame <lbeltrame at kde.org>
+Date:   Mon Oct 1 11:02:10 2012 +0200
+
+    Unbreak Python 2 applet loading.
+    
+    exec() is a function in Py3, but the syntax used in this file does not
+    allow it for being called as a function in Python 2. Thus, a simple check
+    is made, calling the right function depending on the Python version.
+    
+    It will likely not work with Python 3, but however applets are not
+    supposed to in the first place.
+    
+    CCMAIL: release-team at kde.org
+    CCMAIL: kde-packager at kde.org
+    
+    (cherry picked from commit 14f7b6a18ef8a81237df43551ee7bda122827d93)
+
+diff --git a/plasma/generic/scriptengines/python/plasma_importer.py b/plasma/generic/scriptengines/python/plasma_importer.py
+index 8d75f88..dae245a 100644
+--- a/plasma/generic/scriptengines/python/plasma_importer.py
++++ b/plasma/generic/scriptengines/python/plasma_importer.py
+@@ -22,6 +22,9 @@ import sys
+ import os
+ import imp
+ 
++PY3 = sys.version_info[0] == 3
++
++
+ class PlasmaImporter(object):
+     def __init__(self):
+         self.toplevel = {}
+@@ -104,7 +107,10 @@ class PlasmaImporter(object):
+             mod.__path__ = [self.marker]
+         if code is not None:
+             try:
+-                exec (code in mod.__dict__)
++                if PY3:
++                    exec(code in mod.__dict__)
++                else:
++                    exec code in mod.__dict__
+             finally:
+                 code.close()
+         return mod
diff --git a/kde-workspace.spec b/kde-workspace.spec
index 5352cdb..1cae661 100644
--- a/kde-workspace.spec
+++ b/kde-workspace.spec
@@ -11,7 +11,7 @@
 Summary: KDE Workspace
 Name:    kde-workspace
 Version: 4.9.2
-Release: 1%{?dist}
+Release: 2%{?dist}
 
 License: GPLv2
 URL:     https://projects.kde.org/projects/kde/kde-workspace
@@ -119,8 +119,8 @@ Patch59: kde-workspace-4.9.0-fontconfigdir.patch
 
 ## upstream patches
 
-# fix device notifier Free Space meter
-Patch101: kde-workspace-4.9.2-devicenotifier-freespace.patch
+# fix Python2 plasmoids
+Patch101: kde-workspace-4.9.3-py2plasmoids.patch
 
 ## plasma active patches
 # adapted version of wac-html-widgets.patch
@@ -458,6 +458,7 @@ Requires: akonadi
 %patch59 -p1 -b fontconfigdir
 
 # upstream patches
+%patch101 -p1 -b .py2plasmoids
 
 # plasma-active
 %patch153 -p1 -b .wac-html-widgets
@@ -1009,6 +1010,9 @@ fi
 
 
 %changelog
+* Mon Oct 01 2012 Lukáš Tinkl <ltinkl at redhat.com> - 4.9.2-2
+- fix loading of Python2 plasmoids
+
 * Fri Sep 28 2012 Rex Dieter <rdieter at fedoraproject.org> - 4.9.2-1
 - 4.9.2
 


More information about the scm-commits mailing list