diff options
author | snermolaev <snermolaev@yandex-team.ru> | 2022-02-10 16:45:53 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:53 +0300 |
commit | 2015790ac9fcc04caab83fccc23ab2460310a797 (patch) | |
tree | e644e9bc3f6f688561a871793b59bf8a637e0f72 /build/scripts/cpp_flatc_wrapper.py | |
parent | c768a99151e47c3a4bb7b92c514d256abd301c4d (diff) | |
download | ydb-2015790ac9fcc04caab83fccc23ab2460310a797.tar.gz |
Restoring authorship annotation for <snermolaev@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'build/scripts/cpp_flatc_wrapper.py')
-rw-r--r-- | build/scripts/cpp_flatc_wrapper.py | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/build/scripts/cpp_flatc_wrapper.py b/build/scripts/cpp_flatc_wrapper.py index 78a20e0280..bae30e7d08 100644 --- a/build/scripts/cpp_flatc_wrapper.py +++ b/build/scripts/cpp_flatc_wrapper.py @@ -1,31 +1,31 @@ -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.Popen(cmd, stdin=None, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - out, err = p.communicate() - if p.returncode: - if out: - sys.stderr.write('stdout:\n{}\n'.format(out)) - if err: - sys.stderr.write('stderr:\n{}\n'.format(err)) - 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() +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.Popen(cmd, stdin=None, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + out, err = p.communicate() + if p.returncode: + if out: + sys.stderr.write('stdout:\n{}\n'.format(out)) + if err: + sys.stderr.write('stderr:\n{}\n'.format(err)) + 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() |