Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
sums up the values of the Size keys of Packages in Yosemite's sucatalog
#!/usr/bin/python
import plistlib
import urllib2
catalog_url = 'http://swscan.apple.com/content/catalogs/others/index-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog'
total_size = 0.0
yoyo_sucatalog = urllib2.urlopen(catalog_url).read()
yoyo_plist = plistlib.readPlistFromString(yoyo_sucatalog)
yoyo_prod = yoyo_plist['Products']
for k in yoyo_prod:
for item in yoyo_prod[k]['Packages']:
total_size += item['Size']
print str(total_size / 1073741824) + ' GiB'
print str(total_size / 1000000000) + ' GB'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment