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).
This commit is contained in:
Siegfried-Angel Gevatter Pujals 2009-12-18 20:22:51 +01:00
parent 288eae91e2
commit 45f4292259

View File

@ -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')
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')