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