aboutsummaryrefslogtreecommitdiffstats
path: root/tools/py3cc/main.py
diff options
context:
space:
mode:
authorthegeorg <thegeorg@yandex-team.com>2023-09-29 23:52:33 +0300
committerthegeorg <thegeorg@yandex-team.com>2023-09-30 00:21:59 +0300
commit866215175648a5f00ca9b617cbac975462e06f0d (patch)
tree9b67129765fe600b06d9dc8ca323c96224980d24 /tools/py3cc/main.py
parent611ec625981b1cb27dfb70f7da4a4bbcd4bb2384 (diff)
downloadydb-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-xtools/py3cc/main.py19
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()