From 6cf44cd419a6171ced8e830cd9bdcb2da2667a0b Mon Sep 17 00:00:00 2001
From: Chandler Carruth <chandlerc@gmail.com>
Date: Sun, 12 Mar 2023 10:33:27 +0000
Subject: [PATCH] Modernize `py_binary` rule for `lit`.

This adds the a `main` attribute to clarify where the script should
start execution, and more importantly adds the `imports` list to setup
`PYTHONPATH` correctly for the tool's `import`s to find the internal
libraries.
---
 utils/bazel/llvm-project-overlay/llvm/BUILD.bazel | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel b/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
index c4b1998e647f..ae615f23a98c 100644
--- a/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
@@ -4555,6 +4555,8 @@ py_binary(
     name = "lit",
     testonly = True,
     srcs = ["utils/lit/lit.py"] + glob(["utils/lit/lit/**/*.py"]),
+    imports = ["utils/lit"],
+    main = "utils/lit/lit.py",
 )
 
 cc_library(
-- 
2.39.2

