project_files/HedgewarsMobile/gen_entitlements.py
author koda
Fri, 02 Apr 2010 22:44:14 +0000
changeset 3270 9bd8fb1707b9
parent 2980 3cbd5a39aaee
permissions -rwxr-xr-x
initial support for hat selection on the ifrontend
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2980
3cbd5a39aaee add the HedgewarsMobile project file to source control
koda
parents:
diff changeset
     1
#!/usr/bin/env python
3cbd5a39aaee add the HedgewarsMobile project file to source control
koda
parents:
diff changeset
     2
3cbd5a39aaee add the HedgewarsMobile project file to source control
koda
parents:
diff changeset
     3
import sys
3cbd5a39aaee add the HedgewarsMobile project file to source control
koda
parents:
diff changeset
     4
import struct
3cbd5a39aaee add the HedgewarsMobile project file to source control
koda
parents:
diff changeset
     5
3cbd5a39aaee add the HedgewarsMobile project file to source control
koda
parents:
diff changeset
     6
if len(sys.argv) != 3:
3cbd5a39aaee add the HedgewarsMobile project file to source control
koda
parents:
diff changeset
     7
	print "Usage: %s appname dest_file.xcent" % sys.argv[0]
3cbd5a39aaee add the HedgewarsMobile project file to source control
koda
parents:
diff changeset
     8
	sys.exit(-1)
3cbd5a39aaee add the HedgewarsMobile project file to source control
koda
parents:
diff changeset
     9
3cbd5a39aaee add the HedgewarsMobile project file to source control
koda
parents:
diff changeset
    10
APPNAME = sys.argv[1]
3cbd5a39aaee add the HedgewarsMobile project file to source control
koda
parents:
diff changeset
    11
DEST = sys.argv[2]
3cbd5a39aaee add the HedgewarsMobile project file to source control
koda
parents:
diff changeset
    12
3cbd5a39aaee add the HedgewarsMobile project file to source control
koda
parents:
diff changeset
    13
if not DEST.endswith('.xml') and not DEST.endswith('.xcent'):
3cbd5a39aaee add the HedgewarsMobile project file to source control
koda
parents:
diff changeset
    14
	print "Dest must be .xml (for ldid) or .xcent (for codesign)"
3cbd5a39aaee add the HedgewarsMobile project file to source control
koda
parents:
diff changeset
    15
	sys.exit(-1)
3cbd5a39aaee add the HedgewarsMobile project file to source control
koda
parents:
diff changeset
    16
3cbd5a39aaee add the HedgewarsMobile project file to source control
koda
parents:
diff changeset
    17
entitlements = """
3cbd5a39aaee add the HedgewarsMobile project file to source control
koda
parents:
diff changeset
    18
<?xml version="1.0" encoding="UTF-8"?>
3cbd5a39aaee add the HedgewarsMobile project file to source control
koda
parents:
diff changeset
    19
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3cbd5a39aaee add the HedgewarsMobile project file to source control
koda
parents:
diff changeset
    20
<plist version="1.0">
3cbd5a39aaee add the HedgewarsMobile project file to source control
koda
parents:
diff changeset
    21
<dict>
3cbd5a39aaee add the HedgewarsMobile project file to source control
koda
parents:
diff changeset
    22
    <key>application-identifier</key>
3cbd5a39aaee add the HedgewarsMobile project file to source control
koda
parents:
diff changeset
    23
    <string>%s</string>
3cbd5a39aaee add the HedgewarsMobile project file to source control
koda
parents:
diff changeset
    24
    <key>get-task-allow</key>
3cbd5a39aaee add the HedgewarsMobile project file to source control
koda
parents:
diff changeset
    25
    <true/>
3cbd5a39aaee add the HedgewarsMobile project file to source control
koda
parents:
diff changeset
    26
</dict>
3cbd5a39aaee add the HedgewarsMobile project file to source control
koda
parents:
diff changeset
    27
</plist>
3cbd5a39aaee add the HedgewarsMobile project file to source control
koda
parents:
diff changeset
    28
""" % APPNAME
3cbd5a39aaee add the HedgewarsMobile project file to source control
koda
parents:
diff changeset
    29
3cbd5a39aaee add the HedgewarsMobile project file to source control
koda
parents:
diff changeset
    30
f = open(DEST,'w')
3cbd5a39aaee add the HedgewarsMobile project file to source control
koda
parents:
diff changeset
    31
if DEST.endswith('.xcent'):
3cbd5a39aaee add the HedgewarsMobile project file to source control
koda
parents:
diff changeset
    32
	f.write("\xfa\xde\x71\x71")
3cbd5a39aaee add the HedgewarsMobile project file to source control
koda
parents:
diff changeset
    33
	f.write(struct.pack('>L', len(entitlements) + 8))
3cbd5a39aaee add the HedgewarsMobile project file to source control
koda
parents:
diff changeset
    34
f.write(entitlements)
3cbd5a39aaee add the HedgewarsMobile project file to source control
koda
parents:
diff changeset
    35
f.close()