Skip to content

Commit 67c7af3

Browse files
committed
Suppress make install output by default
1 parent 0d1b6d1 commit 67c7af3

File tree

2 files changed

+27
-16
lines changed

2 files changed

+27
-16
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ repos:
7575
rev: v1.6.0
7676
hooks:
7777
- id: zizmor
78+
# Action files are misidentified as workflows.
7879
exclude: ^.github/actions/
7980

8081
- repo: https://github.com/sphinx-contrib/sphinx-lint

Android/android.py

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,13 @@ def make_host_python(context):
247247
# flags to be duplicated. So we don't use the `host` argument here.
248248
os.chdir(host_dir)
249249
run(["make", "-j", str(os.cpu_count())])
250-
run(["make", "install", f"prefix={prefix_dir}"])
250+
251+
# The `make install` output is very verbose and rarely useful, so
252+
# suppress it by default.
253+
run(
254+
["make", "install", f"prefix={prefix_dir}"],
255+
capture_output=not context.verbose,
256+
)
251257

252258

253259
def build_all(context):
@@ -695,24 +701,31 @@ def parse_args():
695701
parser = argparse.ArgumentParser()
696702
subcommands = parser.add_subparsers(dest="subcommand", required=True)
697703

704+
def add_parser(*args, **kwargs):
705+
parser = subcommands.add_parser(*args, **kwargs)
706+
parser.add_argument(
707+
"-v", "--verbose", action="count", default=0,
708+
help="Show verbose output. Use twice to be even more verbose.")
709+
return parser
710+
698711
# Subcommands
699-
build = subcommands.add_parser(
712+
build = add_parser(
700713
"build", help="Run configure-build, make-build, configure-host and "
701714
"make-host")
702-
configure_build = subcommands.add_parser(
715+
configure_build = add_parser(
703716
"configure-build", help="Run `configure` for the build Python")
704-
subcommands.add_parser(
717+
add_parser(
705718
"make-build", help="Run `make` for the build Python")
706-
configure_host = subcommands.add_parser(
719+
configure_host = add_parser(
707720
"configure-host", help="Run `configure` for Android")
708-
make_host = subcommands.add_parser(
721+
make_host = add_parser(
709722
"make-host", help="Run `make` for Android")
710723

711-
subcommands.add_parser("clean", help="Delete all build directories")
712-
subcommands.add_parser("build-testbed", help="Build the testbed app")
713-
test = subcommands.add_parser("test", help="Run the testbed app")
714-
package = subcommands.add_parser("package", help="Make a release package")
715-
env = subcommands.add_parser("env", help="Print environment variables")
724+
add_parser("clean", help="Delete all build directories")
725+
add_parser("build-testbed", help="Build the testbed app")
726+
test = add_parser("test", help="Run the testbed app")
727+
package = add_parser("package", help="Make a release package")
728+
env = add_parser("env", help="Print environment variables")
716729

717730
# Common arguments
718731
for subcommand in build, configure_build, configure_host:
@@ -733,11 +746,6 @@ def parse_args():
733746
help="Extra arguments to pass to `configure`")
734747

735748
# Test arguments
736-
test.add_argument(
737-
"-v", "--verbose", action="count", default=0,
738-
help="Show Gradle output, and non-Python logcat messages. "
739-
"Use twice to include high-volume messages which are rarely useful.")
740-
741749
device_group = test.add_mutually_exclusive_group(required=True)
742750
device_group.add_argument(
743751
"--connected", metavar="SERIAL", help="Run on a connected device. "
@@ -803,6 +811,8 @@ def main():
803811
def print_called_process_error(e):
804812
for stream_name in ["stdout", "stderr"]:
805813
content = getattr(e, stream_name)
814+
if isinstance(content, bytes):
815+
content = content.decode(*DECODE_ARGS)
806816
stream = getattr(sys, stream_name)
807817
if content:
808818
stream.write(content)

0 commit comments

Comments
 (0)