| Index: third_party/WebKit/Tools/Scripts/webkitpy/common/system/path.py
|
| diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/path.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/path.py
|
| index 01f5acb3a179c7dd3cb9910bb41ae1af54aedb23..083773cd4d232dc61c543cd9e008efac54b8fa71 100644
|
| --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/path.py
|
| +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/path.py
|
| @@ -26,11 +26,8 @@
|
| # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| -"""generic routines to convert platform-specific paths to URIs."""
|
| +"""Generic routines to convert platform-specific paths to URIs."""
|
|
|
| -import atexit
|
| -import subprocess
|
| -import threading
|
| import urllib
|
|
|
|
|
| @@ -39,73 +36,6 @@ def abspath_to_uri(platform, path):
|
| return 'file:' + _escape(_convert_path(platform, path))
|
|
|
|
|
| -def cygpath(path):
|
| - """Converts an absolute cygwin path to an absolute Windows path."""
|
| - return _CygPath.convert_using_singleton(path)
|
| -
|
| -
|
| -# Note that this object is not threadsafe and must only be called
|
| -# from multiple threads under protection of a lock (as is done in cygpath())
|
| -class _CygPath(object):
|
| - """Manages a long-running 'cygpath' process for file conversion."""
|
| - _lock = None
|
| - _singleton = None
|
| -
|
| - @staticmethod
|
| - def stop_cygpath_subprocess():
|
| - if not _CygPath._lock:
|
| - return
|
| -
|
| - with _CygPath._lock:
|
| - if _CygPath._singleton:
|
| - _CygPath._singleton.stop()
|
| -
|
| - @staticmethod
|
| - def convert_using_singleton(path):
|
| - if not _CygPath._lock:
|
| - _CygPath._lock = threading.Lock()
|
| -
|
| - with _CygPath._lock:
|
| - if not _CygPath._singleton:
|
| - _CygPath._singleton = _CygPath()
|
| - # Make sure the cygpath subprocess always gets shutdown cleanly.
|
| - atexit.register(_CygPath.stop_cygpath_subprocess)
|
| -
|
| - return _CygPath._singleton.convert(path)
|
| -
|
| - def __init__(self):
|
| - self._child_process = None
|
| -
|
| - def start(self):
|
| - assert self._child_process is None
|
| - args = ['cygpath', '-f', '-', '-wa']
|
| - self._child_process = subprocess.Popen(args,
|
| - stdin=subprocess.PIPE,
|
| - stdout=subprocess.PIPE)
|
| -
|
| - def is_running(self):
|
| - if not self._child_process:
|
| - return False
|
| - return self._child_process.returncode is None
|
| -
|
| - def stop(self):
|
| - if self._child_process:
|
| - self._child_process.stdin.close()
|
| - self._child_process.wait()
|
| - self._child_process = None
|
| -
|
| - def convert(self, path):
|
| - if not self.is_running():
|
| - self.start()
|
| - self._child_process.stdin.write('%s\r\n' % path)
|
| - self._child_process.stdin.flush()
|
| - windows_path = self._child_process.stdout.readline().rstrip()
|
| - # Some versions of cygpath use lowercase drive letters while others
|
| - # use uppercase. We always convert to uppercase for consistency.
|
| - windows_path = '%s%s' % (windows_path[0].upper(), windows_path[1:])
|
| - return windows_path
|
| -
|
| -
|
| def _escape(path):
|
| """Handle any characters in the path that should be escaped."""
|
| # FIXME: web browsers don't appear to blindly quote every character
|
| @@ -117,8 +47,6 @@ def _escape(path):
|
|
|
| def _convert_path(platform, path):
|
| """Handles any os-specific path separators, mappings, etc."""
|
| - if platform.is_cygwin():
|
| - return _winpath_to_uri(cygpath(path))
|
| if platform.is_win():
|
| return _winpath_to_uri(path)
|
| return _unixypath_to_uri(path)
|
|
|