| OLD | NEW |
| 1 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 # for details. All rights reserved. Use of this source code is governed by a | 2 # for details. All rights reserved. Use of this source code is governed by a |
| 3 # BSD-style license that can be found in the LICENSE file. | 3 # BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 # This file contains a set of utilities functions used by other Python-based | 5 # This file contains a set of utilities functions used by other Python-based |
| 6 # scripts. | 6 # scripts. |
| 7 | 7 |
| 8 import commands | 8 import commands |
| 9 import os | 9 import os |
| 10 import platform | 10 import platform |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 revision_string = '' | 255 revision_string = '' |
| 256 if user: | 256 if user: |
| 257 user_string = '_%s' % user | 257 user_string = '_%s' % user |
| 258 if revision: | 258 if revision: |
| 259 revision_string = '_r%s' % revision | 259 revision_string = '_r%s' % revision |
| 260 | 260 |
| 261 # TODO(kustermann/ricow): Add the channel to the version string. | 261 # TODO(kustermann/ricow): Add the channel to the version string. |
| 262 return ("%s.%s.%s.%s%s%s" % | 262 return ("%s.%s.%s.%s%s%s" % |
| 263 (major, minor, build, patch, revision_string, user_string)) | 263 (major, minor, build, patch, revision_string, user_string)) |
| 264 | 264 |
| 265 def GetChannel(): |
| 266 (channel, _, _, _, _) = ReadVersionFile() |
| 267 return channel |
| 268 |
| 265 def GetUserName(): | 269 def GetUserName(): |
| 266 key = 'USER' | 270 key = 'USER' |
| 267 if sys.platform == 'win32': | 271 if sys.platform == 'win32': |
| 268 key = 'USERNAME' | 272 key = 'USERNAME' |
| 269 return os.environ.get(key, '') | 273 return os.environ.get(key, '') |
| 270 | 274 |
| 271 def ReadVersionFile(): | 275 def ReadVersionFile(): |
| 272 version_file = os.path.join(DART_DIR, 'tools', 'VERSION') | 276 version_file = os.path.join(DART_DIR, 'tools', 'VERSION') |
| 273 try: | 277 try: |
| 274 fd = open(version_file) | 278 fd = open(version_file) |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 os.chdir(self._working_directory) | 507 os.chdir(self._working_directory) |
| 504 | 508 |
| 505 def __exit__(self, *_): | 509 def __exit__(self, *_): |
| 506 print "Enter directory = ", self._old_cwd | 510 print "Enter directory = ", self._old_cwd |
| 507 os.chdir(self._old_cwd) | 511 os.chdir(self._old_cwd) |
| 508 | 512 |
| 509 | 513 |
| 510 if __name__ == "__main__": | 514 if __name__ == "__main__": |
| 511 import sys | 515 import sys |
| 512 Main(sys.argv) | 516 Main(sys.argv) |
| OLD | NEW |