Fixed edge case in getVersionString() where package's Info.plist contains empty CFBundleShortVersionString or empty CFBundleVersion.

git-svn-id: http://munki.googlecode.com/svn/trunk@435 a4e17f2e-e282-11dd-95e1-755cbddbdd66
This commit is contained in:
Greg Neagle
2010-02-03 20:20:16 +00:00
parent 01180408a9
commit 2bb654567c

View File

@@ -598,7 +598,7 @@ def getVersionString(pl):
# else if there's a CFBundleVersion, returns that
# else returns an empty string.
CFBundleShortVersionString = ''
if 'CFBundleShortVersionString' in pl:
if pl.get('CFBundleShortVersionString'):
CFBundleShortVersionString = \
pl['CFBundleShortVersionString'].split()[0]
if "Bundle versions string, short" in pl:
@@ -612,7 +612,7 @@ def getVersionString(pl):
CFBundleShortVersionString = \
CFBundleShortVersionString.replace(',','.')
return CFBundleShortVersionString
if 'CFBundleVersion' in pl:
if pl.get('CFBundleVersion'):
# no CFBundleShortVersionString, or bad one
CFBundleVersion = str(pl['CFBundleVersion']).split()[0]
if CFBundleVersion[0] in "0123456789":