diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:17 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:17 +0300 |
commit | d3a398281c6fd1d3672036cb2d63f842d2cb28c5 (patch) | |
tree | dd4bd3ca0f36b817e96812825ffaf10d645803f2 /build/plugins | |
parent | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (diff) | |
download | ydb-d3a398281c6fd1d3672036cb2d63f842d2cb28c5.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 2 of 2.
Diffstat (limited to 'build/plugins')
-rw-r--r-- | build/plugins/_common.py | 4 | ||||
-rw-r--r-- | build/plugins/_custom_command.py | 24 | ||||
-rw-r--r-- | build/plugins/_import_wrapper.py | 32 | ||||
-rw-r--r-- | build/plugins/_unpickler.py | 2 | ||||
-rw-r--r-- | build/plugins/bundle.py | 8 | ||||
-rw-r--r-- | build/plugins/cp.py | 2 | ||||
-rw-r--r-- | build/plugins/cpp_style.py | 36 | ||||
-rw-r--r-- | build/plugins/create_init_py.py | 4 | ||||
-rw-r--r-- | build/plugins/mx_archive.py | 20 | ||||
-rw-r--r-- | build/plugins/pybuild.py | 24 | ||||
-rw-r--r-- | build/plugins/res.py | 2 | ||||
-rw-r--r-- | build/plugins/rodata.py | 98 |
12 files changed, 128 insertions, 128 deletions
diff --git a/build/plugins/_common.py b/build/plugins/_common.py index 37b01baa2f..2f831a94db 100644 --- a/build/plugins/_common.py +++ b/build/plugins/_common.py @@ -105,8 +105,8 @@ def resolve_common_const(path): if path.startswith('${ARCADIA_BUILD_ROOT}'): return path.replace('${ARCADIA_BUILD_ROOT}', '$B', 1) return path - - + + def resolve_to_abs_path(path, source_root, build_root): if path.startswith('$S') and source_root is not None: return path.replace('$S', source_root, 1) diff --git a/build/plugins/_custom_command.py b/build/plugins/_custom_command.py index 5e554ee97f..9692214b22 100644 --- a/build/plugins/_custom_command.py +++ b/build/plugins/_custom_command.py @@ -1,7 +1,7 @@ import subprocess import sys -import os - +import os + import _common as common @@ -25,29 +25,29 @@ class CustomCommand(object): def call(self, args, **kwargs): cwd = self._get_call_specs('cwd', kwargs) stdout_path = self._get_call_specs('stdout', kwargs) - + resolved_args = [] - + for arg in args: - resolved_args.append(self.resolve_path(arg)) + resolved_args.append(self.resolve_path(arg)) if stdout_path: stdout = open(stdout_path, 'wb') else: stdout = None - env = os.environ.copy() - env['ASAN_OPTIONS'] = 'detect_leaks=0' + env = os.environ.copy() + env['ASAN_OPTIONS'] = 'detect_leaks=0' + + rc = subprocess.call(resolved_args, cwd=cwd, stdout=stdout, env=env) - rc = subprocess.call(resolved_args, cwd=cwd, stdout=stdout, env=env) - if stdout: stdout.close() if rc: sys.exit(rc) - def resolve_path(self, path): - return common.resolve_to_abs_path(path, self._source_root, self._build_root) + def resolve_path(self, path): + return common.resolve_to_abs_path(path, self._source_root, self._build_root) def _get_call_specs(self, name, kwargs): if isinstance(kwargs, dict): @@ -55,7 +55,7 @@ class CustomCommand(object): if param: return self.resolve_path(param) return None - + def addrule(*unused): pass diff --git a/build/plugins/_import_wrapper.py b/build/plugins/_import_wrapper.py index 2f26f90974..883f662314 100644 --- a/build/plugins/_import_wrapper.py +++ b/build/plugins/_import_wrapper.py @@ -1,24 +1,24 @@ try: - from ymake import CustomCommand as RealCustomCommand + from ymake import CustomCommand as RealCustomCommand from ymake import addrule from ymake import addparser - from ymake import subst + from ymake import subst + + class CustomCommand(RealCustomCommand): + def __init__(self, *args, **kwargs): + RealCustomCommand.__init__(*args, **kwargs) + + def resolve_path(self, path): + return subst(path) - class CustomCommand(RealCustomCommand): - def __init__(self, *args, **kwargs): - RealCustomCommand.__init__(*args, **kwargs) - - def resolve_path(self, path): - return subst(path) - except ImportError: from _custom_command import CustomCommand # noqa from _custom_command import addrule # noqa from _custom_command import addparser # noqa - - -try: - from ymake import engine_version -except ImportError: - def engine_version(): - return -1 + + +try: + from ymake import engine_version +except ImportError: + def engine_version(): + return -1 diff --git a/build/plugins/_unpickler.py b/build/plugins/_unpickler.py index 5d0ec085fb..e01e7b3118 100644 --- a/build/plugins/_unpickler.py +++ b/build/plugins/_unpickler.py @@ -27,7 +27,7 @@ def main(): assert (int(tools[0]) == len(tools[1:])), "tools quantity != tools number!" - cmd_object = pickle.loads(base64.b64decode(encoded_cmd)) + cmd_object = pickle.loads(base64.b64decode(encoded_cmd)) cmd_object.set_source_root(src_root) cmd_object.set_build_root(build_root) diff --git a/build/plugins/bundle.py b/build/plugins/bundle.py index c7864dc4f3..0bec8254ee 100644 --- a/build/plugins/bundle.py +++ b/build/plugins/bundle.py @@ -1,7 +1,7 @@ -import os - - -def onbundle(unit, *args): +import os + + +def onbundle(unit, *args): """ @usage BUNDLE(<Dir [NAME Name]>...) diff --git a/build/plugins/cp.py b/build/plugins/cp.py index 0685d5521a..5c663a3bdd 100644 --- a/build/plugins/cp.py +++ b/build/plugins/cp.py @@ -1,5 +1,5 @@ import os - + from _common import sort_by_keywords diff --git a/build/plugins/cpp_style.py b/build/plugins/cpp_style.py index feca9bc66f..3ab78b7320 100644 --- a/build/plugins/cpp_style.py +++ b/build/plugins/cpp_style.py @@ -1,19 +1,19 @@ -import os - -from _common import sort_by_keywords - - -def on_style(unit, *args): - def it(): - yield 'DONT_PARSE' - - for f in args: - f = f[len('${ARCADIA_ROOT}') + 1:] - - if '/generated/' in f: - continue - - yield f +import os + +from _common import sort_by_keywords + + +def on_style(unit, *args): + def it(): + yield 'DONT_PARSE' + + for f in args: + f = f[len('${ARCADIA_ROOT}') + 1:] + + if '/generated/' in f: + continue + + yield f yield '/cpp_style/files/' + f - - unit.onresource(list(it())) + + unit.onresource(list(it())) diff --git a/build/plugins/create_init_py.py b/build/plugins/create_init_py.py index 131bda1dbb..e41a4d22df 100644 --- a/build/plugins/create_init_py.py +++ b/build/plugins/create_init_py.py @@ -1,8 +1,8 @@ import os - + from _common import sort_by_keywords - + def oncreate_init_py_structure(unit, *args): if unit.get('DISTBUILD'): return diff --git a/build/plugins/mx_archive.py b/build/plugins/mx_archive.py index ca32bfc8d1..56b0d4d16e 100644 --- a/build/plugins/mx_archive.py +++ b/build/plugins/mx_archive.py @@ -1,16 +1,16 @@ -def onmx_formulas(unit, *args): +def onmx_formulas(unit, *args): """ @usage: MX_FORMULAS(BinFiles...) # deprecated, matrixnet Create MatrixNet formulas archive """ - def iter_infos(): - for a in args: - if a.endswith('.bin'): + def iter_infos(): + for a in args: + if a.endswith('.bin'): unit.on_mx_bin_to_info([a]) - yield a[:-3] + 'info' - else: - yield a - - infos = list(iter_infos()) - unit.onarchive_asm(['NAME', 'MxFormulas'] + infos) + yield a[:-3] + 'info' + else: + yield a + + infos = list(iter_infos()) + unit.onarchive_asm(['NAME', 'MxFormulas'] + infos) unit.on_mx_gen_table(infos) diff --git a/build/plugins/pybuild.py b/build/plugins/pybuild.py index 621eb7805e..f32a2d39a0 100644 --- a/build/plugins/pybuild.py +++ b/build/plugins/pybuild.py @@ -5,7 +5,7 @@ from hashlib import md5 import ymake from _common import stripext, rootrel_arc_src, tobuilddir, listid, resolve_to_ymake_path, generate_chunks, pathid - + YA_IDE_VENV_VAR = 'YA_IDE_VENV' PY_NAMESPACE_PREFIX = 'py/namespace' BUILTIN_PROTO = 'builtin_proto' @@ -16,7 +16,7 @@ def is_arc_src(src, unit): src.startswith('${CURDIR}/') or unit.resolve_arc_path(src).startswith('$S/') ) - + def is_extended_source_search_enabled(path, unit): if not is_arc_src(path, unit): return False @@ -28,7 +28,7 @@ def to_build_root(path, unit): if is_arc_src(path, unit): return '${ARCADIA_BUILD_ROOT}/' + rootrel_arc_src(path, unit) return path - + def uniq_suffix(path, unit): upath = unit.path() if '/' not in path: @@ -168,7 +168,7 @@ def py_program(unit, py3): unit.onadd_check_py_imports() -def onpy_srcs(unit, *args): +def onpy_srcs(unit, *args): """ @usage PY_SRCS({| CYTHON_C} { | TOP_LEVEL | NAMESPACE ns} Files...) @@ -201,10 +201,10 @@ def onpy_srcs(unit, *args): venv = unit.get(YA_IDE_VENV_VAR) need_gazetteer_peerdir = False trim = 0 - + if not upath.startswith('contrib/tools/python') and not upath.startswith('library/python/runtime') and unit.get('NO_PYTHON_INCLS') != 'yes': unit.onpeerdir(['contrib/libs/python']) - + unit_needs_main = unit.get('MODULE_TYPE') in ('PROGRAM', 'DLL') if unit_needs_main: py_program(unit, py3) @@ -222,7 +222,7 @@ def onpy_srcs(unit, *args): cython_directives = [] if cython_coverage: cython_directives += ['-X', 'linetrace=True'] - + pyxs_c = [] pyxs_c_h = [] pyxs_c_api_h = [] @@ -236,7 +236,7 @@ def onpy_srcs(unit, *args): evs = [] fbss = [] py_namespaces = {} - + dump_dir = unit.get('PYTHON_BUILD_DUMP_DIR') dump_output = None if dump_dir: @@ -324,7 +324,7 @@ def onpy_srcs(unit, *args): ymake.report_configure_error('TOP_LEVEL __main__.py is not allowed in PY3_PROGRAM') pathmod = (path, mod) - + if dump_output is not None: dump_output.write('{path}\t{module}\n'.format(path=rootrel_arc_src(path, unit), module=mod)) @@ -493,10 +493,10 @@ def onpy_srcs(unit, *args): py_runtime_path = 'contrib/python/protobuf' builtin_proto_path = cpp_runtime_path + '/' + BUILTIN_PROTO - if protos: + if protos: if not upath.startswith(py_runtime_path) and not upath.startswith(builtin_proto_path): unit.onpeerdir(py_runtime_path) - + unit.onpeerdir(unit.get("PY_PROTO_DEPS").split()) proto_paths = [path for path, mod in protos] @@ -514,7 +514,7 @@ def onpy_srcs(unit, *args): unit.onpeerdir([cpp_runtime_path]) unit.on_generate_py_evs_internal([path for path, mod in evs]) unit.onpy_srcs([ev_arg(path, mod, unit) for path, mod in evs]) - + if fbss: unit.onpeerdir(unit.get('_PY_FBS_DEPS').split()) pysrc_base_name = listid(fbss) diff --git a/build/plugins/res.py b/build/plugins/res.py index 48fb57b426..a937caba81 100644 --- a/build/plugins/res.py +++ b/build/plugins/res.py @@ -1,6 +1,6 @@ from _common import iterpair, listid, pathid, rootrel_arc_src, tobuilddir, filter_out_by_keyword - + def split(lst, limit): # paths are specified with replaceable prefix # real length is unknown at the moment, that why we use root_lenght diff --git a/build/plugins/rodata.py b/build/plugins/rodata.py index 98defaff65..3ecb0f9a83 100644 --- a/build/plugins/rodata.py +++ b/build/plugins/rodata.py @@ -1,15 +1,15 @@ import argparse -import os - -import _common as common -import _import_wrapper as iw - - +import os + +import _common as common +import _import_wrapper as iw + + class ROData(iw.CustomCommand): def __init__(self, path, unit): self._path = path self._flags = [] - + prefix = unit.get('ASM_PREFIX') if prefix: @@ -118,51 +118,51 @@ class ROData(iw.CustomCommand): self.call(cmd) -class RODataCXX(iw.CustomCommand): - def __init__(self, path, unit): - self._path = path - self._base = os.path.basename(common.stripext(self._path)) - - def descr(self): - return 'RD', self._path, 'light-green' - - def input(self): +class RODataCXX(iw.CustomCommand): + def __init__(self, path, unit): + self._path = path + self._base = os.path.basename(common.stripext(self._path)) + + def descr(self): + return 'RD', self._path, 'light-green' + + def input(self): return common.make_tuples([self._path]) - - def main_out(self): - return common.tobuilddir(common.stripext(self._path)) + '.cpp' - - def output(self): + + def main_out(self): + return common.tobuilddir(common.stripext(self._path)) + '.cpp' + + def output(self): return common.make_tuples([self.main_out()]) - + def run(self, extra_args, binary): - with open(self.resolve_path(self.main_out()), 'w') as f: - f.write('static_assert(sizeof(unsigned int) == 4, "ups, something gone wrong");\n\n') - f.write('extern "C" {\n') - f.write(' extern const unsigned char ' + self._base + '[] = {\n') - - cnt = 0 - - with open(self.resolve_path(self._path), 'r') as input: - for ch in input.read(): - f.write('0x%02x, ' % ord(ch)) - - cnt += 1 - - if cnt % 50 == 1: - f.write('\n') - - f.write(' };\n') - f.write(' extern const unsigned int ' + self._base + 'Size = sizeof(' + self._base + ');\n') - f.write('}\n') - - -def ro_data(path, unit): + with open(self.resolve_path(self.main_out()), 'w') as f: + f.write('static_assert(sizeof(unsigned int) == 4, "ups, something gone wrong");\n\n') + f.write('extern "C" {\n') + f.write(' extern const unsigned char ' + self._base + '[] = {\n') + + cnt = 0 + + with open(self.resolve_path(self._path), 'r') as input: + for ch in input.read(): + f.write('0x%02x, ' % ord(ch)) + + cnt += 1 + + if cnt % 50 == 1: + f.write('\n') + + f.write(' };\n') + f.write(' extern const unsigned int ' + self._base + 'Size = sizeof(' + self._base + ');\n') + f.write('}\n') + + +def ro_data(path, unit): if unit.enabled('ARCH_AARCH64') or unit.enabled('ARCH_ARM') or unit.enabled('ARCH_PPC64LE'): - return RODataCXX(path, unit) - - return ROData(path, unit) - - + return RODataCXX(path, unit) + + return ROData(path, unit) + + def init(): iw.addrule('rodata', ro_data) |