diff options
author | thegeorg <thegeorg@yandex-team.com> | 2022-08-19 15:00:44 +0300 |
---|---|---|
committer | thegeorg <thegeorg@yandex-team.com> | 2022-08-19 15:00:44 +0300 |
commit | ad2a1b622d2bf6cf025982846153d9c4c791af2c (patch) | |
tree | 8906addc18a494ece9dff28b2701a37ef4b52bf8 /build/scripts/cgo1_wrapper.py | |
parent | 7b61b052f3baa7e43edca48c373f95b5e5f1c845 (diff) | |
download | ydb-ad2a1b622d2bf6cf025982846153d9c4c791af2c.tar.gz |
Let cmake export determine which build/scripts are mandatory
Diffstat (limited to 'build/scripts/cgo1_wrapper.py')
-rw-r--r-- | build/scripts/cgo1_wrapper.py | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/build/scripts/cgo1_wrapper.py b/build/scripts/cgo1_wrapper.py deleted file mode 100644 index 986082f7e9..0000000000 --- a/build/scripts/cgo1_wrapper.py +++ /dev/null @@ -1,45 +0,0 @@ -import argparse -import shutil -import subprocess -import sys - - -CGO1_SUFFIX='.cgo1.go' - - -def call(cmd, cwd, env=None): - # sys.stderr.write('{}\n'.format(' '.join(cmd))) - return subprocess.call(cmd, stdin=None, stderr=sys.stderr, stdout=sys.stdout, cwd=cwd, env=env) - - -def process_file(source_root, source_prefix, build_root, build_prefix, src_path, comment_prefix): - dst_path = '{}.tmp'.format(src_path) - with open(src_path, 'r') as src_file, open(dst_path, 'w') as dst_file: - for line in src_file: - if line.startswith(comment_prefix): - dst_file.write(line.replace(source_root, source_prefix).replace(build_root, build_prefix)) - else: - dst_file.write(line) - shutil.move(dst_path, src_path) - - -if __name__ == '__main__': - parser = argparse.ArgumentParser() - parser.add_argument('--build-prefix', default='__ARCADIA_BUILD_ROOT_PREFIX__') - parser.add_argument('--build-root', required=True) - parser.add_argument('--cgo1-files', nargs='+', required=True) - parser.add_argument('--cgo2-files', nargs='+', required=True) - parser.add_argument('--source-prefix', default='__ARCADIA_SOURCE_ROOT_PREFIX__') - parser.add_argument('--source-root', required=True) - parser.add_argument('cgo1_cmd', nargs='*') - args = parser.parse_args() - - exit_code = call(args.cgo1_cmd, args.source_root) - if exit_code != 0: - sys.exit(exit_code) - - for src_path in args.cgo1_files: - process_file(args.source_root, args.source_prefix, args.build_root, args.build_prefix, src_path, '//') - - for src_path in args.cgo2_files: - process_file(args.source_root, args.source_prefix, args.build_root, args.build_prefix, src_path, '#line') |