diff options
| author | snermolaev <[email protected]> | 2025-10-21 05:05:02 +0300 |
|---|---|---|
| committer | snermolaev <[email protected]> | 2025-10-21 05:25:56 +0300 |
| commit | baa2a43cd81c7f40d70c4c56e36c1690eadea4de (patch) | |
| tree | 3cfbfa424dc891018554cd58643ed11598afed69 /build/scripts | |
| parent | 1138a2be17ffd323e177f9ceef97dd46879e6608 (diff) | |
BUNDLE_OUTPUT macro for additional modules outputs
commit_hash:917e243f0ac57950881b0a52d975499ca0ed323f
Diffstat (limited to 'build/scripts')
| -rw-r--r-- | build/scripts/bundle_output.py | 44 | ||||
| -rw-r--r-- | build/scripts/ya.make | 1 |
2 files changed, 45 insertions, 0 deletions
diff --git a/build/scripts/bundle_output.py b/build/scripts/bundle_output.py new file mode 100644 index 00000000000..8b99eaa21fe --- /dev/null +++ b/build/scripts/bundle_output.py @@ -0,0 +1,44 @@ +import argparse +import os +import shutil +import sys + + +def parse_args(): + parser = argparse.ArgumentParser() + parser.add_argument('--name', required=True) + parser.add_argument('--output', required=True) + parser.add_argument('--result', required=True) + return parser.parse_args(sys.argv[1:]) + + +def main(): + args = parse_args() + if os.path.basename(args.name) != args.name: + print("Error: --name must be a base name without directory components", file=sys.stderr, flush=True) + sys.exit(1) + result_dir = os.path.dirname(args.result) + src_path = os.path.join(result_dir, args.name) + + if not os.path.exists(src_path): + print(f"Error: Source file '{src_path}' does not exist", file=sys.stderr, flush=True) + sys.exit(1) + if not os.path.isfile(src_path): + print(f"Error: Source path '{src_path}' is not a file", file=sys.stderr, flush=True) + sys.exit(1) + if os.path.isdir(args.output): + print(f"Error: Output path '{args.output}' is a directory", file=sys.stderr, flush=True) + sys.exit(1) + output_dir = os.path.dirname(args.output) + if output_dir: + os.makedirs(output_dir, exist_ok=True) + + try: + shutil.move(src_path, args.output) + except Exception as e: + print(f"Error moving file: {str(e)}", file=sys.stderr, flush=True) + sys.exit(1) + + +if __name__ == '__main__': + main() diff --git a/build/scripts/ya.make b/build/scripts/ya.make index 9236ed569ad..f5623debda1 100644 --- a/build/scripts/ya.make +++ b/build/scripts/ya.make @@ -43,6 +43,7 @@ ELSEIF (PYTHON3) build_info_gen.py build_java_codenav_index.py build_java_with_error_prone2.py + bundle_output.py cat.py cgo1_wrapper.py check_config_h.py |
