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

Side by Side Diff: tools/utils.py

Issue 28773003: Changes to annotated step scripts: dart-editor-installer-* builders will build installer (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « tools/mac_build_editor_dmg.sh ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 self._temp_dir = None 455 self._temp_dir = None
456 self._prefix = prefix 456 self._prefix = prefix
457 457
458 def __enter__(self): 458 def __enter__(self):
459 self._temp_dir = tempfile.mkdtemp(self._prefix) 459 self._temp_dir = tempfile.mkdtemp(self._prefix)
460 return self._temp_dir 460 return self._temp_dir
461 461
462 def __exit__(self, *_): 462 def __exit__(self, *_):
463 shutil.rmtree(self._temp_dir, ignore_errors=True) 463 shutil.rmtree(self._temp_dir, ignore_errors=True)
464 464
465 class ChangedWorkingDirectory(object):
466 def __init__(self, working_directory):
467 self._working_directory = working_directory
468
469 def __enter__(self):
470 self._old_cwd = os.getcwd()
471 print "Enter directory = ", self._working_directory
472 os.chdir(self._working_directory)
473
474 def __exit__(self, *_):
475 print "Enter directory = ", self._old_cwd
476 os.chdir(self._old_cwd)
477
465 478
466 if __name__ == "__main__": 479 if __name__ == "__main__":
467 import sys 480 import sys
468 Main(sys.argv) 481 Main(sys.argv)
OLDNEW
« no previous file with comments | « tools/mac_build_editor_dmg.sh ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698