diff options
author | Dmitry Kopylov <kopylovd@gmail.com> | 2022-02-10 16:48:18 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:48:18 +0300 |
commit | b2f5101486cc0de2e979c8ba9ada2109785bf5fd (patch) | |
tree | affe28b840816b505db0467f2285b01c89c04247 /build/scripts | |
parent | e9b28b5aad71453a4637b70dde02e801e4147a2a (diff) | |
download | ydb-b2f5101486cc0de2e979c8ba9ada2109785bf5fd.tar.gz |
Restoring authorship annotation for Dmitry Kopylov <kopylovd@gmail.com>. Commit 1 of 2.
Diffstat (limited to 'build/scripts')
-rw-r--r-- | build/scripts/append_file.py | 14 | ||||
-rwxr-xr-x | build/scripts/build_mn.py | 2 | ||||
-rwxr-xr-x | build/scripts/build_pln_header.py | 2 | ||||
-rwxr-xr-x | build/scripts/cat.py | 18 | ||||
-rw-r--r-- | build/scripts/check_config_h.py | 8 | ||||
-rw-r--r-- | build/scripts/compile_cuda.py | 18 | ||||
-rw-r--r-- | build/scripts/coverage-info.py | 52 | ||||
-rw-r--r-- | build/scripts/f2c.py | 30 | ||||
-rwxr-xr-x | build/scripts/fetch_from_sandbox.py | 10 | ||||
-rw-r--r-- | build/scripts/fs_tools.py | 62 | ||||
-rw-r--r-- | build/scripts/gen_mx_table.py | 32 | ||||
-rw-r--r-- | build/scripts/gen_py_reg.py | 20 | ||||
-rw-r--r-- | build/scripts/link_fat_obj.py | 16 | ||||
-rwxr-xr-x | build/scripts/mkver.py | 16 | ||||
-rw-r--r-- | build/scripts/perl_wrapper.py | 30 | ||||
-rw-r--r-- | build/scripts/preprocess.py | 4 | ||||
-rw-r--r-- | build/scripts/resolve_java_srcs.py | 20 | ||||
-rw-r--r-- | build/scripts/run_llvm_dsymutil.py | 10 | ||||
-rwxr-xr-x | build/scripts/run_tool.py | 10 | ||||
-rw-r--r-- | build/scripts/wrapper.py | 10 | ||||
-rw-r--r-- | build/scripts/xargs.py | 20 | ||||
-rw-r--r-- | build/scripts/ya.make | 84 | ||||
-rw-r--r-- | build/scripts/yield_line.py | 8 |
23 files changed, 248 insertions, 248 deletions
diff --git a/build/scripts/append_file.py b/build/scripts/append_file.py index 6b5d53bc71..0b594a53e8 100644 --- a/build/scripts/append_file.py +++ b/build/scripts/append_file.py @@ -1,9 +1,9 @@ -import sys - - -if __name__ == "__main__": - - file_path = sys.argv[1] - with open(file_path, "a") as f: +import sys + + +if __name__ == "__main__": + + file_path = sys.argv[1] + with open(file_path, "a") as f: for text in sys.argv[2:]: print >>f, text diff --git a/build/scripts/build_mn.py b/build/scripts/build_mn.py index 5bb03c247c..f3ede12de7 100755 --- a/build/scripts/build_mn.py +++ b/build/scripts/build_mn.py @@ -321,7 +321,7 @@ def BuildMnF(argv): if __name__ == '__main__': if len(sys.argv) < 2: - print >>sys.stderr, "Usage: build_mn.py <funcName> <args...>" + print >>sys.stderr, "Usage: build_mn.py <funcName> <args...>" sys.exit(1) if (sys.argv[2:]): diff --git a/build/scripts/build_pln_header.py b/build/scripts/build_pln_header.py index c73693f444..0d09907f9b 100755 --- a/build/scripts/build_pln_header.py +++ b/build/scripts/build_pln_header.py @@ -6,7 +6,7 @@ import os def BuildPlnHeader(): if len(sys.argv) < 2: - print >>sys.stderr, "Usage: build_pln_header.py <absolute/path/to/OutFile>" + print >>sys.stderr, "Usage: build_pln_header.py <absolute/path/to/OutFile>" sys.exit(1) print >>sys.stdout, "Build Pln Header..." diff --git a/build/scripts/cat.py b/build/scripts/cat.py index 0c3f73d96f..6153dd2a8a 100755 --- a/build/scripts/cat.py +++ b/build/scripts/cat.py @@ -3,13 +3,13 @@ import sys from shutil import copyfileobj as copy import os.path -if __name__ == '__main__': - for filename in sys.argv[1:] or ["-"]: - if filename == "-": - copy(sys.stdin, sys.stdout) +if __name__ == '__main__': + for filename in sys.argv[1:] or ["-"]: + if filename == "-": + copy(sys.stdin, sys.stdout) else: - if os.path.exists(filename): - with open(filename, 'rb') as file: - copy(file, sys.stdout) - else: - sys.stderr.write('cat.py: {0}: No such file or directory\n'.format(filename)) + if os.path.exists(filename): + with open(filename, 'rb') as file: + copy(file, sys.stdout) + else: + sys.stderr.write('cat.py: {0}: No such file or directory\n'.format(filename)) diff --git a/build/scripts/check_config_h.py b/build/scripts/check_config_h.py index 07bc12e230..0fe56908df 100644 --- a/build/scripts/check_config_h.py +++ b/build/scripts/check_config_h.py @@ -83,7 +83,7 @@ static_assert(sizeof(wchar_t) == SIZEOF_WCHAR_T, "fixme 16"); //TODO #endif """ -if __name__ == '__main__': - with open(sys.argv[2], 'w') as f: - f.write('#include <' + sys.argv[1] + '>\n\n') - f.write(data) +if __name__ == '__main__': + with open(sys.argv[2], 'w') as f: + f.write('#include <' + sys.argv[1] + '>\n\n') + f.write(data) diff --git a/build/scripts/compile_cuda.py b/build/scripts/compile_cuda.py index c0bec50b2a..7e98e5bc19 100644 --- a/build/scripts/compile_cuda.py +++ b/build/scripts/compile_cuda.py @@ -21,29 +21,29 @@ def main(): except ValueError: skip_nocxxinc = False - spl = sys.argv.index('--cflags') + spl = sys.argv.index('--cflags') mtime0 = sys.argv[1] command = sys.argv[2: spl] - cflags = sys.argv[spl + 1:] + cflags = sys.argv[spl + 1:] dump_args = False if '--y_dump_args' in command: command.remove('--y_dump_args') dump_args = True - executable = command[0] - if not os.path.exists(executable): - print >> sys.stderr, '{} not found'.format(executable) - sys.exit(1) + executable = command[0] + if not os.path.exists(executable): + print >> sys.stderr, '{} not found'.format(executable) + sys.exit(1) if is_clang(command): # nvcc concatenates the sources for clang, and clang reports unused # things from .h files as if they they were defined in a .cpp file. cflags += ['-Wno-unused-function', '-Wno-unused-parameter'] - if not is_clang(command) and '-fopenmp=libomp' in cflags: - cflags.append('-fopenmp') - cflags.remove('-fopenmp=libomp') + if not is_clang(command) and '-fopenmp=libomp' in cflags: + cflags.append('-fopenmp') + cflags.remove('-fopenmp=libomp') skip_list = [ '-gline-tables-only', diff --git a/build/scripts/coverage-info.py b/build/scripts/coverage-info.py index 94491d9256..c64c3efd48 100644 --- a/build/scripts/coverage-info.py +++ b/build/scripts/coverage-info.py @@ -96,26 +96,26 @@ def chunks(l, n): yield l[i:i + n] -def combine_info_files(lcov, files, out_file): - chunk_size = 50 - files = list(set(files)) - - for chunk in chunks(files, chunk_size): - combine_cmd = [lcov] - if os.path.exists(out_file): - chunk.append(out_file) - for trace in chunk: - assert os.path.exists(trace), "Trace file does not exist: {} (cwd={})".format(trace, os.getcwd()) - combine_cmd += ["-a", os.path.abspath(trace)] - print >>sys.stderr, '## lcov', ' '.join(combine_cmd[1:]) - out_file_tmp = "combined.tmp" - with open(out_file_tmp, "w") as stdout: - subprocess.check_call(combine_cmd, stdout=stdout) - if os.path.exists(out_file): - os.remove(out_file) - os.rename(out_file_tmp, out_file) - - +def combine_info_files(lcov, files, out_file): + chunk_size = 50 + files = list(set(files)) + + for chunk in chunks(files, chunk_size): + combine_cmd = [lcov] + if os.path.exists(out_file): + chunk.append(out_file) + for trace in chunk: + assert os.path.exists(trace), "Trace file does not exist: {} (cwd={})".format(trace, os.getcwd()) + combine_cmd += ["-a", os.path.abspath(trace)] + print >>sys.stderr, '## lcov', ' '.join(combine_cmd[1:]) + out_file_tmp = "combined.tmp" + with open(out_file_tmp, "w") as stdout: + subprocess.check_call(combine_cmd, stdout=stdout) + if os.path.exists(out_file): + os.remove(out_file) + os.rename(out_file_tmp, out_file) + + def probe_path_global(path, source_root, prefix_filter, exclude_files): if path.endswith('_ut.cpp'): return None @@ -186,7 +186,7 @@ def process_all_coverage_files(gcda_archive, fname2gcno, fname2info, geninfo_exe source_fname = gcda_name[:-len(GCDA_EXT)] for suff in suffixes(source_fname): if suff in fname2gcno: - gcda_new_name = suff + GCDA_EXT + gcda_new_name = suff + GCDA_EXT gcda_item.name = gcda_new_name gcda_tf.extract(gcda_item) if os.path.getsize(gcda_new_name) > 0: @@ -196,9 +196,9 @@ def process_all_coverage_files(gcda_archive, fname2gcno, fname2info, geninfo_exe geninfo_executable, '--gcov-tool', gcov_tool, gcda_new_name, - '-o', coverage_info + '.tmp' + '-o', coverage_info + '.tmp' ] - gen_info(geninfo_cmd, coverage_info) + gen_info(geninfo_cmd, coverage_info) def gen_cobertura(tool, output, combined_info): @@ -251,9 +251,9 @@ def main(source_root, output, gcno_archive, gcda_archive, gcov_tool, prefix_filt print_stat(da, fnda, teamcity_stat_file) if lcov_args: - output_trace = "combined.info" - combine_info_files(os.path.join(source_root, 'devtools', 'lcov', 'lcov'), lcov_args, output_trace) - cmd = [os.path.join(source_root, 'devtools', 'lcov', 'genhtml'), '-p', source_root, '--ignore-errors', 'source', '-o', output_dir, output_trace] + output_trace = "combined.info" + combine_info_files(os.path.join(source_root, 'devtools', 'lcov', 'lcov'), lcov_args, output_trace) + cmd = [os.path.join(source_root, 'devtools', 'lcov', 'genhtml'), '-p', source_root, '--ignore-errors', 'source', '-o', output_dir, output_trace] print >>sys.stderr, '## genhtml', ' '.join(cmd) subprocess.check_call(cmd) if lcov_cobertura: diff --git a/build/scripts/f2c.py b/build/scripts/f2c.py index 7021e1391f..2668bd1a37 100644 --- a/build/scripts/f2c.py +++ b/build/scripts/f2c.py @@ -28,31 +28,31 @@ def mkdir_p(directory): os.makedirs(directory) -if __name__ == '__main__': - parser = argparse.ArgumentParser() +if __name__ == '__main__': + parser = argparse.ArgumentParser() - parser.add_argument('-t', '--tool') - parser.add_argument('-c', '--input') - parser.add_argument('-o', '--output') + parser.add_argument('-t', '--tool') + parser.add_argument('-c', '--input') + parser.add_argument('-o', '--output') - args = parser.parse_args() + args = parser.parse_args() tmpdir = args.output + '.f2c' mkdir_p(tmpdir) - # should parse includes, really + # should parse includes, really p = subprocess.Popen( [args.tool, '-w', '-R', '-a', '-I' + os.path.dirname(args.input), '-T' + tmpdir], stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE) - stdout, stderr = p.communicate(input=open(args.input).read()) - ret = p.wait() + stdout, stderr = p.communicate(input=open(args.input).read()) + ret = p.wait() - if ret: - print >>sys.stderr, 'f2c failed: %s, %s' % (stderr, ret) - sys.exit(ret) + if ret: + print >>sys.stderr, 'f2c failed: %s, %s' % (stderr, ret) + sys.exit(ret) - if 'Error' in stderr: + if 'Error' in stderr: print >>sys.stderr, stderr - with open(args.output, 'w') as f: + with open(args.output, 'w') as f: f.write(header) - f.write(stdout) + f.write(stdout) f.write(footer) diff --git a/build/scripts/fetch_from_sandbox.py b/build/scripts/fetch_from_sandbox.py index a99542e174..a9beb5ba41 100755 --- a/build/scripts/fetch_from_sandbox.py +++ b/build/scripts/fetch_from_sandbox.py @@ -121,13 +121,13 @@ def get_resource_info(resource_id, touch=False, no_links=False): if no_links: headers.update({'X-No-Links': '1'}) return _query(url) - - -def get_resource_http_links(resource_id): + + +def get_resource_http_links(resource_id): url = ''.join((_SANDBOX_BASE_URL, '/resource/', str(resource_id), '/data/http')) return [r['url'] + ORIGIN_SUFFIX for r in _query(url)] - - + + def fetch_via_script(script, resource_id): return subprocess.check_output([script, str(resource_id)]).rstrip() diff --git a/build/scripts/fs_tools.py b/build/scripts/fs_tools.py index dec4c349c8..979aa72f0c 100644 --- a/build/scripts/fs_tools.py +++ b/build/scripts/fs_tools.py @@ -23,28 +23,28 @@ def link_or_copy(src, dst): raise -if __name__ == '__main__': - mode = sys.argv[1] +if __name__ == '__main__': + mode = sys.argv[1] args = pcf.get_args(sys.argv[2:]) - if mode == 'copy': + if mode == 'copy': shutil.copy(args[0], args[1]) elif mode == 'copy_tree_no_link': dst = args[1] shutil.copytree(args[0], dst, ignore=lambda dirname, names: [n for n in names if os.path.islink(os.path.join(dirname, n))]) - elif mode == 'copy_files': - src = args[0] - dst = args[1] - files = open(args[2]).read().strip().split() - for f in files: - s = os.path.join(src, f) - d = os.path.join(dst, f) - if os.path.exists(d): - continue - try: - os.makedirs(os.path.dirname(d)) - except OSError: - pass + elif mode == 'copy_files': + src = args[0] + dst = args[1] + files = open(args[2]).read().strip().split() + for f in files: + s = os.path.join(src, f) + d = os.path.join(dst, f) + if os.path.exists(d): + continue + try: + os.makedirs(os.path.dirname(d)) + except OSError: + pass shutil.copy(s, d) elif mode == 'copy_all_files': src = args[0] @@ -61,23 +61,23 @@ if __name__ == '__main__': except OSError: pass shutil.copy(os.path.join(root, f), file_dst) - elif mode == 'rename_if_exists': - if os.path.exists(args[0]): - shutil.move(args[0], args[1]) - elif mode == 'rename': + elif mode == 'rename_if_exists': + if os.path.exists(args[0]): + shutil.move(args[0], args[1]) + elif mode == 'rename': targetdir = os.path.dirname(args[1]) if targetdir and not os.path.exists(targetdir): os.makedirs(os.path.dirname(args[1])) shutil.move(args[0], args[1]) - elif mode == 'remove': - for f in args: - try: - if os.path.isfile(f) or os.path.islink(f): - os.remove(f) - else: - shutil.rmtree(f) - except OSError: - pass + elif mode == 'remove': + for f in args: + try: + if os.path.isfile(f) or os.path.islink(f): + os.remove(f) + else: + shutil.rmtree(f) + except OSError: + pass elif mode == 'link_or_copy': link_or_copy(args[0], args[1]) elif mode == 'link_or_copy_to_dir': @@ -100,5 +100,5 @@ if __name__ == '__main__': os.makedirs(args[0]) except OSError: pass - else: - raise Exception('unsupported tool %s' % mode) + else: + raise Exception('unsupported tool %s' % mode) diff --git a/build/scripts/gen_mx_table.py b/build/scripts/gen_mx_table.py index 187c21c539..45f392a3e5 100644 --- a/build/scripts/gen_mx_table.py +++ b/build/scripts/gen_mx_table.py @@ -50,26 +50,26 @@ namespace { yabs_mx_calc_table_t yabs_mx_calc_table = {YABS_MX_CALC_VERSION, 10000, 0, yabs_funcs}; """ -if __name__ == '__main__': - init = [] - body = [] - defs = {} +if __name__ == '__main__': + init = [] + body = [] + defs = {} - for i in sys.argv[1:]: - name = i.replace('.', '_') - num = long(name.split('_')[1]) + for i in sys.argv[1:]: + name = i.replace('.', '_') + num = long(name.split('_')[1]) - init.append('(*this)[%s] = new TFml(ar.ObjectBlobByKey("%s"));' % (num, '/' + i)) + init.append('(*this)[%s] = new TFml(ar.ObjectBlobByKey("%s"));' % (num, '/' + i)) - f1 = 'static void yabs_%s(size_t count, const float** args, double* res) {Singleton<TFormulas>()->at(%s).DoCalcRelevs(args, res, count);}' % (name, num) - f2 = 'static size_t yabs_%s_factor_count() {return Singleton<TFormulas>()->at(%s).MaxFactorIndex() + 1;}' % (name, num) + f1 = 'static void yabs_%s(size_t count, const float** args, double* res) {Singleton<TFormulas>()->at(%s).DoCalcRelevs(args, res, count);}' % (name, num) + f2 = 'static size_t yabs_%s_factor_count() {return Singleton<TFormulas>()->at(%s).MaxFactorIndex() + 1;}' % (name, num) - body.append(f1) - body.append(f2) + body.append(f1) + body.append(f2) - d1 = 'yabs_%s' % name - d2 = 'yabs_%s_factor_count' % name + d1 = 'yabs_%s' % name + d2 = 'yabs_%s_factor_count' % name - defs[num] = '{%s, %s}' % (d1, d2) + defs[num] = '{%s, %s}' % (d1, d2) - print tmpl % ('\n'.join(init), '\n\n'.join(body), ',\n'.join((defs.get(i, '{nullptr, nullptr}') for i in range(0, 10000)))) + print tmpl % ('\n'.join(init), '\n\n'.join(body), ',\n'.join((defs.get(i, '{nullptr, nullptr}') for i in range(0, 10000)))) diff --git a/build/scripts/gen_py_reg.py b/build/scripts/gen_py_reg.py index 1560135ae8..2c2495c14e 100644 --- a/build/scripts/gen_py_reg.py +++ b/build/scripts/gen_py_reg.py @@ -19,14 +19,14 @@ def mangle(name): return name return ''.join('{}{}'.format(len(s), s) for s in name.split('.')) -if __name__ == '__main__': - if len(sys.argv) != 3: - print >>sys.stderr, 'Usage: <path/to/gen_py_reg.py> <python_module_name> <output_file>' - print >>sys.stderr, 'Passed: ' + ' '.join(sys.argv) - sys.exit(1) +if __name__ == '__main__': + if len(sys.argv) != 3: + print >>sys.stderr, 'Usage: <path/to/gen_py_reg.py> <python_module_name> <output_file>' + print >>sys.stderr, 'Passed: ' + ' '.join(sys.argv) + sys.exit(1) - with open(sys.argv[2], 'w') as f: - modname = sys.argv[1] - initname = 'init' + mangle(modname) - code = template.replace('{0}', modname).replace('{1}', initname) - f.write(code) + with open(sys.argv[2], 'w') as f: + modname = sys.argv[1] + initname = 'init' + mangle(modname) + code = template.replace('{0}', modname).replace('{1}', initname) + f.write(code) diff --git a/build/scripts/link_fat_obj.py b/build/scripts/link_fat_obj.py index c189668b9e..9bf6254255 100644 --- a/build/scripts/link_fat_obj.py +++ b/build/scripts/link_fat_obj.py @@ -8,11 +8,11 @@ YA_ARG_PREFIX = '-Ya,' def get_args(): - parser = argparse.ArgumentParser() + parser = argparse.ArgumentParser() parser.add_argument('--obj') parser.add_argument('--globals-lib') - parser.add_argument('--lib', required=True) - parser.add_argument('--arch', required=True) + parser.add_argument('--lib', required=True) + parser.add_argument('--arch', required=True) parser.add_argument('--build-root', default=None) parser.add_argument('--with-own-obj', action='store_true', default=False) parser.add_argument('--with-global-srcs', action='store_true', default=False) @@ -46,8 +46,8 @@ def main(): auto_input = groups['input'] # Outputs - lib_output = args.lib - obj_output = args.obj + lib_output = args.lib + obj_output = args.obj # Dependencies global_srcs = groups['global_srcs'] @@ -69,10 +69,10 @@ def main(): if args.with_global_srcs: do_archive += global_srcs - def call(c): + def call(c): proc = subprocess.Popen(c, shell=False, stderr=sys.stderr, stdout=sys.stdout, cwd=args.build_root) - proc.communicate() - return proc.returncode + proc.communicate() + return proc.returncode if obj_output: link_res = call(do_link) diff --git a/build/scripts/mkver.py b/build/scripts/mkver.py index 321cdaade1..91197942af 100755 --- a/build/scripts/mkver.py +++ b/build/scripts/mkver.py @@ -1,12 +1,12 @@ import sys -if __name__ == '__main__': - with open(sys.argv[1], 'r') as f: - data = f.readline() +if __name__ == '__main__': + with open(sys.argv[1], 'r') as f: + data = f.readline() - beg = data.find('(') + 1 - end = data.find(')') - version = data[beg:end] + beg = data.find('(') + 1 + end = data.find(')') + version = data[beg:end] - print '#pragma once' - print '#define DEBIAN_VERSION "%s"' % version + print '#pragma once' + print '#define DEBIAN_VERSION "%s"' % version diff --git a/build/scripts/perl_wrapper.py b/build/scripts/perl_wrapper.py index cb4027f1d3..fdb9beb1db 100644 --- a/build/scripts/perl_wrapper.py +++ b/build/scripts/perl_wrapper.py @@ -2,23 +2,23 @@ import os import sys import shutil -if __name__ == '__main__': - path = sys.argv[1] - to = sys.argv[-1] - fr = sys.argv[-2] - to_dir = os.path.dirname(to) +if __name__ == '__main__': + path = sys.argv[1] + to = sys.argv[-1] + fr = sys.argv[-2] + to_dir = os.path.dirname(to) - os.chdir(to_dir) + os.chdir(to_dir) - f1 = os.path.basename(fr) - fr_ = os.path.dirname(fr) - f2 = os.path.basename(fr_) - fr_ = os.path.dirname(fr_) + f1 = os.path.basename(fr) + fr_ = os.path.dirname(fr) + f2 = os.path.basename(fr_) + fr_ = os.path.dirname(fr_) - os.makedirs(f2) - shutil.copyfile(fr, os.path.join(f2, f1)) + os.makedirs(f2) + shutil.copyfile(fr, os.path.join(f2, f1)) - if path[0] != '/': - path = os.path.join(os.path.dirname(__file__), path) + if path[0] != '/': + path = os.path.join(os.path.dirname(__file__), path) - os.execv(path, [path] + sys.argv[2:]) + os.execv(path, [path] + sys.argv[2:]) diff --git a/build/scripts/preprocess.py b/build/scripts/preprocess.py index 4657bef732..1d724c6819 100644 --- a/build/scripts/preprocess.py +++ b/build/scripts/preprocess.py @@ -44,5 +44,5 @@ def subst_headers(path, headers): f.write(prev) -if __name__ == '__main__': - subst_headers(sys.argv[1], ['stack.hh', 'position.hh', 'location.hh']) +if __name__ == '__main__': + subst_headers(sys.argv[1], ['stack.hh', 'position.hh', 'location.hh']) diff --git a/build/scripts/resolve_java_srcs.py b/build/scripts/resolve_java_srcs.py index a2e6c20012..bd50c96af9 100644 --- a/build/scripts/resolve_java_srcs.py +++ b/build/scripts/resolve_java_srcs.py @@ -17,15 +17,15 @@ def list_all_files(directory, prefix='/', hidden_files=False): def pattern_to_regexp(p): return '^' + \ ('/' if not p.startswith('**') else '') + \ - re.escape(p).replace( - r'\*\*\/', '[_DIR_]' - ).replace( - r'\*', '[_FILE_]' - ).replace( - '[_DIR_]', '(.*/)?' - ).replace( - '[_FILE_]', '([^/]*)' - ) + '$' + re.escape(p).replace( + r'\*\*\/', '[_DIR_]' + ).replace( + r'\*', '[_FILE_]' + ).replace( + '[_DIR_]', '(.*/)?' + ).replace( + '[_FILE_]', '([^/]*)' + ) + '$' def resolve_java_srcs(srcdir, include_patterns, exclude_patterns, all_resources, resolve_kotlin=False, resolve_groovy=False): @@ -87,7 +87,7 @@ def do_it(directory, sources_file, resources_file, kotlin_sources_file, groovy_s if groovy_sources_file: open(groovy_sources_file, mode).writelines(i + '\n' for i in g + j) - + if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('-d', '--directory', required=True) diff --git a/build/scripts/run_llvm_dsymutil.py b/build/scripts/run_llvm_dsymutil.py index 4f43362ad9..862cc74979 100644 --- a/build/scripts/run_llvm_dsymutil.py +++ b/build/scripts/run_llvm_dsymutil.py @@ -3,9 +3,9 @@ import sys import subprocess -if __name__ == '__main__': - with open(os.devnull, 'w') as fnull: - p = subprocess.Popen(sys.argv[1:], shell=False, stderr=fnull, stdout=sys.stdout) +if __name__ == '__main__': + with open(os.devnull, 'w') as fnull: + p = subprocess.Popen(sys.argv[1:], shell=False, stderr=fnull, stdout=sys.stdout) - p.communicate() - sys.exit(p.returncode) + p.communicate() + sys.exit(p.returncode) diff --git a/build/scripts/run_tool.py b/build/scripts/run_tool.py index 00e3ff6f1e..948e7f50d1 100755 --- a/build/scripts/run_tool.py +++ b/build/scripts/run_tool.py @@ -2,8 +2,8 @@ import sys import subprocess import os - -if __name__ == '__main__': - env = os.environ.copy() - env['ASAN_OPTIONS'] = 'detect_leaks=0' - subprocess.check_call(sys.argv[sys.argv.index('--') + 1:], env=env) + +if __name__ == '__main__': + env = os.environ.copy() + env['ASAN_OPTIONS'] = 'detect_leaks=0' + subprocess.check_call(sys.argv[sys.argv.index('--') + 1:], env=env) diff --git a/build/scripts/wrapper.py b/build/scripts/wrapper.py index 1e9d7955a5..7259ef5864 100644 --- a/build/scripts/wrapper.py +++ b/build/scripts/wrapper.py @@ -2,10 +2,10 @@ import os import sys -if __name__ == '__main__': - path = sys.argv[1] +if __name__ == '__main__': + path = sys.argv[1] - if path[0] != '/': - path = os.path.join(os.path.dirname(__file__), path) + if path[0] != '/': + path = os.path.join(os.path.dirname(__file__), path) - os.execv(path, [path] + sys.argv[2:]) + os.execv(path, [path] + sys.argv[2:]) diff --git a/build/scripts/xargs.py b/build/scripts/xargs.py index 5d68929ecc..8a6e93e027 100644 --- a/build/scripts/xargs.py +++ b/build/scripts/xargs.py @@ -2,17 +2,17 @@ import sys import os import subprocess -if __name__ == '__main__': - pos = sys.argv.index('--') - fname = sys.argv[pos + 1] - cmd = sys.argv[pos + 2:] +if __name__ == '__main__': + pos = sys.argv.index('--') + fname = sys.argv[pos + 1] + cmd = sys.argv[pos + 2:] - with open(fname, 'r') as f: - args = [x.strip() for x in f] + with open(fname, 'r') as f: + args = [x.strip() for x in f] - os.remove(fname) + os.remove(fname) - p = subprocess.Popen(cmd + args, shell=False, stderr=sys.stderr, stdout=sys.stdout) - p.communicate() + p = subprocess.Popen(cmd + args, shell=False, stderr=sys.stderr, stdout=sys.stdout) + p.communicate() - sys.exit(p.returncode) + sys.exit(p.returncode) diff --git a/build/scripts/ya.make b/build/scripts/ya.make index 710165e40d..5f19477098 100644 --- a/build/scripts/ya.make +++ b/build/scripts/ya.make @@ -10,44 +10,44 @@ TEST_SRCS( build_java_with_error_prone2.py build_mn.py build_pln_header.py - cat.py + cat.py cgo1_wrapper.py - check_config_h.py + check_config_h.py collect_java_srcs.py - compile_cuda.py - compile_java.py + compile_cuda.py + compile_java.py compile_jsrc.py compile_pysrc.py - configure_file.py + configure_file.py copy_files_to_dir.py - copy_to_dir.py - coverage-info.py + copy_to_dir.py + coverage-info.py cpp_flatc_wrapper.py - create_jcoverage_report.py + create_jcoverage_report.py extract_asrc.py extract_docs.py extract_jacoco_report.py - f2c.py + f2c.py fail_module_cmd.py fetch_from.py - fetch_from_external.py + fetch_from_external.py fetch_from_mds.py fetch_from_npm.py - fetch_from_sandbox.py - fetch_resource.py + fetch_from_sandbox.py + fetch_resource.py filter_zip.py - find_and_tar.py - fix_msvc_output.py - fs_tools.py + find_and_tar.py + fix_msvc_output.py + fs_tools.py gen_aar_gradle_script.py gen_java_codenav_entry.py gen_java_codenav_protobuf.py - gen_mx_table.py + gen_mx_table.py gen_py3_reg.py - gen_py_reg.py + gen_py_reg.py gen_test_apk_gradle_script.py - gen_ub.py - generate_pom.py + gen_ub.py + generate_pom.py go_proto_wrapper.py go_tool.py ios_wrapper.py @@ -55,43 +55,43 @@ TEST_SRCS( link_asrc.py link_dyn_lib.py link_exe.py - link_fat_obj.py - link_lib.py + link_fat_obj.py + link_lib.py llvm_opt_wrapper.py - merge_coverage_data.py + merge_coverage_data.py merge_files.py - mkdir.py + mkdir.py mkdocs_builder_wrapper.py - mkver.py + mkver.py pack_ios.py - pack_jcoverage_resources.py - perl_wrapper.py + pack_jcoverage_resources.py + perl_wrapper.py postprocess_go_fbs.py - preprocess.py - py_compile.py + preprocess.py + py_compile.py run_ios_simulator.py - run_javac.py + run_javac.py run_junit.py - run_llvm_dsymutil.py - run_msvc_wine.py - run_tool.py + run_llvm_dsymutil.py + run_msvc_wine.py + run_tool.py sky.py - stdout2stderr.py - symlink.py + stdout2stderr.py + symlink.py tar_directory.py tar_sources.py - tared_protoc.py - touch.py - unpacking_jtest_runner.py + tared_protoc.py + touch.py + unpacking_jtest_runner.py vcs_info.py with_coverage.py with_crash_on_timeout.py - with_pathsep_resolve.py + with_pathsep_resolve.py wrap_groovyc.py - wrapper.py - writer.py - xargs.py - yield_line.py + wrapper.py + writer.py + xargs.py + yield_line.py yndexer.py ) diff --git a/build/scripts/yield_line.py b/build/scripts/yield_line.py index 9c1c539146..ff47af4e3d 100644 --- a/build/scripts/yield_line.py +++ b/build/scripts/yield_line.py @@ -1,7 +1,7 @@ import sys -if __name__ == '__main__': - pos = sys.argv.index('--') +if __name__ == '__main__': + pos = sys.argv.index('--') - with open(sys.argv[pos + 1], 'a') as f: - f.write(' '.join(sys.argv[pos + 2:]) + '\n') + with open(sys.argv[pos + 1], 'a') as f: + f.write(' '.join(sys.argv[pos + 2:]) + '\n') |