Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(391)

Side by Side Diff: build/config/ios/find_signing_identity.py

Issue 2835893004: [ios] Add support for filtering codesiging identity. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | build/config/ios/ios_sdk.gni » ('j') | build/config/ios/ios_sdk.gni » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import argparse 5 import argparse
6 import os 6 import os
7 import subprocess 7 import subprocess
8 import sys 8 import sys
9 import re 9 import re
10 10
11 def ListIdentities(): 11 def ListIdentities():
12 return subprocess.check_output([ 12 return subprocess.check_output([
13 'xcrun', 13 'xcrun',
14 'security', 14 'security',
15 'find-identity', 15 'find-identity',
16 '-v', 16 '-v',
17 '-p', 17 '-p',
18 'codesigning', 18 'codesigning',
19 ]) 19 ])
20 20
21 21
22 def FindValidIdentity(): 22 def FindValidIdentity(identity_description):
23 lines = list(map(str.strip, ListIdentities().splitlines())) 23 lines = list(map(str.strip, ListIdentities().splitlines()))
24 # Look for something like "2) XYZ "iPhone Developer: Name (ABC)"" 24 # Look for something like "2) XYZ "iPhone Developer: Name (ABC)""
25 exp = re.compile('[0-9]+\) ([A-F0-9]+) "([^"]*)"') 25 exp = re.compile('[0-9]+\) ([A-F0-9]+) "([^"]*)"')
26 for line in lines: 26 for line in lines:
27 res = exp.match(line) 27 res = exp.match(line)
28 if res is None: 28 if res is None:
29 continue 29 continue
30 if "iPhone Developer" in res.group(2): 30 if identity_description in res.group(2):
31 return res.group(1) 31 yield res.group(1)
32 return ""
33 32
34 33
35 if __name__ == '__main__': 34 if __name__ == '__main__':
36 parser = argparse.ArgumentParser('codesign iOS bundles') 35 parser = argparse.ArgumentParser('codesign iOS bundles')
37 parser.add_argument('--developer_dir', required=False, 36 parser.add_argument(
38 help='Path to Xcode.') 37 '--developer_dir', required=False,
38 help='Path to Xcode.')
39 parser.add_argument(
40 '--identity-description', required=True,
41 help='Text description used to select the code signing identity.')
39 args = parser.parse_args() 42 args = parser.parse_args()
40 if args.developer_dir: 43 if args.developer_dir:
41 os.environ['DEVELOPER_DIR'] = args.developer_dir 44 os.environ['DEVELOPER_DIR'] = args.developer_dir
42 45
43 print FindValidIdentity() 46 for identity in FindValidIdentity(args.identity_description):
47 print identity
OLDNEW
« no previous file with comments | « no previous file | build/config/ios/ios_sdk.gni » ('j') | build/config/ios/ios_sdk.gni » ('J')

Powered by Google App Engine
This is Rietveld 408576698