Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Get the localized "Marketing Name" for a Mac
import sys
import plistlib
import subprocess
from Cocoa import NSBundle
if (len(sys.argv) == 2):
model = sys.argv[1]
model = subprocess.check_output(["/usr/sbin/sysctl", "-n", "hw.model"]).strip()
sysinfofile=serverInfoBundle.URLForResource_withExtension_subdirectory_("SIMachineAttributes", "plist", "")
plist = plistlib.readPlist(sysinfofile.path())
if (model in plist):
print plist[model]["_LOCALIZABLE_"]["marketingModel"]
print "%s not found" % (model)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment