| OLD | NEW |
| 1 # Copyright (C) 2010 Google Inc. All rights reserved. | 1 # Copyright (C) 2010 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 | 28 |
| 29 """generic routines to convert platform-specific paths to URIs.""" | 29 """generic routines to convert platform-specific paths to URIs.""" |
| 30 | 30 |
| 31 import atexit | 31 import atexit |
| 32 import subprocess | 32 import subprocess |
| 33 import sys | |
| 34 import threading | 33 import threading |
| 35 import urllib | 34 import urllib |
| 36 | 35 |
| 37 | 36 |
| 38 def abspath_to_uri(platform, path): | 37 def abspath_to_uri(platform, path): |
| 39 """Converts a platform-specific absolute path to a file: URL.""" | 38 """Converts a platform-specific absolute path to a file: URL.""" |
| 40 return "file:" + _escape(_convert_path(platform, path)) | 39 return "file:" + _escape(_convert_path(platform, path)) |
| 41 | 40 |
| 42 | 41 |
| 43 def cygpath(path): | 42 def cygpath(path): |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 | 125 |
| 127 | 126 |
| 128 def _winpath_to_uri(path): | 127 def _winpath_to_uri(path): |
| 129 """Converts a window absolute path to a file: URL.""" | 128 """Converts a window absolute path to a file: URL.""" |
| 130 return "///" + path.replace("\\", "/") | 129 return "///" + path.replace("\\", "/") |
| 131 | 130 |
| 132 | 131 |
| 133 def _unixypath_to_uri(path): | 132 def _unixypath_to_uri(path): |
| 134 """Converts a unix-style path to a file: URL.""" | 133 """Converts a unix-style path to a file: URL.""" |
| 135 return "//" + path | 134 return "//" + path |
| OLD | NEW |