[gnome-shell] Make "gnome-shell --create-extension" compatible with Python 2.5



commit 45f4292259672bd21495d9ed45d765b1f0635092
Author: Siegfried-Angel Gevatter Pujals <rainct ubuntu com>
Date:   Fri Dec 18 20:22:51 2009 +0100

    Make "gnome-shell --create-extension" compatible with Python 2.5
    
    Fallback to using the json-py module on systems with a Python
    version older than 2.6 (which introduced native JSON support).

 src/gnome-shell.in |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/src/gnome-shell.in b/src/gnome-shell.in
index 62c86d6..2142c8f 100644
--- a/src/gnome-shell.in
+++ b/src/gnome-shell.in
@@ -260,7 +260,11 @@ use an extension title clicktofocus janedoe example com '''
              'description': description,
              'uuid': uuid }
     f = open(os.path.join(extension_path, 'metadata.json'), 'w')
-    json.dump(meta, f)
+    try:
+        json.dump(meta, f)
+    except AttributeError:
+        # For Python versions older than 2.6, try using the json-py module
+        f.write(json.write(meta) + '\n')
     f.close()
 
     extensionjs_path = os.path.join(extension_path, 'extension.js')



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]