diff options
author | rnefyodov <rnefyodov@yandex-team.ru> | 2022-02-10 16:47:17 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:17 +0300 |
commit | c753751b693cf7c481c0292912e2b7536fa6d36a (patch) | |
tree | 9814fbd1c3effac9b8377c5d604b367b14e2db55 /build/plugins | |
parent | c22320e8c4f3d7be38c504706f137034e91d31e6 (diff) | |
download | ydb-c753751b693cf7c481c0292912e2b7536fa6d36a.tar.gz |
Restoring authorship annotation for <rnefyodov@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'build/plugins')
-rw-r--r-- | build/plugins/_common.py | 176 | ||||
-rw-r--r-- | build/plugins/_import_wrapper.py | 6 | ||||
-rw-r--r-- | build/plugins/_unpickler.py | 8 | ||||
-rw-r--r-- | build/plugins/llvm_bc.py | 38 | ||||
-rw-r--r-- | build/plugins/pybuild.py | 6 | ||||
-rw-r--r-- | build/plugins/res.py | 6 | ||||
-rw-r--r-- | build/plugins/ytest.py | 4 |
7 files changed, 122 insertions, 122 deletions
diff --git a/build/plugins/_common.py b/build/plugins/_common.py index e6ec69b909..2f831a94db 100644 --- a/build/plugins/_common.py +++ b/build/plugins/_common.py @@ -1,73 +1,73 @@ import sys -import hashlib +import hashlib import base64 - - -class Result(object): - pass - - -def lazy(func): - result = Result() - - def wrapper(): - try: - return result._result - except AttributeError: - result._result = func() - - return result._result - - return wrapper - - -def pathid(path): + + +class Result(object): + pass + + +def lazy(func): + result = Result() + + def wrapper(): + try: + return result._result + except AttributeError: + result._result = func() + + return result._result + + return wrapper + + +def pathid(path): return base64.b32encode(hashlib.md5(path).digest()).lower().strip('=') - - -def listid(l): - return pathid(str(sorted(l))) - - -def unpair(lst): - for x, y in lst: - yield x - yield y - - -def iterpair(lst): - y = None - - for x in lst: - if y: - yield (y, x) - - y = None - else: - y = x - - -def stripext(fname): - return fname[:fname.rfind('.')] - - -def tobuilddir(fname): + + +def listid(l): + return pathid(str(sorted(l))) + + +def unpair(lst): + for x, y in lst: + yield x + yield y + + +def iterpair(lst): + y = None + + for x in lst: + if y: + yield (y, x) + + y = None + else: + y = x + + +def stripext(fname): + return fname[:fname.rfind('.')] + + +def tobuilddir(fname): if not fname: return '$B' - if fname.startswith('$S'): - return fname.replace('$S', '$B', 1) - else: - return fname - - -def before(s, ss): - p = s.find(ss) - - if p == -1: - return s - - return s[:p] - + if fname.startswith('$S'): + return fname.replace('$S', '$B', 1) + else: + return fname + + +def before(s, ss): + p = s.find(ss) + + if p == -1: + return s + + return s[:p] + def sort_by_keywords(keywords, args): flat = [] @@ -139,32 +139,32 @@ def resolve_includes(unit, src, paths): return unit.resolve_include([src] + paths) if paths else [] -def rootrel_arc_src(src, unit): - if src.startswith('${ARCADIA_ROOT}/'): - return src[16:] - +def rootrel_arc_src(src, unit): + if src.startswith('${ARCADIA_ROOT}/'): + return src[16:] + if src.startswith('${ARCADIA_BUILD_ROOT}/'): return src[22:] - elif src.startswith('${CURDIR}/'): - return unit.path()[3:] + '/' + src[10:] - - else: - resolved = unit.resolve_arc_path(src) - - if resolved.startswith('$S/'): - return resolved[3:] - - return src # leave as is - - -def skip_build_root(x): - if x.startswith('${ARCADIA_BUILD_ROOT}'): - return x[len('${ARCADIA_BUILD_ROOT}'):].lstrip('/') - - return x - - + elif src.startswith('${CURDIR}/'): + return unit.path()[3:] + '/' + src[10:] + + else: + resolved = unit.resolve_arc_path(src) + + if resolved.startswith('$S/'): + return resolved[3:] + + return src # leave as is + + +def skip_build_root(x): + if x.startswith('${ARCADIA_BUILD_ROOT}'): + return x[len('${ARCADIA_BUILD_ROOT}'):].lstrip('/') + + return x + + def get_interpreter_path(): interpreter_path = [sys.executable] if 'ymake' in interpreter_path[0]: diff --git a/build/plugins/_import_wrapper.py b/build/plugins/_import_wrapper.py index 5b6e33af3f..883f662314 100644 --- a/build/plugins/_import_wrapper.py +++ b/build/plugins/_import_wrapper.py @@ -12,9 +12,9 @@ try: return subst(path) except ImportError: - from _custom_command import CustomCommand # noqa - from _custom_command import addrule # noqa - from _custom_command import addparser # noqa + from _custom_command import CustomCommand # noqa + from _custom_command import addrule # noqa + from _custom_command import addparser # noqa try: diff --git a/build/plugins/_unpickler.py b/build/plugins/_unpickler.py index 269ab8de22..e01e7b3118 100644 --- a/build/plugins/_unpickler.py +++ b/build/plugins/_unpickler.py @@ -1,7 +1,7 @@ -import sys - -sys.dont_write_bytecode = True - +import sys + +sys.dont_write_bytecode = True + import argparse import base64 try: diff --git a/build/plugins/llvm_bc.py b/build/plugins/llvm_bc.py index 2fcac191ae..2cfe43884c 100644 --- a/build/plugins/llvm_bc.py +++ b/build/plugins/llvm_bc.py @@ -1,19 +1,19 @@ -import sys - -from _common import rootrel_arc_src, sort_by_keywords, skip_build_root, stripext - - -def onllvm_bc(unit, *args): +import sys + +from _common import rootrel_arc_src, sort_by_keywords, skip_build_root, stripext + + +def onllvm_bc(unit, *args): free_args, kwds = sort_by_keywords({'SYMBOLS': -1, 'NAME': 1, 'NO_COMPILE': 0}, args) - name = kwds['NAME'][0] - symbols = kwds.get('SYMBOLS') + name = kwds['NAME'][0] + symbols = kwds.get('SYMBOLS') obj_suf = unit.get('OBJ_SUF') skip_compile_step = 'NO_COMPILE' in kwds merged_bc = name + '_merged' + obj_suf + '.bc' out_bc = name + '_optimized' + obj_suf + '.bc' - bcs = [] - for x in free_args: - rel_path = rootrel_arc_src(x, unit) + bcs = [] + for x in free_args: + rel_path = rootrel_arc_src(x, unit) bc_path = '${ARCADIA_BUILD_ROOT}/' + skip_build_root(rel_path) + obj_suf + '.bc' if not skip_compile_step: if x.endswith('.c'): @@ -23,11 +23,11 @@ def onllvm_bc(unit, *args): else: llvm_compile = unit.onllvm_compile_cxx llvm_compile([rel_path, bc_path]) - bcs.append(bc_path) - unit.onllvm_link([merged_bc] + bcs) - opt_opts = ['-O2', '-globalopt', '-globaldce'] - if symbols: - # XXX: '#' used instead of ',' to overcome ymake tendency to split everything by comma - opt_opts += ['-internalize', '-internalize-public-api-list=' + '#'.join(symbols)] - unit.onllvm_opt([merged_bc, out_bc] + opt_opts) - unit.onresource([out_bc, '/llvm_bc/' + name]) + bcs.append(bc_path) + unit.onllvm_link([merged_bc] + bcs) + opt_opts = ['-O2', '-globalopt', '-globaldce'] + if symbols: + # XXX: '#' used instead of ',' to overcome ymake tendency to split everything by comma + opt_opts += ['-internalize', '-internalize-public-api-list=' + '#'.join(symbols)] + unit.onllvm_opt([merged_bc, out_bc] + opt_opts) + unit.onresource([out_bc, '/llvm_bc/' + name]) diff --git a/build/plugins/pybuild.py b/build/plugins/pybuild.py index 0d722f385e..f32a2d39a0 100644 --- a/build/plugins/pybuild.py +++ b/build/plugins/pybuild.py @@ -43,8 +43,8 @@ def pb2_arg(suf, path, mod, unit): modsuf=stripext(suf) ) -def proto_arg(path, mod, unit): - return '{}.proto={}'.format(stripext(to_build_root(path, unit)), mod) +def proto_arg(path, mod, unit): + return '{}.proto={}'.format(stripext(to_build_root(path, unit)), mod) def pb_cc_arg(suf, path, unit): return '{}{suf}'.format(stripext(to_build_root(path, unit)), suf=suf) @@ -311,7 +311,7 @@ def onpy_srcs(unit, *args): mod_root_path = root_rel_path[:-(len(path) + 1)] py_namespaces.setdefault(mod_root_path, set()).add(ns if ns else '.') mod = ns + mod_name - + if main_mod: py_main(unit, mod + ":main") elif py3 and unit_needs_main and main_py: diff --git a/build/plugins/res.py b/build/plugins/res.py index 0c47e6ed7e..a937caba81 100644 --- a/build/plugins/res.py +++ b/build/plugins/res.py @@ -1,5 +1,5 @@ from _common import iterpair, listid, pathid, rootrel_arc_src, tobuilddir, filter_out_by_keyword - + def split(lst, limit): # paths are specified with replaceable prefix @@ -36,7 +36,7 @@ def remove_prefix(text, prefix): def onfat_resource(unit, *args): unit.onpeerdir(['library/cpp/resource']) - + # Since the maximum length of lpCommandLine string for CreateProcess is 8kb (windows) characters, # we make several calls of rescompiler # https://msdn.microsoft.com/ru-ru/library/windows/desktop/ms682425.aspx @@ -45,7 +45,7 @@ def onfat_resource(unit, *args): inputs = [x for x, y in iterpair(part_args) if x != '-'] if inputs: inputs = ['IN'] + inputs - + unit.onrun_program(['tools/rescompiler', output] + part_args + inputs + ['OUT_NOAUTO', output]) unit.onsrcs(['GLOBAL', output]) diff --git a/build/plugins/ytest.py b/build/plugins/ytest.py index b70d767e47..8970837f0f 100644 --- a/build/plugins/ytest.py +++ b/build/plugins/ytest.py @@ -12,7 +12,7 @@ import _requirements as reqs import StringIO import subprocess import collections - + import ymake @@ -131,7 +131,7 @@ def validate_test(unit, kw): if valid_kw.get('SCRIPT-REL-PATH') == 'boost.test': project_path = valid_kw.get('BUILD-FOLDER-PATH', "") - if not project_path.startswith(("contrib", "mail", "maps", "tools/idl", "metrika", "devtools", "mds", "yandex_io", "smart_devices")): + if not project_path.startswith(("contrib", "mail", "maps", "tools/idl", "metrika", "devtools", "mds", "yandex_io", "smart_devices")): errors.append("BOOSTTEST is not allowed here") elif valid_kw.get('SCRIPT-REL-PATH') == 'gtest': project_path = valid_kw.get('BUILD-FOLDER-PATH', "") |