diff options
| author | alexv-smirnov <[email protected]> | 2023-03-28 22:25:04 +0300 |
|---|---|---|
| committer | alexv-smirnov <[email protected]> | 2023-03-28 22:25:04 +0300 |
| commit | b8a17f9b1c166d2e9a26b99348a4c29d972caf55 (patch) | |
| tree | 1a2d881f1a9452b9c6103dbf69d73da7624e98e5 /build/scripts/jni_swig.py | |
| parent | 25659221f18577ea38430a8ec3349836f5626b6a (diff) | |
Revert ymake build from ydb oss export
Diffstat (limited to 'build/scripts/jni_swig.py')
| -rw-r--r-- | build/scripts/jni_swig.py | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/build/scripts/jni_swig.py b/build/scripts/jni_swig.py deleted file mode 100644 index 4b2220430b1..00000000000 --- a/build/scripts/jni_swig.py +++ /dev/null @@ -1,46 +0,0 @@ -import argparse -import subprocess -import re -import os -import tarfile - -def parse_args(): - parser = argparse.ArgumentParser(description='Wrapper script to invoke swig.') - parser.add_argument('--swig', help='path to the swig executable') - parser.add_argument('--default-module', type=str, help='swig -module argument value for inputs without %module statement') - parser.add_argument('--package-by-file', help='path to file which dir must be converted to swig -package argument') - parser.add_argument('--jsrc', help='jsrc output archive filename') - parser.add_argument('--src', help='input .swg file path') - parser.add_argument('--out-header', help='header file which must exist even if it was not generated by swig') - parser.add_argument('args', nargs="*", help='regular swig arguments') - - return parser.parse_args() - - -def path2pkg(path): - return path.replace('/', '.').replace('-', '_') - - -def main(args): - package = path2pkg(os.path.dirname(args.package_by_file)) - outdir = None - if args.jsrc: - outdir = package.replace('.', '/') - outdir_abs = os.path.join(os.path.dirname(args.jsrc), outdir) - if not os.path.exists(outdir_abs): - os.makedirs(outdir_abs) - cmd = [args.swig, '-c++', '-java', '-package', package] + (['-outdir', outdir_abs] if outdir is not None else []) + args.args - if '-module' not in args.args and args.default_module: - with open(args.src, 'r') as f: - if not re.search(r'(?m)^%module\b', f.read()): - cmd += ['-module', args.default_module] - subprocess.check_call(cmd + [args.src]) - if args.out_header and not os.path.exists(args.out_header): - open(args.out_header, 'w').close() - if args.jsrc: - with tarfile.open(args.jsrc, 'a') as tf: - tf.add(outdir_abs, arcname=outdir) - - -if __name__ == '__main__': - main(parse_args()) |
