aboutsummaryrefslogtreecommitdiffstats
path: root/build/scripts
diff options
context:
space:
mode:
authorsvidyuk <svidyuk@yandex-team.ru>2022-02-10 16:47:12 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:12 +0300
commite23df0602fedd83374b43b6137a296baa2aad3f6 (patch)
tree1facb78b6535ac70f17ba39ed606d949f932fcea /build/scripts
parent92661c40a019d4809586c8ce322075d197427346 (diff)
downloadydb-e23df0602fedd83374b43b6137a296baa2aad3f6.tar.gz
Restoring authorship annotation for <svidyuk@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'build/scripts')
-rw-r--r--build/scripts/autotar_gendirs.py140
-rw-r--r--build/scripts/build_java_codenav_index.py4
-rw-r--r--build/scripts/find_and_tar.py2
-rw-r--r--build/scripts/fix_java_command_file_cp.py2
-rw-r--r--build/scripts/fs_tools.py44
-rw-r--r--build/scripts/java_pack_to_file.py16
-rw-r--r--build/scripts/make_java_classpath_file.py24
-rw-r--r--build/scripts/make_java_srclists.py244
-rw-r--r--build/scripts/resolve_java_srcs.py24
-rw-r--r--build/scripts/writer.py44
10 files changed, 272 insertions, 272 deletions
diff --git a/build/scripts/autotar_gendirs.py b/build/scripts/autotar_gendirs.py
index a1228108aa..c9a25b363e 100644
--- a/build/scripts/autotar_gendirs.py
+++ b/build/scripts/autotar_gendirs.py
@@ -1,70 +1,70 @@
-from __future__ import print_function
-
-import os
-import sys
-import argparse
-import tarfile
-import subprocess
-
-
-def is_exe(fpath):
- return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
-
-
-def pack_dir(dir_path, dest_path):
- dir_path = os.path.abspath(dir_path)
- for tar_exe in ('/usr/bin/tar', '/bin/tar'):
- if is_exe(tar_exe):
- subprocess.check_call([tar_exe, '-cf', dest_path, '-C', os.path.dirname(dir_path), os.path.basename(dir_path)])
- break
- else:
- with tarfile.open(dest_path, 'w') as out:
- out.add(dir_path, arcname=os.path.basename(dir_path))
-
-
-def unpack_dir(tared_dir, dest_path):
- tared_dir = os.path.abspath(tared_dir)
- if not os.path.exists(dest_path):
- os.makedirs(dest_path)
- for tar_exe in ('/usr/bin/tar', '/bin/tar'):
- if is_exe(tar_exe):
- subprocess.check_call([tar_exe, '-xf', tared_dir, '-C', dest_path])
- break
- else:
- with tarfile.open(tared_dir, 'r') as tar_file:
- tar_file.extractall(dest_path)
-
-
-# Must only be used to pack directories in build root
-# Must silently accept empty list of dirs and do nothing in such case (workaround for ymake.core.conf limitations)
-def main(args):
- parser = argparse.ArgumentParser()
- parser.add_argument('--pack', action='store_true', default=False)
- parser.add_argument('--unpack', action='store_true', default=False)
- parser.add_argument('--ext')
- parser.add_argument('--outs', nargs='*', default=[])
- parser.add_argument('dirs', nargs='*')
- args = parser.parse_args(args)
-
- if args.pack:
- if len(args.dirs) != len(args.outs):
- print("Number and oder of dirs to pack must match to the number and order of outs", file=sys.stderr)
- return 1
- for dir, dest in zip(args.dirs, args.outs):
- pack_dir(dir, dest)
- elif args.unpack:
- for tared_dir in args.dirs:
- if not tared_dir.endswith(args.ext):
- print("Requested to unpack '{}' which do not have required extension '{}'".format(tared_dir, args.ext), file=sys.stderr)
- return 1
- dest = os.path.dirname(tared_dir)
- unpack_dir(tared_dir, dest)
- else:
- print("Neither --pack nor --unpack specified. Don't know what to do.", file=sys.stderr)
- return 1
-
- return 0
-
-
-if __name__ == '__main__':
- sys.exit(main(sys.argv[1:]))
+from __future__ import print_function
+
+import os
+import sys
+import argparse
+import tarfile
+import subprocess
+
+
+def is_exe(fpath):
+ return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
+
+
+def pack_dir(dir_path, dest_path):
+ dir_path = os.path.abspath(dir_path)
+ for tar_exe in ('/usr/bin/tar', '/bin/tar'):
+ if is_exe(tar_exe):
+ subprocess.check_call([tar_exe, '-cf', dest_path, '-C', os.path.dirname(dir_path), os.path.basename(dir_path)])
+ break
+ else:
+ with tarfile.open(dest_path, 'w') as out:
+ out.add(dir_path, arcname=os.path.basename(dir_path))
+
+
+def unpack_dir(tared_dir, dest_path):
+ tared_dir = os.path.abspath(tared_dir)
+ if not os.path.exists(dest_path):
+ os.makedirs(dest_path)
+ for tar_exe in ('/usr/bin/tar', '/bin/tar'):
+ if is_exe(tar_exe):
+ subprocess.check_call([tar_exe, '-xf', tared_dir, '-C', dest_path])
+ break
+ else:
+ with tarfile.open(tared_dir, 'r') as tar_file:
+ tar_file.extractall(dest_path)
+
+
+# Must only be used to pack directories in build root
+# Must silently accept empty list of dirs and do nothing in such case (workaround for ymake.core.conf limitations)
+def main(args):
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--pack', action='store_true', default=False)
+ parser.add_argument('--unpack', action='store_true', default=False)
+ parser.add_argument('--ext')
+ parser.add_argument('--outs', nargs='*', default=[])
+ parser.add_argument('dirs', nargs='*')
+ args = parser.parse_args(args)
+
+ if args.pack:
+ if len(args.dirs) != len(args.outs):
+ print("Number and oder of dirs to pack must match to the number and order of outs", file=sys.stderr)
+ return 1
+ for dir, dest in zip(args.dirs, args.outs):
+ pack_dir(dir, dest)
+ elif args.unpack:
+ for tared_dir in args.dirs:
+ if not tared_dir.endswith(args.ext):
+ print("Requested to unpack '{}' which do not have required extension '{}'".format(tared_dir, args.ext), file=sys.stderr)
+ return 1
+ dest = os.path.dirname(tared_dir)
+ unpack_dir(tared_dir, dest)
+ else:
+ print("Neither --pack nor --unpack specified. Don't know what to do.", file=sys.stderr)
+ return 1
+
+ return 0
+
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv[1:]))
diff --git a/build/scripts/build_java_codenav_index.py b/build/scripts/build_java_codenav_index.py
index d7ac4f3213..9775207ab0 100644
--- a/build/scripts/build_java_codenav_index.py
+++ b/build/scripts/build_java_codenav_index.py
@@ -22,7 +22,7 @@ def modify_sources_file(origin, target, source_roots_map):
def just_do_it(argv):
- corpus_name, build_root, arcadia_root, sources_file, javac_tail_cmd = argv[0], argv[1], argv[2], argv[3], argv[4:]
+ corpus_name, build_root, arcadia_root, sources_file, javac_tail_cmd = argv[0], argv[1], argv[2], argv[3], argv[4:]
fake_arcadia_root = os.path.join(build_root, FAKE_ARCADIA_ROOT)
fake_build_root = os.path.join(build_root, FAKE_BUILD_ROOT)
fake_source_roots = {
@@ -40,7 +40,7 @@ def just_do_it(argv):
os.symlink(arcadia_root, fake_arcadia_root)
os.symlink(build_root, fake_build_root)
try:
- subprocess.check_call(javac_tail_cmd, env=env)
+ subprocess.check_call(javac_tail_cmd, env=env)
finally:
os.unlink(fake_arcadia_root)
os.unlink(fake_build_root)
diff --git a/build/scripts/find_and_tar.py b/build/scripts/find_and_tar.py
index f251623c68..bc3478d4fd 100644
--- a/build/scripts/find_and_tar.py
+++ b/build/scripts/find_and_tar.py
@@ -12,7 +12,7 @@ def find_gcno(dirname, tail):
def main(args):
output = args[0]
- tail = args[1] if len(args) > 1 else ''
+ tail = args[1] if len(args) > 1 else ''
with tarfile.open(output, 'w:') as tf:
for f in find_gcno(os.getcwd(), tail):
tf.add(f)
diff --git a/build/scripts/fix_java_command_file_cp.py b/build/scripts/fix_java_command_file_cp.py
index fc87048c32..4ea41b518f 100644
--- a/build/scripts/fix_java_command_file_cp.py
+++ b/build/scripts/fix_java_command_file_cp.py
@@ -15,7 +15,7 @@ def fix_files(args):
with open(arg[1:]) as f:
fixed = [i.strip() for i in f]
if args.build_root:
- fixed = [os.path.join(args.build_root, i) for ln in fixed for i in ln.split(os.path.pathsep)]
+ fixed = [os.path.join(args.build_root, i) for ln in fixed for i in ln.split(os.path.pathsep)]
fixed = os.pathsep.join([i.strip() for i in fixed])
fixed_name = list(os.path.splitext(arg))
fixed_name[0] += '_fixed'
diff --git a/build/scripts/fs_tools.py b/build/scripts/fs_tools.py
index dec4c349c8..f58cce00b6 100644
--- a/build/scripts/fs_tools.py
+++ b/build/scripts/fs_tools.py
@@ -1,28 +1,28 @@
-from __future__ import print_function
-
+from __future__ import print_function
+
import os
import platform
import sys
import shutil
-import errno
+import errno
import process_command_files as pcf
-def link_or_copy(src, dst):
- try:
- if platform.system().lower() == 'windows':
- shutil.copy(src, dst)
- else:
- os.link(src, dst)
- except OSError as e:
- if e.errno == errno.EEXIST:
- print('link_or_copy: destination file already exists: {}'.format(dst), file=sys.stderr)
- if e.errno == errno.ENOENT:
- print('link_or_copy: source file doesn\'t exists: {}'.format(src), file=sys.stderr)
- raise
-
-
+def link_or_copy(src, dst):
+ try:
+ if platform.system().lower() == 'windows':
+ shutil.copy(src, dst)
+ else:
+ os.link(src, dst)
+ except OSError as e:
+ if e.errno == errno.EEXIST:
+ print('link_or_copy: destination file already exists: {}'.format(dst), file=sys.stderr)
+ if e.errno == errno.ENOENT:
+ print('link_or_copy: source file doesn\'t exists: {}'.format(src), file=sys.stderr)
+ raise
+
+
if __name__ == '__main__':
mode = sys.argv[1]
args = pcf.get_args(sys.argv[2:])
@@ -79,17 +79,17 @@ if __name__ == '__main__':
except OSError:
pass
elif mode == 'link_or_copy':
- link_or_copy(args[0], args[1])
- elif mode == 'link_or_copy_to_dir':
- assert len(args) > 1
+ link_or_copy(args[0], args[1])
+ elif mode == 'link_or_copy_to_dir':
+ assert len(args) > 1
start = 0
if args[0] == '--no-check':
if args == 2:
sys.exit()
start = 1
- dst = args[-1]
+ dst = args[-1]
for src in args[start:-1]:
- link_or_copy(src, os.path.join(dst, os.path.basename(src)))
+ link_or_copy(src, os.path.join(dst, os.path.basename(src)))
elif mode == 'cat':
with open(args[0], 'w') as dst:
for input_name in args[1:]:
diff --git a/build/scripts/java_pack_to_file.py b/build/scripts/java_pack_to_file.py
index 8d2aeb93fd..28273b8baf 100644
--- a/build/scripts/java_pack_to_file.py
+++ b/build/scripts/java_pack_to_file.py
@@ -20,16 +20,16 @@ def get_package_name(filename):
return ''
-def write_coverage_sources(output, srcroot, files):
- with open(output, 'w') as afile:
- for filename in files:
- pname = get_package_name(os.path.join(srcroot, filename))
- afile.write(os.path.join(pname, os.path.basename(filename)) + ':' + filename + '\n')
-
-
+def write_coverage_sources(output, srcroot, files):
+ with open(output, 'w') as afile:
+ for filename in files:
+ pname = get_package_name(os.path.join(srcroot, filename))
+ afile.write(os.path.join(pname, os.path.basename(filename)) + ':' + filename + '\n')
+
+
def main():
opts, files = parse_args()
- write_coverage_sources(opts.output, opts.source_root, files)
+ write_coverage_sources(opts.output, opts.source_root, files)
if __name__ == '__main__':
diff --git a/build/scripts/make_java_classpath_file.py b/build/scripts/make_java_classpath_file.py
index c70a7876d7..c958356988 100644
--- a/build/scripts/make_java_classpath_file.py
+++ b/build/scripts/make_java_classpath_file.py
@@ -1,9 +1,9 @@
import os
import sys
-import process_command_files as pcf
-
+import process_command_files as pcf
+
def make_cp_file(args):
source = args[0]
destination = args[1]
@@ -12,15 +12,15 @@ def make_cp_file(args):
with open(destination, 'w') as dst:
dst.write(os.pathsep.join(lines))
-def make_cp_file_from_args(args):
- destination = args[0]
- with open(destination, 'w') as dst:
- dst.write(os.pathsep.join(args[1:]))
-
+def make_cp_file_from_args(args):
+ destination = args[0]
+ with open(destination, 'w') as dst:
+ dst.write(os.pathsep.join(args[1:]))
+
if __name__ == '__main__':
- args = pcf.get_args(sys.argv[1:])
- if sys.argv[1] != '--from-args':
- make_cp_file(args)
- else:
- make_cp_file_from_args(args[1:])
+ args = pcf.get_args(sys.argv[1:])
+ if sys.argv[1] != '--from-args':
+ make_cp_file(args)
+ else:
+ make_cp_file_from_args(args[1:])
diff --git a/build/scripts/make_java_srclists.py b/build/scripts/make_java_srclists.py
index f1dc807f7d..619c9cf9dd 100644
--- a/build/scripts/make_java_srclists.py
+++ b/build/scripts/make_java_srclists.py
@@ -1,122 +1,122 @@
-import os
-import sys
-import argparse
-
-import process_command_files as pcf
-import java_pack_to_file as jcov
-
-
-def writelines(f, rng):
- f.writelines(item + '\n' for item in rng)
-
-
-def main():
- args = pcf.get_args(sys.argv[1:])
- parser = argparse.ArgumentParser()
- parser.add_argument('--moddir')
- parser.add_argument('--java')
- parser.add_argument('--groovy')
- parser.add_argument('--kotlin')
- parser.add_argument('--coverage')
- parser.add_argument('--source-root')
- args, remaining_args = parser.parse_known_args(args)
-
- java = []
- kotlin = []
- groovy = []
- coverage = []
-
- cur_resources_list_file = None
- cur_jsources_list_file = None
- cur_srcdir = None
- cur_resources = []
- cur_jsources = []
-
- FILE_ARG = 1
- RESOURCES_DIR_ARG = 2
- SRCDIR_ARG = 3
- JSOURCES_DIR_ARG = 4
-
- next_arg=FILE_ARG
-
- for src in remaining_args:
- if next_arg == RESOURCES_DIR_ARG:
- assert cur_resources_list_file is None
- cur_resources_list_file = src
- next_arg = FILE_ARG
- continue
- elif next_arg == JSOURCES_DIR_ARG:
- assert cur_jsources_list_file is None
- cur_jsources_list_file = src
- next_arg = FILE_ARG
- continue
- elif next_arg == SRCDIR_ARG:
- assert cur_srcdir is None
- cur_srcdir = src if os.path.isabs(src) else os.path.join(args.moddir, src)
- next_arg = FILE_ARG
- continue
-
- if src.endswith(".java"):
- java.append(src)
- kotlin.append(src)
- if args.coverage and args.source_root:
- rel = os.path.relpath(src, args.source_root)
- if not rel.startswith('..' + os.path.sep):
- coverage.append(rel)
- elif args.kotlin and src.endswith(".kt"):
- kotlin.append(src)
- elif args.groovy and src.endswith(".groovy"):
- groovy.append(src)
- else:
- if src == '--resources':
- if cur_resources_list_file is not None:
- with open(cur_resources_list_file, 'w') as f:
- writelines(f, cur_resources)
- cur_resources_list_file = None
- cur_srcdir = None
- cur_resources = []
- next_arg = RESOURCES_DIR_ARG
- continue
- if src == '--jsources':
- if cur_jsources_list_file is not None:
- with open(cur_jsources_list_file, 'w') as f:
- writelines(f, cur_jsources)
- cur_jsources_list_file = None
- cur_jsources = []
- next_arg = JSOURCES_DIR_ARG
- continue
- elif src == '--srcdir':
- next_arg = SRCDIR_ARG
- continue
- else:
- assert cur_srcdir is not None and cur_resources_list_file is not None
- cur_resources.append(os.path.relpath(src, cur_srcdir))
-
- if cur_jsources_list_file is not None:
- assert cur_srcdir is not None
- cur_jsources.append(os.path.relpath(src, cur_srcdir))
-
- if cur_resources_list_file is not None:
- with open(cur_resources_list_file, 'w') as f:
- writelines(f, cur_resources)
- if cur_jsources_list_file is not None:
- with open(cur_jsources_list_file, 'w') as f:
- writelines(f, cur_jsources)
-
- if args.java:
- with open(args.java, 'w') as f:
- writelines(f, java)
- if args.kotlin:
- with open(args.kotlin, 'w') as f:
- writelines(f, kotlin)
- if args.groovy:
- with open(args.groovy, 'w') as f:
- writelines(f, groovy)
- if args.coverage:
- jcov.write_coverage_sources(args.coverage, args.source_root, coverage)
-
- return 0
-
-
-if __name__ == '__main__':
- sys.exit(main()) \ No newline at end of file
+import os
+import sys
+import argparse
+
+import process_command_files as pcf
+import java_pack_to_file as jcov
+
+
+def writelines(f, rng):
+ f.writelines(item + '\n' for item in rng)
+
+
+def main():
+ args = pcf.get_args(sys.argv[1:])
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--moddir')
+ parser.add_argument('--java')
+ parser.add_argument('--groovy')
+ parser.add_argument('--kotlin')
+ parser.add_argument('--coverage')
+ parser.add_argument('--source-root')
+ args, remaining_args = parser.parse_known_args(args)
+
+ java = []
+ kotlin = []
+ groovy = []
+ coverage = []
+
+ cur_resources_list_file = None
+ cur_jsources_list_file = None
+ cur_srcdir = None
+ cur_resources = []
+ cur_jsources = []
+
+ FILE_ARG = 1
+ RESOURCES_DIR_ARG = 2
+ SRCDIR_ARG = 3
+ JSOURCES_DIR_ARG = 4
+
+ next_arg=FILE_ARG
+
+ for src in remaining_args:
+ if next_arg == RESOURCES_DIR_ARG:
+ assert cur_resources_list_file is None
+ cur_resources_list_file = src
+ next_arg = FILE_ARG
+ continue
+ elif next_arg == JSOURCES_DIR_ARG:
+ assert cur_jsources_list_file is None
+ cur_jsources_list_file = src
+ next_arg = FILE_ARG
+ continue
+ elif next_arg == SRCDIR_ARG:
+ assert cur_srcdir is None
+ cur_srcdir = src if os.path.isabs(src) else os.path.join(args.moddir, src)
+ next_arg = FILE_ARG
+ continue
+
+ if src.endswith(".java"):
+ java.append(src)
+ kotlin.append(src)
+ if args.coverage and args.source_root:
+ rel = os.path.relpath(src, args.source_root)
+ if not rel.startswith('..' + os.path.sep):
+ coverage.append(rel)
+ elif args.kotlin and src.endswith(".kt"):
+ kotlin.append(src)
+ elif args.groovy and src.endswith(".groovy"):
+ groovy.append(src)
+ else:
+ if src == '--resources':
+ if cur_resources_list_file is not None:
+ with open(cur_resources_list_file, 'w') as f:
+ writelines(f, cur_resources)
+ cur_resources_list_file = None
+ cur_srcdir = None
+ cur_resources = []
+ next_arg = RESOURCES_DIR_ARG
+ continue
+ if src == '--jsources':
+ if cur_jsources_list_file is not None:
+ with open(cur_jsources_list_file, 'w') as f:
+ writelines(f, cur_jsources)
+ cur_jsources_list_file = None
+ cur_jsources = []
+ next_arg = JSOURCES_DIR_ARG
+ continue
+ elif src == '--srcdir':
+ next_arg = SRCDIR_ARG
+ continue
+ else:
+ assert cur_srcdir is not None and cur_resources_list_file is not None
+ cur_resources.append(os.path.relpath(src, cur_srcdir))
+
+ if cur_jsources_list_file is not None:
+ assert cur_srcdir is not None
+ cur_jsources.append(os.path.relpath(src, cur_srcdir))
+
+ if cur_resources_list_file is not None:
+ with open(cur_resources_list_file, 'w') as f:
+ writelines(f, cur_resources)
+ if cur_jsources_list_file is not None:
+ with open(cur_jsources_list_file, 'w') as f:
+ writelines(f, cur_jsources)
+
+ if args.java:
+ with open(args.java, 'w') as f:
+ writelines(f, java)
+ if args.kotlin:
+ with open(args.kotlin, 'w') as f:
+ writelines(f, kotlin)
+ if args.groovy:
+ with open(args.groovy, 'w') as f:
+ writelines(f, groovy)
+ if args.coverage:
+ jcov.write_coverage_sources(args.coverage, args.source_root, coverage)
+
+ return 0
+
+
+if __name__ == '__main__':
+ sys.exit(main()) \ No newline at end of file
diff --git a/build/scripts/resolve_java_srcs.py b/build/scripts/resolve_java_srcs.py
index a2e6c20012..fe29700e32 100644
--- a/build/scripts/resolve_java_srcs.py
+++ b/build/scripts/resolve_java_srcs.py
@@ -65,11 +65,11 @@ def resolve_java_srcs(srcdir, include_patterns, exclude_patterns, all_resources,
if all_resources or not (f.endswith('.java') or f.endswith('.kt') or f.endswith('.groovy')):
result['not_java'].append(s)
elif f.endswith('.java'):
- result['java'].append(os.path.join(srcdir, s))
+ result['java'].append(os.path.join(srcdir, s))
elif f.endswith('.kt') and resolve_kotlin:
- result['kotlin'].append(os.path.join(srcdir, s))
+ result['kotlin'].append(os.path.join(srcdir, s))
elif f.endswith('.groovy') and resolve_groovy:
- result['groovy'].append(os.path.join(srcdir, s))
+ result['groovy'].append(os.path.join(srcdir, s))
else:
result['not_java'].append(s)
break
@@ -77,15 +77,15 @@ def resolve_java_srcs(srcdir, include_patterns, exclude_patterns, all_resources,
return sorted(result['java']), sorted(result['not_java']), sorted(result['kotlin']), sorted(result['groovy'])
-def do_it(directory, sources_file, resources_file, kotlin_sources_file, groovy_sources_file, include_patterns, exclude_patterns, resolve_kotlin, resolve_groovy, append, all_resources):
- j, r, k, g = resolve_java_srcs(directory, include_patterns, exclude_patterns, all_resources, resolve_kotlin, resolve_groovy)
- mode = 'a' if append else 'w'
- open(sources_file, mode).writelines(i + '\n' for i in j)
- open(resources_file, mode).writelines(i + '\n' for i in r)
+def do_it(directory, sources_file, resources_file, kotlin_sources_file, groovy_sources_file, include_patterns, exclude_patterns, resolve_kotlin, resolve_groovy, append, all_resources):
+ j, r, k, g = resolve_java_srcs(directory, include_patterns, exclude_patterns, all_resources, resolve_kotlin, resolve_groovy)
+ mode = 'a' if append else 'w'
+ open(sources_file, mode).writelines(i + '\n' for i in j)
+ open(resources_file, mode).writelines(i + '\n' for i in r)
if kotlin_sources_file:
- open(kotlin_sources_file, mode).writelines(i + '\n' for i in k + j)
+ open(kotlin_sources_file, mode).writelines(i + '\n' for i in k + j)
if groovy_sources_file:
- open(groovy_sources_file, mode).writelines(i + '\n' for i in g + j)
+ open(groovy_sources_file, mode).writelines(i + '\n' for i in g + j)
if __name__ == '__main__':
@@ -95,8 +95,8 @@ if __name__ == '__main__':
parser.add_argument('-r', '--resources-file', required=True)
parser.add_argument('-k', '--kotlin-sources-file', default=None)
parser.add_argument('-g', '--groovy-sources-file', default=None)
- parser.add_argument('--append', action='store_true', default=False)
- parser.add_argument('--all-resources', action='store_true', default=False)
+ parser.add_argument('--append', action='store_true', default=False)
+ parser.add_argument('--all-resources', action='store_true', default=False)
parser.add_argument('--resolve-kotlin', action='store_true', default=False)
parser.add_argument('--resolve-groovy', action='store_true', default=False)
parser.add_argument('--include-patterns', nargs='*', default=[])
diff --git a/build/scripts/writer.py b/build/scripts/writer.py
index 21bb3006e5..6c7e4f0e4e 100644
--- a/build/scripts/writer.py
+++ b/build/scripts/writer.py
@@ -1,20 +1,20 @@
-import sys
-import argparse
-
-import process_command_files as pcf
+import sys
+import argparse
+import process_command_files as pcf
+
def parse_args():
- args = pcf.get_args(sys.argv[1:])
- parser = argparse.ArgumentParser()
- parser.add_argument('-f', '--file', dest='file_path')
- parser.add_argument('-a', '--append', action='store_true', default=False)
- parser.add_argument('-Q', '--quote', action='store_true', default=False)
- parser.add_argument('-s', '--addspace', action='store_true', default=False)
- parser.add_argument('-c', '--content', action='append', dest='content')
- parser.add_argument('-m', '--content-multiple', nargs='*', dest='content')
- parser.add_argument('-P', '--path-list', action='store_true', default=False)
- return parser.parse_args(args)
+ args = pcf.get_args(sys.argv[1:])
+ parser = argparse.ArgumentParser()
+ parser.add_argument('-f', '--file', dest='file_path')
+ parser.add_argument('-a', '--append', action='store_true', default=False)
+ parser.add_argument('-Q', '--quote', action='store_true', default=False)
+ parser.add_argument('-s', '--addspace', action='store_true', default=False)
+ parser.add_argument('-c', '--content', action='append', dest='content')
+ parser.add_argument('-m', '--content-multiple', nargs='*', dest='content')
+ parser.add_argument('-P', '--path-list', action='store_true', default=False)
+ return parser.parse_args(args)
def smart_shell_quote(v):
@@ -25,16 +25,16 @@ def smart_shell_quote(v):
return v
if __name__ == '__main__':
- args = parse_args()
- open_type = 'a' if args.append else 'w'
+ args = parse_args()
+ open_type = 'a' if args.append else 'w'
- content = args.content
- if args.quote:
- content = [smart_shell_quote(ln) for ln in content] if content is not None else None
- content = '\n'.join(content)
+ content = args.content
+ if args.quote:
+ content = [smart_shell_quote(ln) for ln in content] if content is not None else None
+ content = '\n'.join(content)
- with open(args.file_path, open_type) as f:
- if args.addspace:
+ with open(args.file_path, open_type) as f:
+ if args.addspace:
f.write(' ')
if content is not None:
f.write(content)