From 7b2756c41758aaa308a8a324fa3e20338d6933af Mon Sep 17 00:00:00 2001 From: snowleung Date: Mon, 25 Feb 2013 16:51:11 +0800 Subject: [PATCH] Add: use key name to get the value from mobile provision file --- README.mdown | 4 ++++ mobile_provision.py | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/README.mdown b/README.mdown index 89f062e..a41bf0d 100644 --- a/README.mdown +++ b/README.mdown @@ -33,6 +33,10 @@ If you run it, it will display the contents of the mobile provision file: $ python mobile_provision.py app.mobileprovision +or +your can try 'uuid' to get uuid in mobileprovision file + $ python mobile_provision.py app.mobileprovision uuid + [mobile provision]: http://developer.apple.com/iphone/library/documentation/Xcode/Conceptual/iphone_development/128-Managing_Devices/devices.html update_strings.py diff --git a/mobile_provision.py b/mobile_provision.py index 7e064be..13c0c44 100644 --- a/mobile_provision.py +++ b/mobile_provision.py @@ -96,6 +96,17 @@ def main(): logging.error(exc) return 2 + if len(sys.argv) > 2: + if not sys.argv[2].islower(): + logging.warning("warning:key argurment should be lower, %s -> %s",sys.argv[2], sys.argv[2].lower()) + pl_dict_key = sys.argv[2].lower() + try: + print '%s: %s' % (pl_dict_key, getattr(mobile_provision,pl_dict_key)) + except AttributeError: + logging.error('"%s" key not in your mobile provision file! \ntry this key:\n %s', pl_dict_key, + [att for att in dir(mobile_provision) if str(att).find('__') == -1]) + return 0 + logging.debug('Name: %s', mobile_provision) logging.debug('UUID: %s', mobile_provision.uuid) logging.debug(