[lldb/Bindings] Move bindings into their own subdirectory

All the code required to generate the language bindings for Python and
Lua lives under scripts, even though the majority of this code aren't
scripts at all, and surrounded by scripts that are totally unrelated.

I've reorganized these files and moved everything related to the
language bindings into a new top-level directory named bindings. This
makes the corresponding files self contained and much more discoverable.

Differential revision: https://reviews.llvm.org/D72437
This commit is contained in:
Jonas Devlieghere
2020-01-09 07:57:59 -08:00
parent 241f335b26
commit 6498aff249
80 changed files with 17 additions and 18 deletions

View File

@@ -0,0 +1,17 @@
import os
import sys
pkgRelDir = sys.argv[1]
pkgFiles = sys.argv[2:]
getFileName = lambda f: os.path.splitext(os.path.basename(f))[0]
importNames = ', '.join('"{}"'.format(getFileName(f)) for f in pkgFiles)
script = """__all__ = [{import_names}]
for x in __all__:
__import__('lldb.{pkg_name}.' + x)
""".format(import_names=importNames, pkg_name=pkgRelDir.replace("/", "."))
pkgIniFile = os.path.normpath(os.path.join(pkgRelDir, "__init__.py"))
with open(pkgIniFile, "w") as f:
f.write(script)