mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-04 19:12:29 +00:00
Create Python tools in favour of shell scripts
Python is likely to be installed when working on Python code, which should make it more portable and consistent.
This commit is contained in:
24
tools/codegen.py
Normal file
24
tools/codegen.py
Normal file
@@ -0,0 +1,24 @@
|
||||
"""
|
||||
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"
|
||||
ROOT = "client/src/telethon/_impl"
|
||||
|
||||
|
||||
def run(*args: str) -> int:
|
||||
return subprocess.run((sys.executable, "-m", *args)).returncode
|
||||
|
||||
|
||||
def main() -> None:
|
||||
exit(
|
||||
run(GENERATOR, "api.tl", f"{ROOT}/tl")
|
||||
or run(GENERATOR, "mtproto.tl", f"{ROOT}/tl/mtproto")
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Reference in New Issue
Block a user