diff options
author | orivej <orivej@yandex-team.ru> | 2022-02-10 16:44:49 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:49 +0300 |
commit | 718c552901d703c502ccbefdfc3c9028d608b947 (patch) | |
tree | 46534a98bbefcd7b1f3faa5b52c138ab27db75b7 /contrib/python/cffi/gen | |
parent | e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (diff) | |
download | ydb-718c552901d703c502ccbefdfc3c9028d608b947.tar.gz |
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/python/cffi/gen')
-rw-r--r-- | contrib/python/cffi/gen/lib/ya.make | 34 | ||||
-rw-r--r-- | contrib/python/cffi/gen/main.py | 74 | ||||
-rw-r--r-- | contrib/python/cffi/gen/ya.make | 30 |
3 files changed, 69 insertions, 69 deletions
diff --git a/contrib/python/cffi/gen/lib/ya.make b/contrib/python/cffi/gen/lib/ya.make index e5891f26a4..8a9f8cc1a3 100644 --- a/contrib/python/cffi/gen/lib/ya.make +++ b/contrib/python/cffi/gen/lib/ya.make @@ -1,21 +1,21 @@ -PY23_LIBRARY() - +PY23_LIBRARY() + LICENSE(MIT) -OWNER(orivej) - -PEERDIR( - contrib/python/cffi -) - -SRCDIR( - contrib/python/cffi/gen -) - -PY_SRCS( - MAIN main.py -) - +OWNER(orivej) + +PEERDIR( + contrib/python/cffi +) + +SRCDIR( + contrib/python/cffi/gen +) + +PY_SRCS( + MAIN main.py +) + NO_LINT() -END() +END() diff --git a/contrib/python/cffi/gen/main.py b/contrib/python/cffi/gen/main.py index 106293d3c5..39636d187c 100644 --- a/contrib/python/cffi/gen/main.py +++ b/contrib/python/cffi/gen/main.py @@ -1,37 +1,37 @@ -import os.path -import sys - -from cffi.setuptools_ext import execfile - -usage = '''Usage: {} INPUT:VAR OUTPUT -Generate CFFI C module source code. - -INPUT is a source .py file. -VAR is a cffi.FFI() object defined in the source file. -OUTPUT is a .c or .cpp output file. -''' - - -def main(): - if len(sys.argv) != 3 or ':' not in sys.argv[1]: - sys.stdout.write(usage.format(sys.argv[0])) - sys.exit(1) - - mod_spec, c_file = sys.argv[1:3] - build_file_name, ffi_var_name = mod_spec.rsplit(':', 1) - - source_dir = os.path.dirname(os.path.abspath(build_file_name)) - sys._MEIPASS = source_dir # For pygit2. - sys.dont_write_bytecode = True - sys.path = [source_dir] - mod_vars = {'__name__': '__cffi__', '__file__': build_file_name} - execfile(build_file_name, mod_vars) - - ffi = mod_vars[ffi_var_name] - if callable(ffi): - ffi = ffi() - ffi.emit_c_code(c_file) - - -if __name__ == '__main__': - main() +import os.path +import sys + +from cffi.setuptools_ext import execfile + +usage = '''Usage: {} INPUT:VAR OUTPUT +Generate CFFI C module source code. + +INPUT is a source .py file. +VAR is a cffi.FFI() object defined in the source file. +OUTPUT is a .c or .cpp output file. +''' + + +def main(): + if len(sys.argv) != 3 or ':' not in sys.argv[1]: + sys.stdout.write(usage.format(sys.argv[0])) + sys.exit(1) + + mod_spec, c_file = sys.argv[1:3] + build_file_name, ffi_var_name = mod_spec.rsplit(':', 1) + + source_dir = os.path.dirname(os.path.abspath(build_file_name)) + sys._MEIPASS = source_dir # For pygit2. + sys.dont_write_bytecode = True + sys.path = [source_dir] + mod_vars = {'__name__': '__cffi__', '__file__': build_file_name} + execfile(build_file_name, mod_vars) + + ffi = mod_vars[ffi_var_name] + if callable(ffi): + ffi = ffi() + ffi.emit_c_code(c_file) + + +if __name__ == '__main__': + main() diff --git a/contrib/python/cffi/gen/ya.make b/contrib/python/cffi/gen/ya.make index 66f8030b9b..69abc89af0 100644 --- a/contrib/python/cffi/gen/ya.make +++ b/contrib/python/cffi/gen/ya.make @@ -1,17 +1,17 @@ PY3_PROGRAM(cffigen) - -OWNER(orivej) - -DISABLE(PYTHON_SQLITE3) - -PEERDIR( - contrib/python/cffi/gen/lib -) - + +OWNER(orivej) + +DISABLE(PYTHON_SQLITE3) + +PEERDIR( + contrib/python/cffi/gen/lib +) + INDUCED_DEPS(cpp ${ARCADIA_ROOT}/contrib/python/cffi/cffi/_cffi_include.h) - -END() - -RECURSE( - lib -) + +END() + +RECURSE( + lib +) |