Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 | 2 |
| 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 # | 7 # |
| 8 # Xcode supports build variable substitutions and CPP; sadly, that doesn't work | 8 # Xcode supports build variable substitutions and CPP; sadly, that doesn't work |
| 9 # because: | 9 # because: |
| 10 # | 10 # |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 107 # unique that meetings what LS wants. | 107 # unique that meetings what LS wants. |
| 108 plist['CFBundleVersion'] = bundle_version | 108 plist['CFBundleVersion'] = bundle_version |
| 109 | 109 |
| 110 # Return with no error. | 110 # Return with no error. |
| 111 return True | 111 return True |
| 112 | 112 |
| 113 | 113 |
| 114 def _DoSCMKeys(plist, add_keys): | 114 def _DoSCMKeys(plist, add_keys): |
| 115 """Adds the SCM information, visible in about:version, to property list. If | 115 """Adds the SCM information, visible in about:version, to property list. If |
| 116 |add_keys| is True, it will insert the keys, otherwise it will remove them.""" | 116 |add_keys| is True, it will insert the keys, otherwise it will remove them.""" |
| 117 scm_path, scm_revision = None, None | 117 scm_revision = None |
| 118 if add_keys: | 118 if add_keys: |
| 119 version_info = lastchange.FetchVersionInfo( | 119 version_info = lastchange.FetchVersionInfo( |
| 120 default_lastchange=None, directory=TOP) | 120 default_lastchange=None, directory=TOP) |
| 121 scm_path, scm_revision = version_info.url, version_info.revision | 121 scm_revision = version_info.revision |
| 122 | 122 |
| 123 # See if the operation failed. | 123 # See if the operation failed. |
| 124 _RemoveKeys(plist, 'SCMRevision') | 124 _RemoveKeys(plist, 'SCMRevision') |
| 125 if scm_revision != None: | 125 if scm_revision != None: |
| 126 plist['SCMRevision'] = scm_revision | 126 plist['SCMRevision'] = scm_revision |
| 127 elif add_keys: | 127 elif add_keys: |
| 128 print >>sys.stderr, 'Could not determine SCM revision. This may be OK.' | 128 print >>sys.stderr, 'Could not determine SCM revision. This may be OK.' |
| 129 | 129 |
| 130 if scm_path != None: | 130 # TODO(thakis): Remove this once m25 has reached stable. |
| 131 plist['SCMPath'] = scm_path | 131 _RemoveKeys(plist, 'SCMPath') |
|
Nico
2012/11/28 20:24:40
This is probably unnecessary paranoia. I can remov
| |
| 132 else: | |
| 133 _RemoveKeys(plist, 'SCMPath') | |
| 134 | 132 |
| 135 | 133 |
| 136 def _DoPDFKeys(plist, add_keys): | 134 def _DoPDFKeys(plist, add_keys): |
| 137 """Adds PDF support to the document types list. If add_keys is True, it will | 135 """Adds PDF support to the document types list. If add_keys is True, it will |
| 138 add the type information dictionary. If it is False, it will remove it if | 136 add the type information dictionary. If it is False, it will remove it if |
| 139 present.""" | 137 present.""" |
| 140 | 138 |
| 141 PDF_FILE_EXTENSION = 'pdf' | 139 PDF_FILE_EXTENSION = 'pdf' |
| 142 | 140 |
| 143 def __AddPDFKeys(sub_plist): | 141 def __AddPDFKeys(sub_plist): |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 296 # Info.plist will work perfectly well in any plist format, but traditionally | 294 # Info.plist will work perfectly well in any plist format, but traditionally |
| 297 # applications use xml1 for this, so convert it to ensure that it's valid. | 295 # applications use xml1 for this, so convert it to ensure that it's valid. |
| 298 proc = subprocess.Popen(['plutil', '-convert', 'xml1', '-o', DEST_INFO_PLIST, | 296 proc = subprocess.Popen(['plutil', '-convert', 'xml1', '-o', DEST_INFO_PLIST, |
| 299 temp_info_plist.name]) | 297 temp_info_plist.name]) |
| 300 proc.wait() | 298 proc.wait() |
| 301 return proc.returncode | 299 return proc.returncode |
| 302 | 300 |
| 303 | 301 |
| 304 if __name__ == '__main__': | 302 if __name__ == '__main__': |
| 305 sys.exit(Main(sys.argv[1:])) | 303 sys.exit(Main(sys.argv[1:])) |
| OLD | NEW |