Skip to content

Instantly share code, notes, and snippets.

@johnnyg
Created April 25, 2012 21:45
Show Gist options
  • Save johnnyg/2493762 to your computer and use it in GitHub Desktop.
Save johnnyg/2493762 to your computer and use it in GitHub Desktop.
Allows you to manually upgrade the metadata files of gnome-shell extensions
#!/usr/bin/env python2
# Example usage: find ~/.local/share/gnome-shell/extensions/ -name 'metadata.json' -print0 | xargs -0 gnome-shell-extension-upgrade 3.4
import json
import sys
new_version = unicode(sys.argv[1])
for filename in sys.argv[2:]:
metadata = json.load(open(filename, "rb"))
if new_version not in metadata['shell-version']:
metadata['shell-version'].append(new_version)
json.dump(metadata, open(filename, "wb"))
print "Upgraded '%s' to '%s'" % (metadata['name'], new_version)
else:
print "'%s' is already up-to-date" % metadata['name']
import json
import sys
new_version = unicode(sys.argv[1])
for filename in sys.argv[2:]:
metadata = json.load(open(filename, "rb"))
if new_version not in metadata['shell-version']:
metadata['shell-version'].append(new_version)
json.dump(metadata, open(filename, "wb"))
print "Upgraded '%s' to '%s'" % (metadata['name'], new_version)
else:
print "'%s' is already up-to-date" % metadata['name']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment