[Lldb-commits] [PATCH] D83840: [lldb][test] Prevent infinite loop while looking for use_lldb_suite_root.py.
Pavel Labath via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Thu Jul 16 03:20:56 PDT 2020
labath added a comment.
In D83840#2154263 <https://reviews.llvm.org/D83840#2154263>, @shafik wrote:
> @labath why do we need two copies of `use_lldb_suite.py`?
This script is responsible for setting up an appropriate python import path. Before we can import any code in lldb/third_party/Python/module or lldb/packages/Python, we need to add those paths to `sys.path`. And we cannot completely put this code into a central place because then we wouldn't know how to import that.
So, the way get around that is by placing this file into the same folder as the script that needs it. Then, the script can load this file using a relative import, and afterwards, it can import anything it wants. And since we have scripts needing this functionality in multiple places, we have multiple copies of the script.
At least that's the current state of the art. It's possible that there are better solutions, but we just don't know about them.
I wouldn't say this is a major problem. These files don't get a lot of traffic -- this is pretty much the second change since they were added five years ago, and the only reason we ran into this is because it caused problems in our weird internal distributed build setup. But removing the duplication would certainly be nice...
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D83840/new/
https://reviews.llvm.org/D83840
More information about the lldb-commits
mailing list