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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 match = re.match('\d+\.\d+\.(\d+\.\d+)$', version) | 69 match = re.match('\d+\.\d+\.(\d+\.\d+)$', version) |
70 if not match: | 70 if not match: |
71 print >>sys.stderr, 'Invalid version string specified: "%s"' % version | 71 print >>sys.stderr, 'Invalid version string specified: "%s"' % version |
72 return False | 72 return False |
73 | 73 |
74 full_version = match.group(0) | 74 full_version = match.group(0) |
75 bundle_version = match.group(1) | 75 bundle_version = match.group(1) |
76 | 76 |
77 else: | 77 else: |
78 # Pull in the Chrome version number. | 78 # Pull in the Chrome version number. |
79 VERSION_TOOL = os.path.join(TOP, 'chrome/tools/build/version.py') | 79 VERSION_TOOL = os.path.join(TOP, 'build/util/version.py') |
80 VERSION_FILE = os.path.join(TOP, 'chrome/VERSION') | 80 VERSION_FILE = os.path.join(TOP, 'chrome/VERSION') |
81 | 81 |
82 (stdout, retval1) = _GetOutput([VERSION_TOOL, '-f', VERSION_FILE, '-t', | 82 (stdout, retval1) = _GetOutput([VERSION_TOOL, '-f', VERSION_FILE, '-t', |
83 '@MAJOR@.@MINOR@.@BUILD@.@PATCH@']) | 83 '@MAJOR@.@MINOR@.@BUILD@.@PATCH@']) |
84 full_version = stdout.rstrip() | 84 full_version = stdout.rstrip() |
85 | 85 |
86 (stdout, retval2) = _GetOutput([VERSION_TOOL, '-f', VERSION_FILE, '-t', | 86 (stdout, retval2) = _GetOutput([VERSION_TOOL, '-f', VERSION_FILE, '-t', |
87 '@BUILD@.@PATCH@']) | 87 '@BUILD@.@PATCH@']) |
88 bundle_version = stdout.rstrip() | 88 bundle_version = stdout.rstrip() |
89 | 89 |
(...skipping 17 matching lines...) Expand all Loading... |
107 # Return with no error. | 107 # Return with no error. |
108 return True | 108 return True |
109 | 109 |
110 | 110 |
111 def _DoSCMKeys(plist, add_keys): | 111 def _DoSCMKeys(plist, add_keys): |
112 """Adds the SCM information, visible in about:version, to property list. If | 112 """Adds the SCM information, visible in about:version, to property list. If |
113 |add_keys| is True, it will insert the keys, otherwise it will remove them.""" | 113 |add_keys| is True, it will insert the keys, otherwise it will remove them.""" |
114 scm_revision = None | 114 scm_revision = None |
115 if add_keys: | 115 if add_keys: |
116 # Pull in the Chrome revision number. | 116 # Pull in the Chrome revision number. |
117 VERSION_TOOL = os.path.join(TOP, 'chrome/tools/build/version.py') | 117 VERSION_TOOL = os.path.join(TOP, 'build/util/version.py') |
118 LASTCHANGE_FILE = os.path.join(TOP, 'build/util/LASTCHANGE') | 118 LASTCHANGE_FILE = os.path.join(TOP, 'build/util/LASTCHANGE') |
119 (stdout, retval) = _GetOutput([VERSION_TOOL, '-f', LASTCHANGE_FILE, '-t', | 119 (stdout, retval) = _GetOutput([VERSION_TOOL, '-f', LASTCHANGE_FILE, '-t', |
120 '@LASTCHANGE@']) | 120 '@LASTCHANGE@']) |
121 if retval: | 121 if retval: |
122 return False | 122 return False |
123 scm_revision = stdout.rstrip() | 123 scm_revision = stdout.rstrip() |
124 | 124 |
125 # See if the operation failed. | 125 # See if the operation failed. |
126 _RemoveKeys(plist, 'SCMRevision') | 126 _RemoveKeys(plist, 'SCMRevision') |
127 if scm_revision != None: | 127 if scm_revision != None: |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 # Info.plist will work perfectly well in any plist format, but traditionally | 324 # Info.plist will work perfectly well in any plist format, but traditionally |
325 # applications use xml1 for this, so convert it to ensure that it's valid. | 325 # applications use xml1 for this, so convert it to ensure that it's valid. |
326 proc = subprocess.Popen(['plutil', '-convert', 'xml1', '-o', DEST_INFO_PLIST, | 326 proc = subprocess.Popen(['plutil', '-convert', 'xml1', '-o', DEST_INFO_PLIST, |
327 temp_info_plist.name]) | 327 temp_info_plist.name]) |
328 proc.wait() | 328 proc.wait() |
329 return proc.returncode | 329 return proc.returncode |
330 | 330 |
331 | 331 |
332 if __name__ == '__main__': | 332 if __name__ == '__main__': |
333 sys.exit(Main(sys.argv[1:])) | 333 sys.exit(Main(sys.argv[1:])) |
OLD | NEW |