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) |