Additional cleanup/reorg of compareBundleVersion(). Thanks to Aaron Hall.

git-svn-id: http://munki.googlecode.com/svn/trunk@507 a4e17f2e-e282-11dd-95e1-755cbddbdd66
This commit is contained in:
Greg Neagle
2010-03-12 17:36:53 +00:00
parent 781dda8287
commit 362ca4dce0
+6 -4
View File
@@ -416,21 +416,23 @@ def compareBundleVersion(item):
-2 if there's an error in the input
"""
if 'path' in item and 'CFBundleShortVersionString' in item:
filepath = os.path.join(item['path'], 'Contents', 'Info.plist')
vers = item['CFBundleShortVersionString']
else:
munkicommon.display_error("Missing bundle path or version!")
return -2
munkicommon.display_debug1("Checking %s for version %s..." %
(filepath, vers))
munkicommon.display_debug1("Checking bundle %s for version %s..." %
(item['path'], vers))
filepath = os.path.join(item['path'], 'Contents', 'Info.plist')
if not os.path.exists(filepath):
munkicommon.display_debug1("\tNo Info.plist found at %s" % filepath)
filepath = os.path.join(item['path'], 'Resources', 'Info.plist')
if not os.path.exists(filepath):
munkicommon.display_debug1(
"\tNo Info.plist found at %s" % filepath)
return 0
munkicommon.display_debug1("\tFound Info.plist at %s" % filepath)
try:
pl = FoundationPlist.readPlist(filepath)
except FoundationPlist.NSPropertyListSerializationException: