old_contents: # Update uProxy version in all relevant places.
  #
  # Run with:
  # python version.py <new version>
  # e.g. python version.py 0.8.10
  
  import json
  import collections
  import sys
  import re
  
  manifest_files = [
            'src/chrome/app/dist_build/manifest.json',
            'src/chrome/app/dev_build/manifest.json',
            'src/chrome/extension/dist_build/manifest.json',
            'src/chrome/extension/dev_build/manifest.json',
            'src/firefox/package.json',
            'package.json',
            'bower.json',
          ]
  
  validVersion = re.match('[0-9]+\.[0-9]+\.[0-9]+', sys.argv[1])
  if validVersion == None:
    print 'Please enter a valid version number.'
    sys.exit()
  
  for filename in manifest_files:
    print filename
    with open(filename) as manifest:
      manifest_data = json.load(manifest, object_pairs_hook=collections.OrderedDict)
      manifest_data['version'] = sys.argv[1]
    with open(filename, 'w') as dist_manifest:
      json.dump(manifest_data, dist_manifest, indent=2, separators=(',', ': '))
      dist_manifest.write('\n');
  
new_contents: # Update uProxy version in all relevant places.
  #
  # Run with:
  # python version.py <new version>
  # e.g. python version.py 0.8.10
  
  import json
  import collections
  import sys
  import re
  
  manifest_files = [
            'src/chrome/app/manifest.json',
            'src/chrome/extension/manifest.json',
            'src/firefox/package.json',
            'package.json',
            'bower.json',
          ]
  
  validVersion = re.match('[0-9]+\.[0-9]+\.[0-9]+', sys.argv[1])
  if validVersion == None:
    print 'Please enter a valid version number.'
    sys.exit()
  
  for filename in manifest_files:
    print filename
    with open(filename) as manifest:
      manifest_data = json.load(manifest, object_pairs_hook=collections.OrderedDict)
      manifest_data['version'] = sys.argv[1]
    with open(filename, 'w') as dist_manifest:
      json.dump(manifest_data, dist_manifest, indent=2, separators=(',', ': '))
      dist_manifest.write('\n');
  
subject: Update manifest files being bumped.