mirror of
https://github.com/openai/codex.git
synced 2026-11-14 21:40:39 +00:00
Fix Bazel tool resolution for bubblewrap and voice builds (#61254)
## What changed - Use the Bazel coreutils toolchain's `sha256sum` to generate `CODEX_BWRAP_SHA256` for bubblewrap. - Add the running Python interpreter's directory to `PATH` for Unix native voice builds so GLib generators using `env python3` can find it. ## Testing Add a regression test verifying that a Unix generator using `env python3` runs with the recipe's interpreter. GitOrigin-RevId: 52694cc09c92db27bc117217d3833a35524ff304
This commit is contained in:
Vendored
+6
-8
@@ -135,14 +135,12 @@ class NativeBuild:
|
||||
}
|
||||
if windows_inputs is not None:
|
||||
self.environment.pop("LIBPATH", None)
|
||||
paths = [
|
||||
str(self.tools / "bin"),
|
||||
*(
|
||||
[]
|
||||
if windows_inputs is not None
|
||||
else [str(p.parent) for p in self.toolchain.values()]
|
||||
),
|
||||
]
|
||||
paths = [str(self.tools / "bin")]
|
||||
if not self.windows:
|
||||
# GLib generators use /usr/bin/env python3 even when Meson runs under Bazel.
|
||||
paths.append(str(Path(sys.executable).parent))
|
||||
if windows_inputs is None:
|
||||
paths.extend(str(p.parent) for p in self.toolchain.values())
|
||||
paths += (
|
||||
inherited_environment.get("PATH", "").split(os.pathsep)
|
||||
if self.windows
|
||||
|
||||
+15
@@ -85,6 +85,21 @@ class NativeBuildTests(unittest.TestCase):
|
||||
NativeBuild(self.args, self.environment)
|
||||
self.assertFalse(self.args.output.exists())
|
||||
|
||||
@unittest.skipIf(os.name == "nt", "Exercises a Unix generator shebang")
|
||||
def test_generator_uses_the_recipe_interpreter(self):
|
||||
python = self.root / "runtime" / "bin" / "python3"
|
||||
python.parent.mkdir(parents=True)
|
||||
python.symlink_to(sys.executable)
|
||||
with patch("sys.executable", str(python)):
|
||||
build = NativeBuild(self.args, self.environment)
|
||||
generator = self.root / "generator"
|
||||
generator.write_text(
|
||||
"#!/usr/bin/env python3\nimport sys\nprint(sys.executable)\n"
|
||||
)
|
||||
generator.chmod(0o755)
|
||||
result = subprocess.check_output([generator], env=build.environment, text=True)
|
||||
self.assertEqual(result.strip(), str(python))
|
||||
|
||||
@unittest.skipIf(os.name == "nt", "Exercises the Unix clang++ driver symlink")
|
||||
def test_bootstrap_links_cpp_runtime_through_compiler_symlink(self):
|
||||
tools = {name: shutil.which(name) for name in ("clang", "cmake", "make")}
|
||||
|
||||
Reference in New Issue
Block a user