Chromium Code Reviews| Index: build/config/ios/find_signing_identity.py |
| diff --git a/build/config/ios/find_signing_identity.py b/build/config/ios/find_signing_identity.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..dd880e54f3e34e48d1ad5a76bcf6a6c0153dd7ac |
| --- /dev/null |
| +++ b/build/config/ios/find_signing_identity.py |
| @@ -0,0 +1,35 @@ |
| +# Copyright (c) 2015 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +import subprocess |
| +import sys |
| +import re |
| + |
| +def ListIdentities(): |
| + return subprocess.check_output([ |
| + '/usr/bin/env', |
| + 'xcrun', |
| + 'security', |
| + 'find-identity', |
| + '-v', |
| + '-p', |
| + 'codesigning', |
| + ]).strip() |
| + |
| + |
| +def FindValidIdentity(): |
| + lines = ListIdentities().splitlines() |
| + # Look for something like "2) XYZ "iPhone Developer: Name (ABC)"" |
| + exp = re.compile('.*\) ([A-F|0-9]*)(.*)') |
|
sdefresne
2015/07/25 19:15:29
nit: I would make the regexp more strict, like '[0
Dirk Pranke
2015/07/31 21:27:40
Done.
|
| + for line in lines: |
| + res = exp.match(line) |
| + if res is None: |
| + continue |
| + if "iPhone Developer" in res.group(2): |
| + return res.group(1) |
| + return "" |
| + |
| + |
| +if __name__ == '__main__': |
| + print FindValidIdentity() |