2023-09-03 12:00:48 +03:00
|
|
|
"""
|
|
|
|
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"
|
2023-09-03 12:00:48 +03:00
|
|
|
|
|
|
|
|
|
|
|
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")
|
2023-09-03 12:00:48 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|