[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.19-706-ge5415e9
abarth at webkit.org
abarth at webkit.org
Thu Feb 4 21:26:29 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit 547c468ab8eed63d5e8dec619a86711aa99d37ee
Author: abarth at webkit.org <abarth at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sun Jan 24 12:16:05 2010 +0000
Rubber stamped by Eric Seidel.
More pep8 compliance.
* Scripts/webkitpy/executive.py:
* Scripts/webkitpy/grammar.py:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53777 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 561d904..1a00bb4 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -4,6 +4,15 @@
More pep8 compliance.
+ * Scripts/webkitpy/executive.py:
+ * Scripts/webkitpy/grammar.py:
+
+2010-01-24 Adam Barth <abarth at webkit.org>
+
+ Rubber stamped by Eric Seidel.
+
+ More pep8 compliance.
+
* Scripts/webkitpy/comments.py:
* Scripts/webkitpy/committers.py:
* Scripts/webkitpy/credentials.py:
diff --git a/WebKitTools/Scripts/webkitpy/executive.py b/WebKitTools/Scripts/webkitpy/executive.py
index 74a39a3..f8e4cb4 100644
--- a/WebKitTools/Scripts/webkitpy/executive.py
+++ b/WebKitTools/Scripts/webkitpy/executive.py
@@ -1,10 +1,10 @@
# Copyright (c) 2009, Google Inc. All rights reserved.
# Copyright (c) 2009 Apple Inc. All rights reserved.
-#
+#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
-#
+#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
@@ -14,7 +14,7 @@
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
-#
+#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -36,7 +36,13 @@ from webkitpy.webkit_logging import tee
class ScriptError(Exception):
- def __init__(self, message=None, script_args=None, exit_code=None, output=None, cwd=None):
+
+ def __init__(self,
+ message=None,
+ script_args=None,
+ exit_code=None,
+ output=None,
+ cwd=None):
if not message:
message = 'Failed to run "%s"' % script_args
if exit_code:
@@ -53,7 +59,8 @@ class ScriptError(Exception):
def message_with_output(self, output_limit=500):
if self.output:
if output_limit and len(self.output) > output_limit:
- return "%s\nLast %s characters of output:\n%s" % (self, output_limit, self.output[-output_limit:])
+ return "%s\nLast %s characters of output:\n%s" % \
+ (self, output_limit, self.output[-output_limit:])
return "%s\n%s" % (self, self.output)
return str(self)
@@ -64,17 +71,21 @@ class ScriptError(Exception):
return os.path.basename(command_path)
-# FIXME: This should not be a global static.
-# New code should use Executive.run_command directly instead
def run_command(*args, **kwargs):
+ # FIXME: This should not be a global static.
+ # New code should use Executive.run_command directly instead
return Executive().run_command(*args, **kwargs)
class Executive(object):
+
def _run_command_with_teed_output(self, args, teed_output):
- child_process = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ child_process = subprocess.Popen(args,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT)
- # Use our own custom wait loop because Popen ignores a tee'd stderr/stdout.
+ # Use our own custom wait loop because Popen ignores a tee'd
+ # stderr/stdout.
# FIXME: This could be improved not to flatten output to stdout.
while True:
output_line = child_process.stdout.readline()
@@ -96,7 +107,9 @@ class Executive(object):
child_out_file.close()
if exit_code:
- raise ScriptError(script_args=args, exit_code=exit_code, output=child_output)
+ raise ScriptError(script_args=args,
+ exit_code=exit_code,
+ output=child_output)
@staticmethod
def cpu_count():
@@ -104,10 +117,14 @@ class Executive(object):
try:
import multiprocessing
return multiprocessing.cpu_count()
- except (ImportError,NotImplementedError):
- return 2 # This quantity is a lie but probably a reasonable guess for modern machines.
+ except (ImportError, NotImplementedError):
+ # This quantity is a lie but probably a reasonable guess for modern
+ # machines.
+ return 2
+
+ # Error handlers do not need to be static methods once all callers are
+ # updated to use an Executive object.
- # Error handlers do not need to be static methods once all callers are updated to use an Executive object.
@staticmethod
def default_error_handler(error):
raise error
@@ -117,7 +134,14 @@ class Executive(object):
pass
# FIXME: This should be merged with run_and_throw_if_fail
- def run_command(self, args, cwd=None, input=None, error_handler=None, return_exit_code=False, return_stderr=True):
+
+ def run_command(self,
+ args,
+ cwd=None,
+ input=None,
+ error_handler=None,
+ return_exit_code=False,
+ return_stderr=True):
if hasattr(input, 'read'): # Check if the input is a file.
stdin = input
string_to_communicate = None
@@ -129,16 +153,24 @@ class Executive(object):
else:
stderr = None
try:
- process = subprocess.Popen(args, stdin=stdin, stdout=subprocess.PIPE, stderr=stderr, cwd=cwd)
+ process = subprocess.Popen(args,
+ stdin=stdin,
+ stdout=subprocess.PIPE,
+ stderr=stderr,
+ cwd=cwd)
output = process.communicate(string_to_communicate)[0]
exit_code = process.wait()
except OSError, e:
- # Catch OSError exceptions. For example, "no such file or directory" (i.e. OSError errno 2),
- # when the command cannot be found.
+ # Catch OSError exceptions. For example, "no such file or
+ # directory" (i.e. OSError errno 2), when the command cannot be
+ # found.
output = e.strerror
exit_code = e.errno
if exit_code:
- script_error = ScriptError(script_args=args, exit_code=exit_code, output=output, cwd=cwd)
+ script_error = ScriptError(script_args=args,
+ exit_code=exit_code,
+ output=output,
+ cwd=cwd)
(error_handler or self.default_error_handler)(script_error)
if return_exit_code:
return exit_code
diff --git a/WebKitTools/Scripts/webkitpy/grammar.py b/WebKitTools/Scripts/webkitpy/grammar.py
index dd2967a..78809e0 100644
--- a/WebKitTools/Scripts/webkitpy/grammar.py
+++ b/WebKitTools/Scripts/webkitpy/grammar.py
@@ -5,7 +5,7 @@
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
-#
+#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
@@ -15,7 +15,7 @@
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
-#
+#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -30,13 +30,15 @@
import re
+
def plural(noun):
- # This is a dumb plural() implementation which was just enough for our uses.
+ # This is a dumb plural() implementation that is just enough for our uses.
if re.search("h$", noun):
return noun + "es"
else:
return noun + "s"
+
def pluralize(noun, count):
if count != 1:
noun = plural(noun)
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list