aboutsummaryrefslogtreecommitdiffstats
path: root/build/scripts/cpp_flatc_wrapper.py
diff options
context:
space:
mode:
authoralexv-smirnov <alex@ydb.tech>2023-03-15 19:59:12 +0300
committeralexv-smirnov <alex@ydb.tech>2023-03-15 19:59:12 +0300
commit056bb284ccf8dd6793ec3a54ffa36c4fb2b9ad11 (patch)
tree4740980126f32e3af7937ba0ca5f83e59baa4ab0 /build/scripts/cpp_flatc_wrapper.py
parent269126dcced1cc8b53eb4398b4a33e5142f10290 (diff)
downloadydb-056bb284ccf8dd6793ec3a54ffa36c4fb2b9ad11.tar.gz
add library/cpp/actors, ymake build to ydb oss export
Diffstat (limited to 'build/scripts/cpp_flatc_wrapper.py')
-rw-r--r--build/scripts/cpp_flatc_wrapper.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/build/scripts/cpp_flatc_wrapper.py b/build/scripts/cpp_flatc_wrapper.py
new file mode 100644
index 0000000000..9f74b65570
--- /dev/null
+++ b/build/scripts/cpp_flatc_wrapper.py
@@ -0,0 +1,30 @@
+import os
+import subprocess
+import sys
+
+
+def main():
+ cmd = sys.argv[1:]
+ h_file = None
+ try:
+ index = cmd.index('-o')
+ h_file = cmd[index+1]
+ cmd[index+1] = os.path.dirname(h_file)
+ except (ValueError, IndexError):
+ pass
+ p = subprocess.run(cmd, capture_output=True, text=True)
+ if p.returncode:
+ if p.stdout:
+ sys.stderr.write('stdout:\n{}\n'.format(p.stdout))
+ if p.stderr:
+ sys.stderr.write('stderr:\n{}\n'.format(p.stderr))
+ sys.exit(p.returncode)
+ if h_file and h_file.endswith(('.fbs.h', '.fbs64.h')):
+ cpp_file = '{}.cpp'.format(h_file[:-2])
+ with open(cpp_file, 'w') as f:
+ f.write('#include "{}"\n'.format(os.path.basename(h_file)))
+ sys.exit(0)
+
+
+if __name__ == '__main__':
+ main()