Telethon/tools/codegen.py

27 lines
610 B
Python
Raw Normal View History

"""
Run `telethon_generator.codegen` on both `api.tl` and `mtproto.tl` to output
corresponding Python code in the default directories under the `client/`.
"""
import subprocess
import sys
GENERATOR = "telethon_generator.codegen"
2023-10-16 19:36:20 +03:00
GEN_ROOT = "client/src/telethon/_impl"
TL_ROOT = "generator/tl"
def run(*args: str) -> int:
return subprocess.run((sys.executable, "-m", *args)).returncode
def main() -> None:
exit(
2023-10-16 19:36:20 +03:00
run(GENERATOR, f"{TL_ROOT}/api.tl", f"{GEN_ROOT}/tl")
or run(GENERATOR, f"{TL_ROOT}/mtproto.tl", f"{GEN_ROOT}/tl/mtproto")
)
if __name__ == "__main__":
main()