| OLD | NEW |
| 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2011 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 import logging | 5 import logging |
| 6 import os | 6 import os |
| 7 import signal | 7 import signal |
| 8 import subprocess | 8 import subprocess |
| 9 import sys | 9 import sys |
| 10 import time | 10 import time |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 "start_thread", | 184 "start_thread", |
| 185 "main", | 185 "main", |
| 186 "BaseThreadInitThunk", | 186 "BaseThreadInitThunk", |
| 187 ] | 187 ] |
| 188 | 188 |
| 189 if use_re_wildcards: | 189 if use_re_wildcards: |
| 190 for i in range(0, len(ret)): | 190 for i in range(0, len(ret)): |
| 191 ret[i] = ret[i].replace('*', '.*').replace('?', '.') | 191 ret[i] = ret[i].replace('*', '.*').replace('?', '.') |
| 192 | 192 |
| 193 return ret | 193 return ret |
| 194 |
| 195 def NormalizeWindowsPath(path): |
| 196 """If we're using Cygwin Python, turn the path into a Windows path. |
| 197 |
| 198 Don't turn forward slashes into backslashes for easier copy-pasting and |
| 199 escaping. |
| 200 |
| 201 TODO(rnk): If we ever want to cut out the subprocess invocation, we can use |
| 202 _winreg to get the root Cygwin directory from the registry key: |
| 203 HKEY_LOCAL_MACHINE\SOFTWARE\Cygwin\setup\rootdir. |
| 204 """ |
| 205 if sys.platform.startswith("cygwin"): |
| 206 p = subprocess.Popen(["cygpath", "-m", path], |
| 207 stdout=subprocess.PIPE, |
| 208 stderr=subprocess.PIPE) |
| 209 (out, err) = p.communicate() |
| 210 if err: |
| 211 logging.warning("WARNING: cygpath error: %s", err) |
| 212 return out.strip() |
| 213 else: |
| 214 return path |
| OLD | NEW |