summaryrefslogtreecommitdiff
path: root/Tools/Scripts/webkitpy/common/system
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-11-07 11:22:47 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2012-11-07 11:22:47 +0100
commitcfd86b747d32ac22246a1aa908eaa720c63a88c1 (patch)
tree24d68c6f61c464ecba1e05670b80390ea3b0e50c /Tools/Scripts/webkitpy/common/system
parent69d7c744c9de19d152dbe2d8e46eb7dfd4511d1a (diff)
downloadqtwebkit-cfd86b747d32ac22246a1aa908eaa720c63a88c1.tar.gz
Imported WebKit commit 20271caf2e2c016d5cef40184cddeefeac4f1876 (http://svn.webkit.org/repository/webkit/trunk@133733)
New snapshot that contains all previous fixes as well as build fix for latest QtMultimedia API changes.
Diffstat (limited to 'Tools/Scripts/webkitpy/common/system')
-rwxr-xr-xTools/Scripts/webkitpy/common/system/autoinstall.py173
-rw-r--r--Tools/Scripts/webkitpy/common/system/executive.py3
-rw-r--r--Tools/Scripts/webkitpy/common/system/executive_mock.py37
-rw-r--r--Tools/Scripts/webkitpy/common/system/file_lock_mock.py36
-rw-r--r--Tools/Scripts/webkitpy/common/system/logutils.py10
-rw-r--r--Tools/Scripts/webkitpy/common/system/logutils_unittest.py24
-rw-r--r--Tools/Scripts/webkitpy/common/system/platforminfo.py26
-rw-r--r--Tools/Scripts/webkitpy/common/system/platforminfo_mock.py5
-rw-r--r--Tools/Scripts/webkitpy/common/system/platforminfo_unittest.py1
-rw-r--r--Tools/Scripts/webkitpy/common/system/systemhost.py5
-rw-r--r--Tools/Scripts/webkitpy/common/system/systemhost_mock.py4
11 files changed, 162 insertions, 162 deletions
diff --git a/Tools/Scripts/webkitpy/common/system/autoinstall.py b/Tools/Scripts/webkitpy/common/system/autoinstall.py
index 00aff83ff..f3045f86b 100755
--- a/Tools/Scripts/webkitpy/common/system/autoinstall.py
+++ b/Tools/Scripts/webkitpy/common/system/autoinstall.py
@@ -33,7 +33,6 @@
import codecs
import logging
-import new
import os
import shutil
import sys
@@ -42,7 +41,6 @@ import tempfile
import urllib
import urlparse
import zipfile
-import zipimport
_log = logging.getLogger(__name__)
@@ -97,35 +95,9 @@ class AutoInstaller(object):
self._target_dir = target_dir
self._temp_dir = temp_dir
- def _log_transfer(self, message, source, target, log_method=None):
- """Log a debug message that involves a source and target."""
- if log_method is None:
- log_method = _log.debug
-
- log_method("%s" % message)
- log_method(' From: "%s"' % source)
- log_method(' To: "%s"' % target)
-
- def _create_directory(self, path, name=None):
- """Create a directory."""
- log = _log.debug
-
- name = name + " " if name is not None else ""
- log('Creating %sdirectory...' % name)
- log(' "%s"' % path)
-
- os.makedirs(path)
-
def _write_file(self, path, text, encoding):
- """Create a file at the given path with given text.
-
- This method overwrites any existing file.
-
- """
- _log.debug("Creating file...")
- _log.debug(' "%s"' % path)
- with codecs.open(path, "w", encoding) as file:
- file.write(text)
+ with codecs.open(path, "w", encoding) as filehandle:
+ filehandle.write(text)
def _set_up_target_dir(self, target_dir, append_to_search_path,
make_package):
@@ -143,17 +115,20 @@ class AutoInstaller(object):
"""
if not os.path.exists(target_dir):
- self._create_directory(target_dir, "autoinstall target")
+ os.makedirs(target_dir)
if append_to_search_path:
sys.path.append(target_dir)
if make_package:
- init_path = os.path.join(target_dir, "__init__.py")
- if not os.path.exists(init_path):
- text = ("# This file is required for Python to search this "
- "directory for modules.\n")
- self._write_file(init_path, text, "ascii")
+ self._make_package(target_dir)
+
+ def _make_package(self, target_dir):
+ init_path = os.path.join(target_dir, "__init__.py")
+ if not os.path.exists(init_path):
+ text = ("# This file is required for Python to search this "
+ "directory for modules.\n")
+ self._write_file(init_path, text, "ascii")
def _create_scratch_directory_inner(self, prefix):
"""Create a scratch directory without exception handling.
@@ -182,7 +157,7 @@ class AutoInstaller(object):
temp directory if it does not already exist.
"""
- prefix = target_name + "_"
+ prefix = target_name.replace(os.sep, "_") + "_"
try:
scratch_dir = self._create_scratch_directory_inner(prefix)
except OSError:
@@ -192,51 +167,32 @@ class AutoInstaller(object):
if temp_dir is None or os.path.exists(temp_dir):
raise
# Else try again after creating the temp directory.
- self._create_directory(temp_dir, "autoinstall temp")
+ os.makedirs(temp_dir)
scratch_dir = self._create_scratch_directory_inner(prefix)
return scratch_dir
def _url_downloaded_path(self, target_name):
- """Return the path to the file containing the URL downloaded."""
- filename = ".%s.url" % target_name
- path = os.path.join(self._target_dir, filename)
- return path
+ return os.path.join(self._target_dir, ".%s.url" % target_name)
def _is_downloaded(self, target_name, url):
- """Return whether a package version has been downloaded."""
version_path = self._url_downloaded_path(target_name)
- _log.debug('Checking %s URL downloaded...' % target_name)
- _log.debug(' "%s"' % version_path)
-
if not os.path.exists(version_path):
- # Then no package version has been downloaded.
- _log.debug("No URL file found.")
return False
- with codecs.open(version_path, "r", "utf-8") as file:
- version = file.read()
-
- return version.strip() == url.strip()
+ with codecs.open(version_path, "r", "utf-8") as filehandle:
+ return filehandle.read().strip() == url.strip()
def _record_url_downloaded(self, target_name, url):
- """Record the URL downloaded to a file."""
version_path = self._url_downloaded_path(target_name)
- _log.debug("Recording URL downloaded...")
- _log.debug(' URL: "%s"' % url)
- _log.debug(' To: "%s"' % version_path)
-
self._write_file(version_path, url, "utf-8")
def _extract_targz(self, path, scratch_dir):
- # tarfile.extractall() extracts to a path without the
- # trailing ".tar.gz".
+ # tarfile.extractall() extracts to a path without the trailing ".tar.gz".
target_basename = os.path.basename(path[:-len(".tar.gz")])
target_path = os.path.join(scratch_dir, target_basename)
- self._log_transfer("Starting gunzip/extract...", path, target_path)
-
try:
tar_file = tarfile.open(path)
except tarfile.ReadError, err:
@@ -248,11 +204,6 @@ class AutoInstaller(object):
raise Exception(message)
try:
- # This is helpful for debugging purposes.
- _log.debug("Listing tar file contents...")
- for name in tar_file.getnames():
- _log.debug(' * "%s"' % name)
- _log.debug("Extracting gzipped tar file...")
tar_file.extractall(target_path)
finally:
tar_file.close()
@@ -263,33 +214,23 @@ class AutoInstaller(object):
# available in Python 2.6 but not in earlier versions.
# NOTE: The version in 2.6.1 (which shipped on Snow Leopard) is broken!
def _extract_all(self, zip_file, target_dir):
- self._log_transfer("Extracting zip file...", zip_file, target_dir)
-
- # This is helpful for debugging purposes.
- _log.debug("Listing zip file contents...")
- for name in zip_file.namelist():
- _log.debug(' * "%s"' % name)
-
for name in zip_file.namelist():
path = os.path.join(target_dir, name)
- self._log_transfer("Extracting...", name, path)
-
if not os.path.basename(path):
# Then the path ends in a slash, so it is a directory.
- self._create_directory(path)
+ os.makedirs(path)
continue
- # Otherwise, it is a file.
try:
# We open this file w/o encoding, as we're reading/writing
# the raw byte-stream from the zip file.
outfile = open(path, 'wb')
- except IOError, err:
+ except IOError:
# Not all zip files seem to list the directories explicitly,
# so try again after creating the containing directory.
_log.debug("Got IOError: retrying after creating directory...")
- dir = os.path.dirname(path)
- self._create_directory(dir)
+ dirname = os.path.dirname(path)
+ os.makedirs(dirname)
outfile = open(path, 'wb')
try:
@@ -298,13 +239,10 @@ class AutoInstaller(object):
outfile.close()
def _unzip(self, path, scratch_dir):
- # zipfile.extractall() extracts to a path without the
- # trailing ".zip".
+ # zipfile.extractall() extracts to a path without the trailing ".zip".
target_basename = os.path.basename(path[:-len(".zip")])
target_path = os.path.join(scratch_dir, target_basename)
- self._log_transfer("Starting unzip...", path, target_path)
-
try:
zip_file = zipfile.ZipFile(path, "r")
except zipfile.BadZipfile, err:
@@ -345,7 +283,6 @@ class AutoInstaller(object):
return new_path
def _download_to_stream(self, url, stream):
- """Download an URL to a stream, and return the number of bytes."""
try:
netstream = urllib.urlopen(url)
except IOError, err:
@@ -364,29 +301,21 @@ class AutoInstaller(object):
raise ValueError("HTTP Error code %s" % code)
BUFSIZE = 2**13 # 8KB
- bytes = 0
while True:
data = netstream.read(BUFSIZE)
if not data:
break
stream.write(data)
- bytes += len(data)
netstream.close()
- return bytes
def _download(self, url, scratch_dir):
- """Download URL contents, and return the download path."""
url_path = urlparse.urlsplit(url)[2]
url_path = os.path.normpath(url_path) # Removes trailing slash.
target_filename = os.path.basename(url_path)
target_path = os.path.join(scratch_dir, target_filename)
- self._log_transfer("Starting download...", url, target_path)
-
with open(target_path, "wb") as stream:
- bytes = self._download_to_stream(url, stream)
-
- _log.debug("Downloaded %s bytes." % bytes)
+ self._download_to_stream(url, stream)
return target_path
@@ -407,19 +336,21 @@ class AutoInstaller(object):
source_path = os.path.join(path, url_subpath)
if os.path.exists(target_path):
- _log.debug('Refreshing install: deleting "%s".' % target_path)
if os.path.isdir(target_path):
shutil.rmtree(target_path)
else:
os.remove(target_path)
- self._log_transfer("Moving files into place...", source_path, target_path)
-
- # The shutil.move() command creates intermediate directories if they
- # do not exist, but we do not rely on this behavior since we
- # need to create the __init__.py file anyway.
+ # shutil.move() command creates intermediate directories if they do not exist.
shutil.move(source_path, target_path)
+ # ensure all the new directories are importable.
+ intermediate_dirs = os.path.dirname(os.path.relpath(target_path, self._target_dir))
+ parent_dirname = self._target_dir
+ for dirname in intermediate_dirs.split(os.sep):
+ parent_dirname = os.path.join(parent_dirname, dirname)
+ self._make_package(parent_dirname)
+
self._record_url_downloaded(package_name, url)
def install(self, url, should_refresh=False, target_name=None,
@@ -453,13 +384,10 @@ class AutoInstaller(object):
target_path = os.path.join(self._target_dir, target_name)
if not should_refresh and self._is_downloaded(target_name, url):
- _log.debug('URL for %s already downloaded. Skipping...'
- % target_name)
- _log.debug(' "%s"' % url)
return False
- self._log_transfer("Auto-installing package: %s" % target_name,
- url, target_path, log_method=_log.info)
+ package_name = target_name.replace(os.sep, '.')
+ _log.info("Auto-installing package: %s" % package_name)
# The scratch directory is where we will download and prepare
# files specific to this install until they are ready to move
@@ -467,7 +395,7 @@ class AutoInstaller(object):
scratch_dir = self._create_scratch_directory(target_name)
try:
- self._install(package_name=target_name,
+ self._install(package_name=package_name,
target_path=target_path,
scratch_dir=scratch_dir,
url=url,
@@ -480,38 +408,7 @@ class AutoInstaller(object):
% (target_name, target_path, err))
raise Exception(message)
finally:
- _log.debug('Cleaning up: deleting "%s".' % scratch_dir)
shutil.rmtree(scratch_dir)
- _log.debug('Auto-installed %s to:' % target_name)
+ _log.debug('Auto-installed %s to:' % url)
_log.debug(' "%s"' % target_path)
return True
-
-
-if __name__=="__main__":
-
- # Configure the autoinstall logger to log DEBUG messages for
- # development testing purposes.
- console = logging.StreamHandler()
-
- formatter = logging.Formatter('%(name)s: %(levelname)-8s %(message)s')
- console.setFormatter(formatter)
- _log.addHandler(console)
- _log.setLevel(logging.DEBUG)
-
- # Use a more visible temp directory for debug purposes.
- this_dir = os.path.dirname(__file__)
- target_dir = os.path.join(this_dir, "autoinstalled")
- temp_dir = os.path.join(target_dir, "Temp")
-
- installer = AutoInstaller(target_dir=target_dir,
- temp_dir=temp_dir)
-
- installer.install(should_refresh=False,
- target_name="pep8.py",
- url="http://pypi.python.org/packages/source/p/pep8/pep8-0.5.0.tar.gz#md5=512a818af9979290cd619cce8e9c2e2b",
- url_subpath="pep8-0.5.0/pep8.py")
- installer.install(should_refresh=False,
- target_name="mechanize",
- url="http://pypi.python.org/packages/source/m/mechanize/mechanize-0.2.4.zip",
- url_subpath="mechanize")
-
diff --git a/Tools/Scripts/webkitpy/common/system/executive.py b/Tools/Scripts/webkitpy/common/system/executive.py
index f1a401268..b1d239090 100644
--- a/Tools/Scripts/webkitpy/common/system/executive.py
+++ b/Tools/Scripts/webkitpy/common/system/executive.py
@@ -215,6 +215,9 @@ class Executive(object):
if e.errno == errno.ECHILD:
# Can't wait on a non-child process, but the kill worked.
return
+ if e.errno == errno.EACCES and sys.platform == 'cygwin':
+ # Cygwin python sometimes can't kill native processes.
+ return
raise
def _win32_check_running_pid(self, pid):
diff --git a/Tools/Scripts/webkitpy/common/system/executive_mock.py b/Tools/Scripts/webkitpy/common/system/executive_mock.py
index cce21b233..c2613530b 100644
--- a/Tools/Scripts/webkitpy/common/system/executive_mock.py
+++ b/Tools/Scripts/webkitpy/common/system/executive_mock.py
@@ -60,6 +60,7 @@ class MockExecutive(object):
# FIXME: Once executive wraps os.getpid() we can just use a static pid for "this" process.
self._running_pids = {'test-webkitpy': os.getpid()}
self._proc = None
+ self.calls = []
def check_running_pid(self, pid):
return pid in self._running_pids.values()
@@ -92,6 +93,9 @@ class MockExecutive(object):
return_stderr=True,
decode_output=False,
env=None):
+
+ self.calls.append(args)
+
assert(isinstance(args, list) or isinstance(args, tuple))
if self._should_log:
env_string = ""
@@ -109,7 +113,14 @@ class MockExecutive(object):
def cpu_count(self):
return 2
+ def kill_all(self, process_name):
+ pass
+
+ def kill_process(self, pid):
+ pass
+
def popen(self, args, cwd=None, env=None, **kwargs):
+ self.calls.append(args)
if self._should_log:
cwd_string = ""
if cwd:
@@ -123,32 +134,27 @@ class MockExecutive(object):
return self._proc
def run_in_parallel(self, commands):
+ num_previous_calls = len(self.calls)
command_outputs = []
for cmd_line, cwd in commands:
command_outputs.append([0, self.run_command(cmd_line, cwd=cwd), ''])
+
+ new_calls = self.calls[num_previous_calls:]
+ self.calls = self.calls[:num_previous_calls]
+ self.calls.append(new_calls)
return command_outputs
-class MockExecutive2(object):
- @staticmethod
- def ignore_error(error):
- pass
- def __init__(self, output='', exit_code=0, exception=None,
- run_command_fn=None, stderr=''):
+class MockExecutive2(MockExecutive):
+ """MockExecutive2 is like MockExecutive except it doesn't log anything."""
+
+ def __init__(self, output='', exit_code=0, exception=None, run_command_fn=None, stderr=''):
self._output = output
self._stderr = stderr
self._exit_code = exit_code
self._exception = exception
self._run_command_fn = run_command_fn
-
- def cpu_count(self):
- return 2
-
- def kill_all(self, process_name):
- pass
-
- def kill_process(self, pid):
- pass
+ self.calls = []
def run_command(self,
args,
@@ -159,6 +165,7 @@ class MockExecutive2(object):
return_stderr=True,
decode_output=False,
env=None):
+ self.calls.append(args)
assert(isinstance(args, list) or isinstance(args, tuple))
if self._exception:
raise self._exception
diff --git a/Tools/Scripts/webkitpy/common/system/file_lock_mock.py b/Tools/Scripts/webkitpy/common/system/file_lock_mock.py
new file mode 100644
index 000000000..e2c1d5cdf
--- /dev/null
+++ b/Tools/Scripts/webkitpy/common/system/file_lock_mock.py
@@ -0,0 +1,36 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 Google Inc. All rights reserved.
+#
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY UNIVERSITY OF SZEGED ``AS IS'' AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL UNIVERSITY OF SZEGED OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+class MockFileLock(object):
+ def __init__(self, lock_file_path, max_wait_time_sec=20):
+ pass
+
+ def acquire_lock(self):
+ pass
+
+ def release_lock(self):
+ pass
diff --git a/Tools/Scripts/webkitpy/common/system/logutils.py b/Tools/Scripts/webkitpy/common/system/logutils.py
index eef463693..def3bec4e 100644
--- a/Tools/Scripts/webkitpy/common/system/logutils.py
+++ b/Tools/Scripts/webkitpy/common/system/logutils.py
@@ -125,7 +125,7 @@ def get_logger(path):
return logging.getLogger(logger_name)
-def _default_handlers(stream):
+def _default_handlers(stream, logging_level):
"""Return a list of the default logging handlers to use.
Args:
@@ -148,7 +148,11 @@ def _default_handlers(stream):
# Create the handler.
handler = logging.StreamHandler(stream)
- formatter = logging.Formatter("%(name)s: [%(levelname)s] %(message)s")
+ if logging_level == logging.DEBUG:
+ formatter = logging.Formatter("%(name)s: [%(levelname)s] %(message)s")
+ else:
+ formatter = logging.Formatter("%(message)s")
+
handler.setFormatter(formatter)
handler.addFilter(logging_filter)
@@ -195,7 +199,7 @@ def configure_logging(logging_level=None, logger=None, stream=None,
if stream is None:
stream = sys.stderr
if handlers is None:
- handlers = _default_handlers(stream)
+ handlers = _default_handlers(stream, logging_level)
logger.setLevel(logging_level)
diff --git a/Tools/Scripts/webkitpy/common/system/logutils_unittest.py b/Tools/Scripts/webkitpy/common/system/logutils_unittest.py
index f1b494d4d..72789eb37 100644
--- a/Tools/Scripts/webkitpy/common/system/logutils_unittest.py
+++ b/Tools/Scripts/webkitpy/common/system/logutils_unittest.py
@@ -107,7 +107,11 @@ class ConfigureLoggingTest(ConfigureLoggingTestBase):
def test_info_message(self):
self._log.info("test message")
- self._assert_log_messages(["unittest: [INFO] test message\n"])
+ self._assert_log_messages(["test message\n"])
+
+ def test_debug_message(self):
+ self._log.debug("test message")
+ self._assert_log_messages([])
def test_below_threshold_message(self):
# We test the boundary case of a logging level equal to 19.
@@ -120,9 +124,21 @@ class ConfigureLoggingTest(ConfigureLoggingTestBase):
def test_two_messages(self):
self._log.info("message1")
self._log.info("message2")
- self._assert_log_messages(["unittest: [INFO] message1\n",
- "unittest: [INFO] message2\n"])
+ self._assert_log_messages(["message1\n",
+ "message2\n"])
+
+
+class ConfigureLoggingVerboseTest(ConfigureLoggingTestBase):
+ def _logging_level(self):
+ return logging.DEBUG
+
+ def test_info_message(self):
+ self._log.info("test message")
+ self._assert_log_messages(["unittest: [INFO] test message\n"])
+ def test_debug_message(self):
+ self._log.debug("test message")
+ self._assert_log_messages(["unittest: [DEBUG] test message\n"])
class ConfigureLoggingCustomLevelTest(ConfigureLoggingTestBase):
@@ -135,7 +151,7 @@ class ConfigureLoggingCustomLevelTest(ConfigureLoggingTestBase):
def test_logged_message(self):
self._log.log(self._level, "test message")
- self._assert_log_messages(["unittest: [Level 36] test message\n"])
+ self._assert_log_messages(["test message\n"])
def test_below_threshold_message(self):
self._log.log(self._level - 1, "test message")
diff --git a/Tools/Scripts/webkitpy/common/system/platforminfo.py b/Tools/Scripts/webkitpy/common/system/platforminfo.py
index a9717cc84..b2451f5f9 100644
--- a/Tools/Scripts/webkitpy/common/system/platforminfo.py
+++ b/Tools/Scripts/webkitpy/common/system/platforminfo.py
@@ -27,6 +27,7 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import re
+import sys
class PlatformInfo(object):
@@ -86,6 +87,31 @@ class PlatformInfo(object):
return long(self._executive.run_command(["sysctl", "-n", "hw.memsize"]))
return None
+ def terminal_width(self):
+ """Returns sys.maxint if the width cannot be determined."""
+ try:
+ if self.is_win():
+ # From http://code.activestate.com/recipes/440694-determine-size-of-console-window-on-windows/
+ from ctypes import windll, create_string_buffer
+ handle = windll.kernel32.GetStdHandle(-12) # -12 == stderr
+ console_screen_buffer_info = create_string_buffer(22) # 22 == sizeof(console_screen_buffer_info)
+ if windll.kernel32.GetConsoleScreenBufferInfo(handle, console_screen_buffer_info):
+ import struct
+ _, _, _, _, _, left, _, right, _, _, _ = struct.unpack("hhhhHhhhhhh", console_screen_buffer_info.raw)
+ # Note that we return 1 less than the width since writing into the rightmost column
+ # automatically performs a line feed.
+ return right - left
+ return sys.maxint
+ else:
+ import fcntl
+ import struct
+ import termios
+ packed = fcntl.ioctl(sys.stderr.fileno(), termios.TIOCGWINSZ, '\0' * 8)
+ _, columns, _, _ = struct.unpack('HHHH', packed)
+ return columns
+ except:
+ return sys.maxint
+
def _determine_os_name(self, sys_platform):
if sys_platform == 'darwin':
return 'mac'
diff --git a/Tools/Scripts/webkitpy/common/system/platforminfo_mock.py b/Tools/Scripts/webkitpy/common/system/platforminfo_mock.py
index 34fa97fb4..bc72810cf 100644
--- a/Tools/Scripts/webkitpy/common/system/platforminfo_mock.py
+++ b/Tools/Scripts/webkitpy/common/system/platforminfo_mock.py
@@ -42,7 +42,7 @@ class MockPlatformInfo(object):
return self.os_name == 'win'
def is_cygwin(self):
- return False
+ return self.os_name == 'cygwin'
def is_freebsd(self):
return self.os_name == 'freebsd'
@@ -52,3 +52,6 @@ class MockPlatformInfo(object):
def total_bytes_memory(self):
return 3 * 1024 * 1024 * 1024 # 3GB is a reasonable amount of ram to mock.
+
+ def terminal_width(self):
+ return 80
diff --git a/Tools/Scripts/webkitpy/common/system/platforminfo_unittest.py b/Tools/Scripts/webkitpy/common/system/platforminfo_unittest.py
index 445ef5f7d..a2b4255b7 100644
--- a/Tools/Scripts/webkitpy/common/system/platforminfo_unittest.py
+++ b/Tools/Scripts/webkitpy/common/system/platforminfo_unittest.py
@@ -79,6 +79,7 @@ class TestPlatformInfo(unittest.TestCase):
self.assertNotEquals(info.os_version, '')
self.assertNotEquals(info.display_name(), '')
self.assertTrue(info.is_mac() or info.is_win() or info.is_linux() or info.is_freebsd())
+ self.assertNotEquals(info.terminal_width(), None)
if info.is_mac():
self.assertTrue(info.total_bytes_memory() > 0)
diff --git a/Tools/Scripts/webkitpy/common/system/systemhost.py b/Tools/Scripts/webkitpy/common/system/systemhost.py
index 3b4439ee4..dfec68bc1 100644
--- a/Tools/Scripts/webkitpy/common/system/systemhost.py
+++ b/Tools/Scripts/webkitpy/common/system/systemhost.py
@@ -30,7 +30,7 @@ import os
import platform
import sys
-from webkitpy.common.system import environment, executive, filesystem, platforminfo, user, workspace
+from webkitpy.common.system import environment, executive, file_lock, filesystem, platforminfo, user, workspace
class SystemHost(object):
@@ -43,3 +43,6 @@ class SystemHost(object):
def copy_current_environment(self):
return environment.Environment(os.environ.copy())
+
+ def make_file_lock(self, path):
+ return file_lock.FileLock(path)
diff --git a/Tools/Scripts/webkitpy/common/system/systemhost_mock.py b/Tools/Scripts/webkitpy/common/system/systemhost_mock.py
index 4667b08b9..a529f3483 100644
--- a/Tools/Scripts/webkitpy/common/system/systemhost_mock.py
+++ b/Tools/Scripts/webkitpy/common/system/systemhost_mock.py
@@ -29,6 +29,7 @@
from webkitpy.common.system.environment import Environment
from webkitpy.common.system.executive_mock import MockExecutive
from webkitpy.common.system.filesystem_mock import MockFileSystem
+from webkitpy.common.system.file_lock_mock import MockFileLock
from webkitpy.common.system.platforminfo_mock import MockPlatformInfo
from webkitpy.common.system.user_mock import MockUser
from webkitpy.common.system.workspace_mock import MockWorkspace
@@ -50,3 +51,6 @@ class MockSystemHost(object):
def copy_current_environment(self):
return Environment({"MOCK_ENVIRON_COPY": '1'})
+
+ def make_file_lock(self, path):
+ return MockFileLock(path)