diff options
author | snermolaev <snermolaev@yandex-team.com> | 2023-10-21 04:35:55 +0300 |
---|---|---|
committer | snermolaev <snermolaev@yandex-team.com> | 2023-10-21 05:14:46 +0300 |
commit | 61e65e86eb9daac7be0a0d3dbca1686fbfb3dcae (patch) | |
tree | dd92d550d5798346a60563cfb2b36c2cb9f81e39 /build/plugins | |
parent | 3223732c2dd456d88d3d71cc498ead9bce2ec185 (diff) | |
download | ydb-61e65e86eb9daac7be0a0d3dbca1686fbfb3dcae.tar.gz |
cleanup plugins
Diffstat (limited to 'build/plugins')
-rw-r--r-- | build/plugins/_common.py | 27 | ||||
-rw-r--r-- | build/plugins/cpp_style.py | 5 | ||||
-rw-r--r-- | build/plugins/llvm_bc.py | 2 | ||||
-rw-r--r-- | build/plugins/macros_with_error.py | 2 | ||||
-rw-r--r-- | build/plugins/res.py | 29 | ||||
-rw-r--r-- | build/plugins/tests/test_common.py | 14 |
6 files changed, 3 insertions, 76 deletions
diff --git a/build/plugins/_common.py b/build/plugins/_common.py index 436bed4e0b..9ac1d580d0 100644 --- a/build/plugins/_common.py +++ b/build/plugins/_common.py @@ -30,24 +30,6 @@ def listid(items): return pathid(str(sorted(items))) -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('.')] @@ -127,10 +109,6 @@ def resolve_to_ymake_path(path): return resolve_to_abs_path(path, '${ARCADIA_ROOT}', '${ARCADIA_BUILD_ROOT}') -def join_intl_paths(*args): - return '/'.join(args) - - def get(fun, num): return fun()[num][0] @@ -193,11 +171,6 @@ def filter_out_by_keyword(test_data, keyword): return list(_iterate()) -def generate_chunks(lst, chunk_size): - for i in xrange(0, len(lst), chunk_size): - yield lst[i : (i + chunk_size)] - - def strip_roots(path): for prefix in ["$B/", "$S/"]: if path.startswith(prefix): diff --git a/build/plugins/cpp_style.py b/build/plugins/cpp_style.py index 6d59a1f0d4..fd2b63e7f3 100644 --- a/build/plugins/cpp_style.py +++ b/build/plugins/cpp_style.py @@ -1,8 +1,3 @@ -import os - -from _common import sort_by_keywords - - def on_style(unit, *args): def it(): yield 'DONT_PARSE' diff --git a/build/plugins/llvm_bc.py b/build/plugins/llvm_bc.py index afe46fa386..ab548a3999 100644 --- a/build/plugins/llvm_bc.py +++ b/build/plugins/llvm_bc.py @@ -1,6 +1,6 @@ import sys -from _common import rootrel_arc_src, sort_by_keywords, skip_build_root, stripext +from _common import rootrel_arc_src, sort_by_keywords, skip_build_root def onllvm_bc(unit, *args): diff --git a/build/plugins/macros_with_error.py b/build/plugins/macros_with_error.py index eceb8b9c42..81cd709678 100644 --- a/build/plugins/macros_with_error.py +++ b/build/plugins/macros_with_error.py @@ -6,7 +6,7 @@ import ymake def onmacros_with_error(unit, *args): - print >> sys.stderr, 'This macros will fail' + sys.stderr.write('This macros will fail\n') raise Exception('Expected fail in MACROS_WITH_ERROR') diff --git a/build/plugins/res.py b/build/plugins/res.py index 3339ea8c0e..c7d1027061 100644 --- a/build/plugins/res.py +++ b/build/plugins/res.py @@ -1,37 +1,10 @@ import json import os import six -from _common import iterpair, listid, pathid, rootrel_arc_src, tobuilddir, filter_out_by_keyword +from _common import rootrel_arc_src import ymake -def split(lst, limit): - # paths are specified with replaceable prefix - # real length is unknown at the moment, that why we use root_lenght - # as a rough estimation - root_lenght = 200 - filepath = None - lenght = 0 - bucket = [] - - for item in lst: - if filepath: - lenght += root_lenght + len(filepath) + len(item) - if lenght > limit and bucket: - yield bucket - bucket = [] - lenght = 0 - - bucket.append(filepath) - bucket.append(item) - filepath = None - else: - filepath = item - - if bucket: - yield bucket - - def remove_prefix(text, prefix): if text.startswith(prefix): return text[len(prefix) :] diff --git a/build/plugins/tests/test_common.py b/build/plugins/tests/test_common.py index 7847b8bb65..4c81a2ea93 100644 --- a/build/plugins/tests/test_common.py +++ b/build/plugins/tests/test_common.py @@ -1,4 +1,3 @@ -import pytest import _common as pc @@ -33,16 +32,3 @@ def test_filter_out_by_keyword(): assert pc.filter_out_by_keyword(['x', 'A', 'A', 'A', 'B', 'y'], 'A') == ['x', 'y'] assert pc.filter_out_by_keyword(['x', 'A', 'A', 'A', 'B', 'y', 'A'], 'A') == ['x', 'y'] assert pc.filter_out_by_keyword(['x', 'A', 'A', 'A', 'B', 'y', 'A', 'F', 'z'], 'A') == ['x', 'y', 'z'] - - -test_data = [ - [[1, 2, 3], 1, [[1], [2], [3]]], - [[1, 2, 3], 2, [[1, 2], [3]]], - [[1, 2, 3, 4], 2, [[1, 2], [3, 4]]], - [[1], 5, [[1]]], -] - - -@pytest.mark.parametrize('lst, chunk_size, expected', test_data, ids=[str(num + 1) for num in range(len(test_data))]) -def test_generate_chunks(lst, chunk_size, expected): - assert list(pc.generate_chunks(lst, chunk_size)) == expected |