Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(288)

Unified Diff: gclient_utils.py

Issue 391075: Revert 32057, 32058, 32059, 32062 because they still have unwanted side-effects. (Closed)
Patch Set: Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gclient_scm.py ('k') | git_cl_hooks.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gclient_utils.py
diff --git a/gclient_utils.py b/gclient_utils.py
index 4a5989c0cd4e2cc3f67260898fcc23ca7f930dd5..9016270d4d917c70202400f68b8c0299b090352d 100644
--- a/gclient_utils.py
+++ b/gclient_utils.py
@@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-"""Generic utils."""
-
import errno
import os
import re
@@ -24,6 +22,8 @@ import time
import xml.dom.minidom
import xml.parsers.expat
+## Generic utils
+
def SplitUrlRevision(url):
"""Splits url and returns a two-tuple: url, rev"""
@@ -76,9 +76,9 @@ class PrintableObject(object):
return output
-def FileRead(filename, mode='rU'):
+def FileRead(filename):
content = None
- f = open(filename, mode)
+ f = open(filename, "rU")
try:
content = f.read()
finally:
@@ -86,8 +86,8 @@ def FileRead(filename, mode='rU'):
return content
-def FileWrite(filename, content, mode='w'):
- f = open(filename, mode)
+def FileWrite(filename, content):
+ f = open(filename, "w")
try:
f.write(content)
finally:
@@ -201,9 +201,9 @@ def SubprocessCallAndFilter(command,
only if we actually need to print something else as well, so you can
get the context of the output. If print_messages is false and print_stdout
is false, no output at all is generated.
-
- Also, if print_stdout is true, the command's stdout is also forwarded
- to stdout.
+
+ Also, if print_stdout is true, the command's stdout is also forwarded
+ to stdout.
If a filter function is specified, it is expected to take a single
string argument, and it will be called with each line of the
@@ -223,7 +223,7 @@ def SubprocessCallAndFilter(command,
# executable, but shell=True makes subprocess on Linux fail when it's called
# with a list because it only tries to execute the first item in the list.
kid = subprocess.Popen(command, bufsize=0, cwd=in_directory,
- shell=(sys.platform == 'win32'), stdout=subprocess.PIPE,
+ shell=(sys.platform == 'win32'), stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
# Also, we need to forward stdout to prevent weird re-ordering of output.
@@ -238,7 +238,7 @@ def SubprocessCallAndFilter(command,
if not print_messages:
print("\n________ running \'%s\' in \'%s\'"
% (' '.join(command), in_directory))
- print_messages = True
+ print_messages = True
sys.stdout.write(in_byte)
if in_byte != "\n":
in_line += in_byte
« no previous file with comments | « gclient_scm.py ('k') | git_cl_hooks.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698