| Index: tools/utils.py
|
| diff --git a/tools/utils.py b/tools/utils.py
|
| index 8346d09546c8f561856e91f463d2ede50a4fec1d..0abb0ed15d32240c5f8613e7612315830209f549 100644
|
| --- a/tools/utils.py
|
| +++ b/tools/utils.py
|
| @@ -9,8 +9,10 @@ import commands
|
| import os
|
| import platform
|
| import re
|
| +import shutil
|
| import subprocess
|
| import sys
|
| +import tempfile
|
|
|
|
|
| # Try to guess the host operating system.
|
| @@ -406,6 +408,18 @@ def DartSdkBinary():
|
| dart_binary_prefix = os.path.join(tools_dir, '..', 'sdk' , 'bin')
|
| return os.path.join(dart_binary_prefix, 'dart')
|
|
|
| +class TempDir(object):
|
| + def __init__(self, prefix=''):
|
| + self._temp_dir = None
|
| + self._prefix = prefix
|
| +
|
| + def __enter__(self):
|
| + self._temp_dir = tempfile.mkdtemp(self._prefix)
|
| + return self._temp_dir
|
| +
|
| + def __exit__(self, *_):
|
| + shutil.rmtree(self._temp_dir, ignore_errors=True)
|
| +
|
|
|
| if __name__ == "__main__":
|
| import sys
|
|
|