diff options
author | deshevoy <deshevoy@yandex-team.ru> | 2022-02-10 16:46:56 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:56 +0300 |
commit | e988f30484abe5fdeedcc7a5d3c226c01a21800c (patch) | |
tree | 0a217b173aabb57b7e51f8a169989b1a3e0309fe /build/scripts/gen_tasklet_reg.py | |
parent | 33ee501c05d3f24036ae89766a858930ae66c548 (diff) | |
download | ydb-e988f30484abe5fdeedcc7a5d3c226c01a21800c.tar.gz |
Restoring authorship annotation for <deshevoy@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'build/scripts/gen_tasklet_reg.py')
-rw-r--r-- | build/scripts/gen_tasklet_reg.py | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/build/scripts/gen_tasklet_reg.py b/build/scripts/gen_tasklet_reg.py index 5b747c2eca..e854446cb4 100644 --- a/build/scripts/gen_tasklet_reg.py +++ b/build/scripts/gen_tasklet_reg.py @@ -1,16 +1,16 @@ -import argparse - +import argparse + TEMPLATE = '''\ {includes}\ #include <tasklet/runtime/lib/{language}_wrapper.h> #include <tasklet/runtime/lib/registry.h> - + static const NTasklet::TRegHelper REG( - "{name}", + "{name}", new NTasklet::{wrapper} -); -''' - +); +''' + WRAPPER = { 'cpp': 'TCppWrapper<{impl}>()', 'js': 'TJsWrapper("{impl}")', @@ -18,34 +18,34 @@ WRAPPER = { 'py': 'TPythonWrapper("{impl}")', 'java': 'TJavaWrapper("{impl}", "{py_wrapper}")', } - - -def parse_args(): - parser = argparse.ArgumentParser() + + +def parse_args(): + parser = argparse.ArgumentParser() parser.add_argument('name') parser.add_argument('output') parser.add_argument('-l', '--lang', choices=WRAPPER, required=True) parser.add_argument('-i', '--impl', required=True) parser.add_argument('-w', '--wrapper', required=False) parser.add_argument('includes', nargs='*') - - return parser.parse_args() - - -if __name__ == '__main__': - args = parse_args() - + + return parser.parse_args() + + +if __name__ == '__main__': + args = parse_args() + includes = ''.join( '#include <{}>\n'.format(include) - for include in args.includes - ) - - code = TEMPLATE.format( - includes=includes, + for include in args.includes + ) + + code = TEMPLATE.format( + includes=includes, language=args.lang, - name=args.name, + name=args.name, wrapper=WRAPPER[args.lang].format(impl=args.impl, py_wrapper=args.wrapper), - ) - + ) + with open(args.output, 'w') as f: - f.write(code) + f.write(code) |