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
import plistlib
import urllib2
catalog_url = ''
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