22pkg,identstr,profile = sys.argv[1:]
26for line
in subprocess.check_output([
27 'security',
'find-identity']).
decode(
'utf-8').split(
'\n'):
28 m = re.match(
r'''.*\) (.*) "''' + identstr +
'"', line)
32 print(
"Signing identity matching '" + identstr +
"' not found.")
33 print(
"Please verify by running 'security find-identity' or checking your keychain.")
38if os.path.isfile(profile):
39 mobileprovision = profile
41 for p
in glob.glob(os.path.join(os.environ[
'HOME'],
'Library',
'MobileDevice',
42 'Provisioning Profiles',
43 '*.mobileprovision')):
44 if re.search(
r'''<key>Name</key>
45\t<string>''' + profile +
r'''</string>''', open(p,
'rb').
read().
decode(
"utf-8",
"ignore"), re.MULTILINE):
47if mobileprovision
is None:
48 print(
"Provisioning profile matching '" + profile +
"' not found.")
49 print(
"Please verify that the correct profile is installed in '${HOME}/Library/MobileDevice/Provisioning Profiles' or specify the path directly.")
53shutil.copy(mobileprovision,
54 os.path.join(pkg,
'embedded.mobileprovision'))
57m = re.search(
r'''<key>ApplicationIdentifierPrefix</key>
59\t<string>(.*)</string>''', open(mobileprovision,
'rb').
read().
decode(
"utf-8",
"ignore"), re.MULTILINE)
62app, _ = os.path.splitext(os.path.basename(pkg))
65with tempfile.NamedTemporaryFile()
as f:
69 <key>application-identifier</key> <string>{prefix}.com.google.{app}</string>
70 <key>get-task-allow</key> <true/>
73'''.format(prefix=prefix, app=app).encode("utf-8"))
76 subprocess.check_call(['codesign',
79 '--entitlements', f.name,
static bool read(SkStream *stream, void *buffer, size_t amount)
def print(*args, **kwargs)
static DecodeResult decode(std::string path)