Home | History | Annotate | Download | only in gn
      1 #!/usr/bin/env python2.7
      2 #
      3 # Copyright 2017 Google Inc.
      4 #
      5 # Use of this source code is governed by a BSD-style license that can be
      6 # found in the LICENSE file.
      7 
      8 import os
      9 import sys
     10 
     11 # Arguments to the script:
     12 #  app              path to binary to package, e.g. out/Debug/gen/dm
     13 app, = sys.argv[1:]
     14 
     15 out, app = os.path.split(app)
     16 
     17 # Write a minimal Info.plist to name the package and point at the binary.
     18 with open(os.path.join(out, app + '_Info.plist'), 'w') as f:
     19   f.write('''
     20 <plist version="1.0">
     21   <dict>
     22     <key>CFBundleVersion</key> <string>0.1.0</string>
     23     <key>CFBundleShortVersionString</key> <string>0.1.0</string>
     24     <key>CFBundleExecutable</key> <string>{app}</string>
     25     <key>CFBundleIdentifier</key> <string>com.google.{app}</string>
     26     <key>CFBundlePackageType</key> <string>APPL</string>
     27   </dict>
     28 </plist>
     29 '''.format(app=app))
     30