Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Side by Side Diff: build/config/mac/write_pkg_info.py

Issue 2047643003: DO NOT SUBMIT. Implement an XPCService for notifications. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge to use AlertNotificationService Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/config/mac/rules.gni ('k') | chrome/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import argparse 5 import argparse
6 import os 6 import os
7 import plistlib 7 import plistlib
8 import sys 8 import sys
9 9
10 # This script creates a PkgInfo file for an OS X .app bundle's plist. 10 # This script creates a PkgInfo file for an OS X .app bundle's plist.
11 # Usage: python write_pkg_info.py --plist Foo.app/Contents/Info.plist \ 11 # Usage: python write_pkg_info.py --plist Foo.app/Contents/Info.plist \
12 # --output Foo.app/Contents/PkgInfo 12 # --output Foo.app/Contents/PkgInfo
13 13
14 def Main(): 14 def Main():
15 parser = argparse.ArgumentParser( 15 parser = argparse.ArgumentParser(
16 description='A script to write PkgInfo files for .app bundles.') 16 description='A script to write PkgInfo files for .app bundles.')
17 parser.add_argument('--plist', required=True, 17 parser.add_argument('--plist', required=True,
18 help='Path to the Info.plist for the .app.') 18 help='Path to the Info.plist for the .app.')
19 parser.add_argument('--output', required=True, 19 parser.add_argument('--output', required=True,
20 help='Path to the desired output file.') 20 help='Path to the desired output file.')
21 args = parser.parse_args() 21 args = parser.parse_args()
22 22
23 # Remove the output if it exists already. 23 # Remove the output if it exists already.
24 if os.path.exists(args.output): 24 if os.path.exists(args.output):
25 os.unlink(args.output) 25 os.unlink(args.output)
26 26
27 plist = plistlib.readPlist(args.plist) 27 plist = plistlib.readPlist(args.plist)
28 package_type = plist['CFBundlePackageType'] 28 package_type = plist['CFBundlePackageType']
29 if package_type != 'APPL': 29 #if package_type != 'APPL':
30 raise ValueError('Expected CFBundlePackageType to be %s, got %s' % \ 30 # raise ValueError('Expected CFBundlePackageType to be %s, got %s' % \
31 ('AAPL', package_type)) 31 # ('AAPL', package_type))
32 32
33 # The format of PkgInfo is eight characters, representing the bundle type 33 # The format of PkgInfo is eight characters, representing the bundle type
34 # and bundle signature, each four characters. If that is missing, four 34 # and bundle signature, each four characters. If that is missing, four
35 # '?' characters are used instead. 35 # '?' characters are used instead.
36 signature_code = plist.get('CFBundleSignature', '????') 36 signature_code = plist.get('CFBundleSignature', '????')
37 if len(signature_code) != 4: 37 if len(signature_code) != 4:
38 raise ValueError('CFBundleSignature should be exactly four characters, ' + 38 raise ValueError('CFBundleSignature should be exactly four characters, ' +
39 'got %s' % signature_code) 39 'got %s' % signature_code)
40 40
41 with open(args.output, 'w') as fp: 41 with open(args.output, 'w') as fp:
42 fp.write('%s%s' % (package_type, signature_code)) 42 fp.write('%s%s' % (package_type, signature_code))
43 return 0 43 return 0
44 44
45 45
46 if __name__ == '__main__': 46 if __name__ == '__main__':
47 sys.exit(Main()) 47 sys.exit(Main())
OLDNEW
« no previous file with comments | « build/config/mac/rules.gni ('k') | chrome/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698