script: Use Pythonic file names for code generation and use functools.cache (#38047)

Renames the files to pythonic file names. Also replaces the bespoke
caching function with the functools caching function which is
functionally equivalent.

---------

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
This commit is contained in:
Ashwin Naren 2025-07-14 12:38:55 -07:00 committed by GitHub
parent 8a19bc9145
commit ac2cfdb801
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 6 additions and 26 deletions

View file

@ -27,8 +27,8 @@ def main():
config_file = "Bindings.conf"
import WebIDL
from Configuration import Configuration
from CodegenRust import CGBindingRoot, CGConcreteBindingRoot
from configuration import Configuration
from codegen import CGBindingRoot, CGConcreteBindingRoot
parser = WebIDL.Parser(make_dir(os.path.join(out_dir, "cache")))
webidls = [name for name in os.listdir(webidls_dir) if name.endswith(".webidl")]
@ -91,7 +91,7 @@ def make_dir(path):
def generate(config, name, filename):
from CodegenRust import GlobalGenRoots
from codegen import GlobalGenRoots
root = getattr(GlobalGenRoots, name)(config)
code = root.define()
with open(filename, "wb") as f: