forked from FrozenSand/ioq3-for-UrbanTerror-4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
osx_update_bundle.py
executable file
·58 lines (52 loc) · 1.79 KB
/
osx_update_bundle.py
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
#!/usr/bin/env python
import sys, shutil, os, re
MODVERSION_FILE='code/qcommon/q_shared.h'
INFO_PATH='binaries/Quake3-UrT.app/Contents/Info.plist'
ENGINE_PATH='binaries/Quake3-UrT.app/Contents/MacOS'
if ( __name__ == '__main__' ):
build_dir = sys.argv[1]
engine_exe = sys.argv[2].lstrip('/')
engine_path = os.path.join( build_dir, engine_exe )
engine_name = os.path.basename( engine_exe )
print( '%s -> %s' % ( repr( engine_path ), repr( ENGINE_PATH ) ) )
shutil.copy( engine_path, ENGINE_PATH )
l = filter( lambda l : l.find( '#define Q3_VERSION ' ) == 0, file( MODVERSION_FILE ).readlines() )[0]
version = re.match( '.*"(.*)"', l ).groups()[0]
info_plist = file( INFO_PATH, 'w' )
info_plist.write( '''
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>%s</string>
<key>CFBundleGetInfoString</key>
<string>%s</string>
<key>NSHumanReadableCopyright</key>
<string></string>
<key>CFBundleIconFile</key>
<string>quake3-urt.icns</string>
<key>CFBundleIdentifier</key>
<string>com.frozensand.quake3-urt</string>
<key>CFBundleName</key>
<string>Quake3-UrT</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>Q3URT</string>
<key>CFBundleShortVersionString</key>
<string>%s</string>
<key>CFBundleVersion</key>
<string>%s</string>
<key>NSExtensions</key>
<dict/>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>
''' % ( engine_name, version, version, version ) )
print( 'OSX binary is ready: %s' % version )