diff options
author | thegeorg <thegeorg@yandex-team.com> | 2023-09-29 23:52:33 +0300 |
---|---|---|
committer | thegeorg <thegeorg@yandex-team.com> | 2023-09-30 00:21:59 +0300 |
commit | 866215175648a5f00ca9b617cbac975462e06f0d (patch) | |
tree | 9b67129765fe600b06d9dc8ca323c96224980d24 /tools/py3cc/main.py | |
parent | 611ec625981b1cb27dfb70f7da4a4bbcd4bb2384 (diff) | |
download | ydb-866215175648a5f00ca9b617cbac975462e06f0d.tar.gz |
Move contrib/tools/python3/pycc to tools/py3cc
This is not a third party code, it is written by us.
Diffstat (limited to 'tools/py3cc/main.py')
-rwxr-xr-x | tools/py3cc/main.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/py3cc/main.py b/tools/py3cc/main.py new file mode 100755 index 0000000000..996edb2bdd --- /dev/null +++ b/tools/py3cc/main.py @@ -0,0 +1,19 @@ +import marshal +import sys + + +def main(): + srcpathx, in_fname, out_fname = sys.argv[1:] + srcpath = srcpathx[:-1] + + with open(in_fname, 'r', encoding='utf-8') as in_file: + source = in_file.read() + + code = compile(source, srcpath, 'exec', dont_inherit=True) + + with open(out_fname, 'wb') as out_file: + marshal.dump(code, out_file) + + +if __name__ == '__main__': + main() |