Last active
May 12, 2017 12:30
-
-
Save ronanrodrigo/7b75cc3f81201494f2230aaef5efb6df to your computer and use it in GitHub Desktop.
Get app version @ Info.plist
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import plistlib | |
def main(): | |
file = os.path.expanduser('path/to/Info.plist') | |
if os.path.exists(file): | |
plist_file = plistlib.readPlist(file) | |
print("{0} ({1})".format(plist_file['CFBundleShortVersionString'], plist_file['CFBundleVersion'])) # Ex. 1.0 (0) | |
else: | |
print('File %s does not exist' % file) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Another approach is to use PlistBuddy with shell script...