OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/python |
| 2 # Copyright (c) 2015 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. |
| 5 |
| 6 import subprocess |
| 7 import sys |
| 8 import re |
| 9 |
| 10 def ListIdentities(): |
| 11 return subprocess.check_output([ |
| 12 '/usr/bin/env', |
| 13 'xcrun', |
| 14 'security', |
| 15 'find-identity', |
| 16 '-v', |
| 17 '-p', |
| 18 'codesigning', |
| 19 ]).strip() |
| 20 |
| 21 |
| 22 def FindValidIdentity(): |
| 23 lines = ListIdentities().splitlines() |
| 24 # Look for something like "2) XYZ "iPhone Developer: Name (ABC)"" |
| 25 exp = re.compile('.*\) ([A-F|0-9]*)(.*)') |
| 26 for line in lines: |
| 27 res = exp.match(line) |
| 28 if res is None: |
| 29 continue |
| 30 if "iPhone Developer: Google Development" in res.group(2): |
| 31 return res.group(1) |
| 32 return "" |
| 33 |
| 34 |
| 35 if __name__ == '__main__': |
| 36 print FindValidIdentity() |
OLD | NEW |