def comparePlistVersion(item):
    version_comparison_key = item.get(
        'version_comparison_key', 'CFBundleShortVersionString')
    if 'path' in item and version_comparison_key in item:
        versionstring = item[version_comparison_key]
        filepath = item['path']
        minupvers = item.get('minimum_update_version')
    else:
        raise munkicommon.Error('Missing plist path or version!')

    munkicommon.display_debug1('\tChecking %s for %s %s...',
                               filepath, version_comparison_key, versionstring)
    if not os.path.exists(filepath):
        munkicommon.display_debug1('\tNo plist found at %s', filepath)
        return 0

    try:
        plist = FoundationPlist.readPlist(filepath)
    except FoundationPlist.NSPropertyListSerializationException:
        munkicommon.display_debug1('\t%s may not be a plist!', filepath)
        return 0
    if not hasattr(plist, 'get'):
        munkicommon.display_debug1(
            'plist not parsed as NSCFDictionary: %s', filepath)
        return 0

    if 'version_comparison_key' in item:
        # specific key has been supplied,
        # so use this to determine installed version
        munkicommon.display_debug1(
            '\tUsing version_comparison_key %s', version_comparison_key)
        installedvers = munkicommon.getVersionString(
            plist, version_comparison_key)
    else:
        # default behavior
        installedvers = munkicommon.getVersionString(plist)
    if installedvers:
        munkicommon.display_debug1(
            '\tInstalled item has version %s', installedvers)
        if minupvers:
            if compareVersions(installedvers, minupvers) < 1:
                munkicommon.display_debug1(
                    '\tVersion %s too old < %s', installedvers, minupvers)
                return 0
        compare_result = compareVersions(installedvers, versionstring)
        results = ['older', 'not installed?!', 'the same', 'newer']
        munkicommon.display_debug1('\tInstalled item is %s.',
                                   results[compare_result + 1])
        return compare_result
    else:
        munkicommon.display_debug1('\tNo version info in %s.', filepath)
        return 0
Gets the version string from the plist at path and compares versions.
dataset/ETHPy150Open munki/munki/code/client/munkilib/updatecheck.py/comparePlistVersion