-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathResign_CodeSign_RunScript.py
More file actions
executable file
·61 lines (43 loc) · 1.65 KB
/
Resign_CodeSign_RunScript.py
File metadata and controls
executable file
·61 lines (43 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/python
''' Make sure all your resources are properly signed
'''
import os
import subprocess
import plistlib
import logging
## since it's hard to see exactly what's happening on runscripts
## we do some loggin
logging.basicConfig(filename='/tmp/xcode_runscript.log',level=logging.DEBUG)
def checkVar(var,description):
logging.info('Checking %s:%s\n' % (description,var))
if var == "" or var == None:
print ("the variable %s is blank" % description)
exit(1)
def deepSign(path):
logging.info('Signing %s\n' % (path))
identity = os.getenv('CODE_SIGN_IDENTITY')
result = subprocess.call(['codesign','--force','--deep','--sign',identity,path])
if not result == 0:
logging.error('Problem signing item at %s\n %s' % (path,result))
def signFrameworks(build_dir):
frameworks_dir = os.getenv('FRAMEWORKS_FOLDER_PATH')
frameworks_path = os.path.join(build_dir,frameworks_dir)
frameworks = os.listdir(frameworks_path)
for i in frameworks:
checkVar(i,'framework')
path = os.path.join(frameworks_path,i,'Versions','A')
deepSign(path)
def main():
# Configure info from environment
logging.info('### Starting Run Script ####\n\n')
identity = os.getenv('CODE_SIGN_IDENTITY')
logging.info('Signing with identity %s\n' % identity)
build_dir = os.getenv('BUILT_PRODUCTS_DIR')
checkVar(build_dir,'BUILT_PRODUCTS_DIR')
app_path = os.getenv('CODESIGNING_FOLDER_PATH')
checkVar(app_path,'PRODUCT_NAME')
signFrameworks(build_dir)
deepSign(app_path)
logging.info('### Done with RunScript####\n\n')
if __name__ == "__main__":
main()