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

Unified Diff: build/android/gyp/util/build_utils.py

Issue 295683002: Make javac.py output colorful (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 6 months 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
« build/android/gyp/javac.py ('K') | « build/android/gyp/javac.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/gyp/util/build_utils.py
diff --git a/build/android/gyp/util/build_utils.py b/build/android/gyp/util/build_utils.py
index 36c83193c1ad3347b6a4b563b14ac5c76552b087..4876539eb252b8f89fa91c65256b7389d4c6af25 100644
--- a/build/android/gyp/util/build_utils.py
+++ b/build/android/gyp/util/build_utils.py
@@ -11,6 +11,11 @@ import shutil
import subprocess
import sys
+CHROMIUM_SRC = os.path.join(os.path.dirname(__file__),
+ os.pardir, os.pardir, os.pardir, os.pardir)
+COLORAMA_ROOT = os.path.join(CHROMIUM_SRC,
+ 'third_party', 'colorama', 'src')
+
def MakeDirectory(dir_path):
try:
@@ -100,7 +105,10 @@ class CalledProcessError(Exception):
# This can be used in most cases like subprocess.check_output(). The output,
# particularly when the command fails, better highlights the command's failure.
# If the command fails, raises a build_utils.CalledProcessError.
-def CheckOutput(args, cwd=None, print_stdout=False, print_stderr=True,
+def CheckOutput(args, cwd=None,
+ print_stdout=False, print_stderr=True,
+ stdout_filter=None,
+ stderr_filter=None,
fail_func=lambda returncode, stderr: returncode != 0):
if not cwd:
cwd = os.getcwd()
@@ -109,6 +117,12 @@ def CheckOutput(args, cwd=None, print_stdout=False, print_stderr=True,
stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=cwd)
stdout, stderr = child.communicate()
+ if stdout_filter is not None:
+ stdout = stdout_filter(stdout)
+
+ if stderr_filter is not None:
+ stderr = stderr_filter(stderr)
+
if fail_func(child.returncode, stderr):
raise CalledProcessError(cwd, args, stdout + stderr)
« build/android/gyp/javac.py ('K') | « build/android/gyp/javac.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698