From 2b85a089251161df54b227578218fc11ad5f02a3 Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Thu, 18 Apr 2024 16:02:57 -0700 Subject: kleaf: wrapper fixes --strip_execroot flag. Import re globally. Test: TH Bug: N/A Change-Id: Ifc7ab2c2922e5e1c0fc97a1aab25a8b11c6fa77e --- kleaf/bazel.py | 3 +-- kleaf/tests/integration_test/integration_test.py | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/kleaf/bazel.py b/kleaf/bazel.py index 9a876276..ff8c973c 100755 --- a/kleaf/bazel.py +++ b/kleaf/bazel.py @@ -15,6 +15,7 @@ import argparse import os import pathlib +import re import shlex import shutil import sys @@ -546,7 +547,6 @@ class BazelWrapper(KleafHelpPrinter): if run_as_subprocess: import asyncio - import re asyncio.run(run(final_args, self.env, filter_regex, epilog_coro)) else: os.execve(path=self.bazel_path, argv=final_args, env=self.env) @@ -561,7 +561,6 @@ async def output_filter(input_stream, output_stream, filter_regex): If filter_regex is None, don't filter lines. """ - import re while not input_stream.at_eof(): output = await input_stream.readline() if filter_regex: diff --git a/kleaf/tests/integration_test/integration_test.py b/kleaf/tests/integration_test/integration_test.py index f874d552..021a8040 100644 --- a/kleaf/tests/integration_test/integration_test.py +++ b/kleaf/tests/integration_test/integration_test.py @@ -617,6 +617,11 @@ class QuickIntegrationTest(KleafIntegrationTestBase): """Test that `bazel help kleaf` works.""" self._check_output("help", ["kleaf"]) + def test_strip_execroot(self): + """Test that --strip_execroot works.""" + self._check_output("build", ["--nobuild", "--strip_execroot", + "//build/kernel:hermetic-tools"]) + class ScmversionIntegrationTest(KleafIntegrationTestBase): -- cgit v1.2.3