From 45f4292259672bd21495d9ed45d765b1f0635092 Mon Sep 17 00:00:00 2001 From: Siegfried-Angel Gevatter Pujals Date: Fri, 18 Dec 2009 20:22:51 +0100 Subject: [PATCH] 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 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gnome-shell.in b/src/gnome-shell.in index 62c86d604..2142c8f02 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')