aboutsummaryrefslogtreecommitdiffstats
path: root/build/scripts/process_command_files.py
diff options
context:
space:
mode:
authorDevtools Arcadia <arcadia-devtools@yandex-team.ru>2022-02-07 18:08:42 +0300
committerDevtools Arcadia <arcadia-devtools@mous.vla.yp-c.yandex.net>2022-02-07 18:08:42 +0300
commit1110808a9d39d4b808aef724c861a2e1a38d2a69 (patch)
treee26c9fed0de5d9873cce7e00bc214573dc2195b7 /build/scripts/process_command_files.py
downloadydb-1110808a9d39d4b808aef724c861a2e1a38d2a69.tar.gz
intermediate changes
ref:cde9a383711a11544ce7e107a78147fb96cc4029
Diffstat (limited to 'build/scripts/process_command_files.py')
-rw-r--r--build/scripts/process_command_files.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/build/scripts/process_command_files.py b/build/scripts/process_command_files.py
new file mode 100644
index 0000000000..e24bdf3e2b
--- /dev/null
+++ b/build/scripts/process_command_files.py
@@ -0,0 +1,33 @@
+import sys
+
+
+def is_cmdfile_arg(arg):
+ return arg.startswith('@')
+
+def cmdfile_path(arg):
+ return arg[1:]
+
+def read_from_command_file(arg):
+ with open(arg) as afile:
+ return afile.read().splitlines()
+
+def skip_markers(args):
+ res = []
+ for arg in args:
+ if arg == '--ya-start-command-file' or arg == '--ya-end-command-file':
+ continue
+ res.append(arg)
+ return res
+
+def iter_args(args):
+ for arg in args:
+ if not is_cmdfile_arg(arg):
+ if arg == '--ya-start-command-file' or arg == '--ya-end-command-file':
+ continue
+ yield arg
+ else:
+ for cmdfile_arg in read_from_command_file(cmdfile_path(arg)):
+ yield cmdfile_arg
+
+def get_args(args):
+ return list(iter_args(args))