Created
October 2, 2013 19:25
-
-
Save Halicea/6799164 to your computer and use it in GitHub Desktop.
python_install_ios_provisioning_profile
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 sys | |
| import codecs | |
| from subprocess import call | |
| import shutil | |
| from os.path import expanduser | |
| profiles_dir = expanduser("~/Library/MobileDevice/Provisioning Profiles") | |
| import argparse | |
| def get_id(path): | |
| f = open(path, 'r') | |
| t = f.read() | |
| ind = t.index('<key>UUID</key>\n')+len('<key>UUID</key>\n') | |
| l = t.index('<string>', ind)+len('<string>') | |
| r = t.index('</string>', ind) | |
| return t[l:r] | |
| def install_profile(path): | |
| id = get_id(path) | |
| shutil.copy(path, os.path.join(profiles_dir, '%s.mobileprovision'%id)) | |
| def uninstall_profile(path): | |
| id = get_id(path) | |
| os.remove(os.path.join(profiles_dir, '%s.mobileprovision'%id)) | |
| if __name__=='__main__': | |
| parser = argparse.ArgumentParser(prog="iOS Provisioning Profiles Utility") | |
| parser.add_argument('f') | |
| parser.add_argument('--install') | |
| parser.add_argument('--uninstall') | |
| args = parser.parse_args(sys.argv[1:]) | |
| if args.install: | |
| install_profile(args.f) | |
| elif args.uninstall: | |
| uninstall_profile(args.f) | |
| #install_profile(sys.argv[1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment