| OLD | NEW |
| (Empty) |
| 1 #!/usr/bin/env python | |
| 2 # | |
| 3 # Copyright 2012 Google Inc. All Rights Reserved. | |
| 4 | |
| 5 import subprocess | |
| 6 import sys | |
| 7 | |
| 8 def FetchSVNRevision(): | |
| 9 try: | |
| 10 proc = subprocess.Popen(['svn', 'info'], | |
| 11 stdout=subprocess.PIPE, | |
| 12 stderr=subprocess.PIPE, | |
| 13 cwd='src/dart', | |
| 14 shell=(sys.platform=='win32')) | |
| 15 except OSError: | |
| 16 # command is apparently either not installed or not executable. | |
| 17 return None | |
| 18 if not proc: | |
| 19 return None | |
| 20 | |
| 21 for line in proc.stdout: | |
| 22 line = line.strip() | |
| 23 if not line: | |
| 24 continue | |
| 25 key, val = line.split(': ', 1) | |
| 26 if key == 'Revision': | |
| 27 return val | |
| 28 | |
| 29 return None | |
| 30 | |
| 31 | |
| 32 def main(): | |
| 33 revision = FetchSVNRevision() | |
| 34 path = 'src/chrome/VERSION' | |
| 35 text = file(path).readlines() | |
| 36 text[2] = 'BUILD=d%s\n' % revision | |
| 37 file(path, 'w').writelines(text) | |
| 38 | |
| 39 if __name__ == '__main__': | |
| 40 main() | |
| OLD | NEW |