| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Generic utilities for all python scripts.""" | 5 """Generic utilities for all python scripts.""" |
| 6 | 6 |
| 7 import atexit | 7 import atexit |
| 8 import httplib | 8 import httplib |
| 9 import os | 9 import os |
| 10 import signal | 10 import signal |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 The temporary directory is automatically deleted when the python interpreter | 80 The temporary directory is automatically deleted when the python interpreter |
| 81 exits normally. | 81 exits normally. |
| 82 | 82 |
| 83 Args: | 83 Args: |
| 84 parent_dir: the directory to create the temp dir in. If None, the system | 84 parent_dir: the directory to create the temp dir in. If None, the system |
| 85 temp dir is used. | 85 temp dir is used. |
| 86 | 86 |
| 87 Returns: | 87 Returns: |
| 88 The absolute path to the temporary directory. | 88 The absolute path to the temporary directory. |
| 89 """ | 89 """ |
| 90 path = tempfile.mkdtemp(dir=parent_dir) | 90 path = tempfile.mkdtemp(prefix='chromedriver_', dir=parent_dir) |
| 91 atexit.register(MaybeDelete, path) | 91 atexit.register(MaybeDelete, path) |
| 92 return path | 92 return path |
| 93 | 93 |
| 94 | 94 |
| 95 def Zip(path): | 95 def Zip(path): |
| 96 """Zips the given path and returns the zipped file.""" | 96 """Zips the given path and returns the zipped file.""" |
| 97 zip_path = os.path.join(MakeTempDir(), 'build.zip') | 97 zip_path = os.path.join(MakeTempDir(), 'build.zip') |
| 98 f = zipfile.ZipFile(zip_path, 'w', zipfile.ZIP_DEFLATED) | 98 f = zipfile.ZipFile(zip_path, 'w', zipfile.ZIP_DEFLATED) |
| 99 f.write(path, os.path.basename(path)) | 99 f.write(path, os.path.basename(path)) |
| 100 f.close() | 100 f.close() |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 | 192 |
| 193 | 193 |
| 194 def AddLink(label, url): | 194 def AddLink(label, url): |
| 195 """Adds a link with name |label| linking to |url| to current buildbot step. | 195 """Adds a link with name |label| linking to |url| to current buildbot step. |
| 196 | 196 |
| 197 Args: | 197 Args: |
| 198 label: A string with the name of the label. | 198 label: A string with the name of the label. |
| 199 url: A string of the URL. | 199 url: A string of the URL. |
| 200 """ | 200 """ |
| 201 print '@@@STEP_LINK@%s@%s@@@' % (label, url) | 201 print '@@@STEP_LINK@%s@%s@@@' % (label, url) |
| OLD | NEW |