aboutsummaryrefslogtreecommitdiffstats
path: root/tools/py3cc
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
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')
-rw-r--r--tools/py3cc/bin/ya.make26
-rwxr-xr-xtools/py3cc/main.py19
-rw-r--r--tools/py3cc/ya.make11
3 files changed, 56 insertions, 0 deletions
diff --git a/tools/py3cc/bin/ya.make b/tools/py3cc/bin/ya.make
new file mode 100644
index 0000000000..178ba5c4b4
--- /dev/null
+++ b/tools/py3cc/bin/ya.make
@@ -0,0 +1,26 @@
+PY3_PROGRAM_BIN(pycc)
+
+ENABLE(PYBUILD_NO_PYC)
+
+DISABLE(PYTHON_SQLITE3)
+
+PEERDIR(
+ library/python/runtime_py3
+ library/python/runtime_py3/main
+)
+
+NO_CHECK_IMPORTS()
+
+NO_PYTHON_INCLUDES()
+
+NO_PYTHON_COVERAGE()
+
+SRCDIR(
+ tools/py3cc
+)
+
+PY_SRCS(
+ MAIN main.py
+)
+
+END()
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()
diff --git a/tools/py3cc/ya.make b/tools/py3cc/ya.make
new file mode 100644
index 0000000000..b6f5ce202e
--- /dev/null
+++ b/tools/py3cc/ya.make
@@ -0,0 +1,11 @@
+IF (USE_PREBUILT_TOOLS)
+ INCLUDE(ya.make.prebuilt)
+ENDIF()
+
+IF (NOT PREBUILT)
+ INCLUDE(bin/ya.make)
+ENDIF()
+
+RECURSE(
+ bin
+)