diff options
author | snowball <snowball@yandex-team.ru> | 2022-02-10 16:46:32 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:32 +0300 |
commit | 83a8efcf3af051e3dd59c00d1d5dafc96412ec1e (patch) | |
tree | 1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /build | |
parent | 4d57126b1bae3cfd0f4f95c32d1a85ca684ee92c (diff) | |
download | ydb-83a8efcf3af051e3dd59c00d1d5dafc96412ec1e.tar.gz |
Restoring authorship annotation for <snowball@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'build')
37 files changed, 972 insertions, 972 deletions
diff --git a/build/external_resources/codenavigation/ya.make b/build/external_resources/codenavigation/ya.make index 1bd218c9ad..8cfdf0d3d5 100644 --- a/build/external_resources/codenavigation/ya.make +++ b/build/external_resources/codenavigation/ya.make @@ -1,4 +1,4 @@ -OWNER(g:yatool) +OWNER(g:yatool) RESOURCES_LIBRARY() diff --git a/build/plugins/_common.py b/build/plugins/_common.py index 11e87a7d34..2f831a94db 100644 --- a/build/plugins/_common.py +++ b/build/plugins/_common.py @@ -185,9 +185,9 @@ 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 generate_chunks(lst, chunk_size): + for i in xrange(0, len(lst), chunk_size): + yield lst[i:(i + chunk_size)] def strip_roots(path): diff --git a/build/plugins/_requirements.py b/build/plugins/_requirements.py index a10b75110f..c27635e852 100644 --- a/build/plugins/_requirements.py +++ b/build/plugins/_requirements.py @@ -1,49 +1,49 @@ -import _test_const as consts - - -def check_cpu(suite_cpu_requirements, test_size, is_kvm=False): - min_cpu_requirements = consts.TestRequirementsConstants.MinCpu - max_cpu_requirements = consts.TestSize.get_max_requirements(test_size).get(consts.TestRequirements.Cpu) - if isinstance(suite_cpu_requirements, str): - if all(consts.TestRequirementsConstants.is_all_cpu(req) for req in (max_cpu_requirements, suite_cpu_requirements)): +import _test_const as consts + + +def check_cpu(suite_cpu_requirements, test_size, is_kvm=False): + min_cpu_requirements = consts.TestRequirementsConstants.MinCpu + max_cpu_requirements = consts.TestSize.get_max_requirements(test_size).get(consts.TestRequirements.Cpu) + if isinstance(suite_cpu_requirements, str): + if all(consts.TestRequirementsConstants.is_all_cpu(req) for req in (max_cpu_requirements, suite_cpu_requirements)): return None return "Wrong 'cpu' requirements: {}, should be in [{}..{}] for {}-size tests".format(suite_cpu_requirements, min_cpu_requirements, max_cpu_requirements, test_size) - - if not isinstance(suite_cpu_requirements, int): + + if not isinstance(suite_cpu_requirements, int): return "Wrong 'cpu' requirements: {}, should be integer".format(suite_cpu_requirements) - - if suite_cpu_requirements < min_cpu_requirements or suite_cpu_requirements > consts.TestRequirementsConstants.get_cpu_value(max_cpu_requirements): + + if suite_cpu_requirements < min_cpu_requirements or suite_cpu_requirements > consts.TestRequirementsConstants.get_cpu_value(max_cpu_requirements): return "Wrong 'cpu' requirement: {}, should be in [{}..{}] for {}-size tests".format(suite_cpu_requirements, min_cpu_requirements, max_cpu_requirements, test_size) - + return None - - -# TODO: Remove is_kvm param when there will be guarantees on RAM -def check_ram(suite_ram_requirements, test_size, is_kvm=False): - if not isinstance(suite_ram_requirements, int): + + +# TODO: Remove is_kvm param when there will be guarantees on RAM +def check_ram(suite_ram_requirements, test_size, is_kvm=False): + if not isinstance(suite_ram_requirements, int): return "Wrong 'ram' requirements: {}, should be integer".format(suite_ram_requirements) - min_ram_requirements = consts.TestRequirementsConstants.MinRam - max_ram_requirements = consts.MAX_RAM_REQUIREMENTS_FOR_KVM if is_kvm else consts.TestSize.get_max_requirements(test_size).get(consts.TestRequirements.Ram) - if suite_ram_requirements < min_ram_requirements or suite_ram_requirements > max_ram_requirements: - err_msg = "Wrong 'ram' requirements: {}, should be in [{}..{}] for {}-size tests".format(suite_ram_requirements, min_ram_requirements, max_ram_requirements, test_size) - if is_kvm: - err_msg += ' with kvm requirements' - return err_msg + min_ram_requirements = consts.TestRequirementsConstants.MinRam + max_ram_requirements = consts.MAX_RAM_REQUIREMENTS_FOR_KVM if is_kvm else consts.TestSize.get_max_requirements(test_size).get(consts.TestRequirements.Ram) + if suite_ram_requirements < min_ram_requirements or suite_ram_requirements > max_ram_requirements: + err_msg = "Wrong 'ram' requirements: {}, should be in [{}..{}] for {}-size tests".format(suite_ram_requirements, min_ram_requirements, max_ram_requirements, test_size) + if is_kvm: + err_msg += ' with kvm requirements' + return err_msg return None - - -def check_ram_disk(suite_ram_disk, test_size, is_kvm=False): - min_ram_disk = consts.TestRequirementsConstants.MinRamDisk - max_ram_disk = consts.TestSize.get_max_requirements(test_size).get(consts.TestRequirements.RamDisk) - if isinstance(suite_ram_disk, str): - if all(consts.TestRequirementsConstants.is_all_ram_disk(req) for req in (max_ram_disk, suite_ram_disk)): + + +def check_ram_disk(suite_ram_disk, test_size, is_kvm=False): + min_ram_disk = consts.TestRequirementsConstants.MinRamDisk + max_ram_disk = consts.TestSize.get_max_requirements(test_size).get(consts.TestRequirements.RamDisk) + if isinstance(suite_ram_disk, str): + if all(consts.TestRequirementsConstants.is_all_ram_disk(req) for req in (max_ram_disk, suite_ram_disk)): return None return "Wrong 'ram_disk' requirements: {}, should be in [{}..{}] for {}-size tests".format(suite_ram_disk, 0, max_ram_disk, test_size) - - if not isinstance(suite_ram_disk, int): + + if not isinstance(suite_ram_disk, int): return "Wrong 'ram_disk' requirements: {}, should be integer".format(suite_ram_disk) - - if suite_ram_disk < min_ram_disk or suite_ram_disk > consts.TestRequirementsConstants.get_ram_disk_value(max_ram_disk): + + if suite_ram_disk < min_ram_disk or suite_ram_disk > consts.TestRequirementsConstants.get_ram_disk_value(max_ram_disk): return "Wrong 'ram_disk' requirement: {}, should be in [{}..{}] for {}-size tests".format(suite_ram_disk, min_ram_disk, max_ram_disk, test_size) - + return None diff --git a/build/plugins/_test_const.py b/build/plugins/_test_const.py index 62683d40f8..0d03cc3d17 100644 --- a/build/plugins/_test_const.py +++ b/build/plugins/_test_const.py @@ -1,5 +1,5 @@ # coding: utf-8 -import re +import re import sys @@ -24,25 +24,25 @@ REPORT_SNIPPET_LIMIT = 10000 SANITIZER_ERROR_RC = 100 TEST_SUBTEST_SEPARATOR = '::' TESTING_OUT_DIR_NAME = "testing_out_stuff" -TESTING_OUT_TAR_NAME = TESTING_OUT_DIR_NAME + ".tar" +TESTING_OUT_TAR_NAME = TESTING_OUT_DIR_NAME + ".tar" TIMESTAMP_FORMAT = "%Y-%m-%d %H:%M:%S.%f" TRACE_FILE_NAME = "ytest.report.trace" TRUNCATING_IGNORE_FILE_LIST = {TRACE_FILE_NAME, "run_test.log"} -# kvm -DEFAULT_RAM_REQUIREMENTS_FOR_KVM = 4 -MAX_RAM_REQUIREMENTS_FOR_KVM = 16 - -# distbuild -TEST_NODE_FINISHING_TIME = 5 * 60 -DEFAULT_TEST_NODE_TIMEOUT = 15 * 60 - +# kvm +DEFAULT_RAM_REQUIREMENTS_FOR_KVM = 4 +MAX_RAM_REQUIREMENTS_FOR_KVM = 16 + +# distbuild +TEST_NODE_FINISHING_TIME = 5 * 60 +DEFAULT_TEST_NODE_TIMEOUT = 15 * 60 + # coverage -COVERAGE_TESTS_TIMEOUT_FACTOR = 1.5 -COVERAGE_RESOLVED_FILE_NAME_PATTERN = "coverage_resolved.{}.json" -CPP_COVERAGE_RESOLVED_FILE_NAME = COVERAGE_RESOLVED_FILE_NAME_PATTERN.format("cpp") -JAVA_COVERAGE_RESOLVED_FILE_NAME = COVERAGE_RESOLVED_FILE_NAME_PATTERN.format("java") -PYTHON_COVERAGE_RESOLVED_FILE_NAME = COVERAGE_RESOLVED_FILE_NAME_PATTERN.format("python") +COVERAGE_TESTS_TIMEOUT_FACTOR = 1.5 +COVERAGE_RESOLVED_FILE_NAME_PATTERN = "coverage_resolved.{}.json" +CPP_COVERAGE_RESOLVED_FILE_NAME = COVERAGE_RESOLVED_FILE_NAME_PATTERN.format("cpp") +JAVA_COVERAGE_RESOLVED_FILE_NAME = COVERAGE_RESOLVED_FILE_NAME_PATTERN.format("java") +PYTHON_COVERAGE_RESOLVED_FILE_NAME = COVERAGE_RESOLVED_FILE_NAME_PATTERN.format("python") CLANG_COVERAGE_TEST_TYPES = ("unittest", "coverage_extractor", "pytest", "py3test", "gtest", "boost_test", "exectest") COVERAGE_TABLE_CHUNKS = 20 COVERAGE_YT_PROXY = "hahn.yt.yandex.net" @@ -55,26 +55,26 @@ CORPUS_DATA_ROOT_DIR = 'fuzzing' CORPUS_DIR_NAME = 'corpus' FUZZING_COMPRESSION_COEF = 1.1 FUZZING_DEFAULT_TIMEOUT = 3600 -FUZZING_FINISHING_TIME = 600 +FUZZING_FINISHING_TIME = 600 FUZZING_TIMEOUT_RE = re.compile(r'(^|\s)-max_total_time=(?P<max_time>\d+)') GENERATED_CORPUS_DIR_NAME = 'mined_corpus' MAX_CORPUS_RESOURCES_ALLOWED = 5 -TEST_TOOL_HOST = 'TEST_TOOL_HOST_RESOURCE_GLOBAL' -TEST_TOOL_TARGET = 'TEST_TOOL_TARGET_RESOURCE_GLOBAL' -TEST_TOOL_HOST_LOCAL = 'TEST_TOOL_HOST_LOCAL' -TEST_TOOL_TARGET_LOCAL = 'TEST_TOOL_TARGET_LOCAL' -XCODE_TOOLS_RESOURCE = 'XCODE_TOOLS_ROOT_RESOURCE_GLOBAL' -GO_TOOLS_RESOURCE = 'GO_TOOLS_RESOURCE_GLOBAL' -LLVM_COV9_RESOURCE = 'LLVM_COV9_RESOURCE_GLOBAL' -PEP8_PY2_RESOURCE = 'PEP8_PY2_RESOURCE_GLOBAL' -PEP8_PY3_RESOURCE = 'PEP8_PY3_RESOURCE_GLOBAL' -FLAKES_PY2_RESOURCE = 'FLAKES_PY2_RESOURCE_GLOBAL' -FLAKES_PY3_RESOURCE = 'FLAKES_PY3_RESOURCE_GLOBAL' +TEST_TOOL_HOST = 'TEST_TOOL_HOST_RESOURCE_GLOBAL' +TEST_TOOL_TARGET = 'TEST_TOOL_TARGET_RESOURCE_GLOBAL' +TEST_TOOL_HOST_LOCAL = 'TEST_TOOL_HOST_LOCAL' +TEST_TOOL_TARGET_LOCAL = 'TEST_TOOL_TARGET_LOCAL' +XCODE_TOOLS_RESOURCE = 'XCODE_TOOLS_ROOT_RESOURCE_GLOBAL' +GO_TOOLS_RESOURCE = 'GO_TOOLS_RESOURCE_GLOBAL' +LLVM_COV9_RESOURCE = 'LLVM_COV9_RESOURCE_GLOBAL' +PEP8_PY2_RESOURCE = 'PEP8_PY2_RESOURCE_GLOBAL' +PEP8_PY3_RESOURCE = 'PEP8_PY3_RESOURCE_GLOBAL' +FLAKES_PY2_RESOURCE = 'FLAKES_PY2_RESOURCE_GLOBAL' +FLAKES_PY3_RESOURCE = 'FLAKES_PY3_RESOURCE_GLOBAL' FLAKE8_PY2_RESOURCE = 'FLAKE8_PY2_RESOURCE_GLOBAL' FLAKE8_PY3_RESOURCE = 'FLAKE8_PY3_RESOURCE_GLOBAL' - + class Enum(object): @classmethod @@ -82,134 +82,134 @@ class Enum(object): return [v for k, v in cls.__dict__.items() if not k.startswith("_")] -class TestRequirements(Enum): - Container = 'container' - Cpu = 'cpu' - DiskUsage = 'disk_usage' - Ram = 'ram' - RamDisk = 'ram_disk' - SbVault = 'sb_vault' - Network = 'network' - Dns = 'dns' - Kvm = 'kvm' - - -class TestRequirementsConstants(Enum): - All = 'all' - AllCpuValue = 50 - AllRamDiskValue = 50 - MinCpu = 1 - MinRam = 1 - MinRamDisk = 0 - - @classmethod - def is_all_cpu(cls, value): - return value == cls.All - - @classmethod - def get_cpu_value(cls, value): - return cls.AllCpuValue if cls.is_all_cpu(value) else value - - @classmethod - def is_all_ram_disk(cls, value): - return value == cls.All - - @classmethod - def get_ram_disk_value(cls, value): - return cls.AllRamDiskValue if cls.is_all_ram_disk(value) else value - - +class TestRequirements(Enum): + Container = 'container' + Cpu = 'cpu' + DiskUsage = 'disk_usage' + Ram = 'ram' + RamDisk = 'ram_disk' + SbVault = 'sb_vault' + Network = 'network' + Dns = 'dns' + Kvm = 'kvm' + + +class TestRequirementsConstants(Enum): + All = 'all' + AllCpuValue = 50 + AllRamDiskValue = 50 + MinCpu = 1 + MinRam = 1 + MinRamDisk = 0 + + @classmethod + def is_all_cpu(cls, value): + return value == cls.All + + @classmethod + def get_cpu_value(cls, value): + return cls.AllCpuValue if cls.is_all_cpu(value) else value + + @classmethod + def is_all_ram_disk(cls, value): + return value == cls.All + + @classmethod + def get_ram_disk_value(cls, value): + return cls.AllRamDiskValue if cls.is_all_ram_disk(value) else value + + class TestSize(Enum): Small = 'small' Medium = 'medium' Large = 'large' - DefaultTimeouts = { + DefaultTimeouts = { Small: 60, Medium: 600, Large: 3600, } - DefaultPriorities = { - Small: -1, - Medium: -2, - Large: -3, - } - - DefaultRequirements = { - Small: { - TestRequirements.Cpu: 1, - TestRequirements.Ram: 32, - # TestRequirements.Ram: 2, - TestRequirements.RamDisk: 0, - }, - Medium: { - TestRequirements.Cpu: 1, - TestRequirements.Ram: 32, - # TestRequirements.Ram: 4, - TestRequirements.RamDisk: 0, - }, - Large: { - TestRequirements.Cpu: 1, - TestRequirements.Ram: 32, - # TestRequirements.Ram: 8, - TestRequirements.RamDisk: 0, - }, - } - - MaxRequirements = { - Small: { - TestRequirements.Cpu: 4, - TestRequirements.Ram: 32, - # TestRequirements.Ram: 4, - TestRequirements.RamDisk: 4, - }, - Medium: { - TestRequirements.Cpu: 4, - # TestRequirements.Cpu: 8, - TestRequirements.Ram: 32, - # TestRequirements.Ram: 16, - TestRequirements.RamDisk: 4, - }, - Large: { + DefaultPriorities = { + Small: -1, + Medium: -2, + Large: -3, + } + + DefaultRequirements = { + Small: { + TestRequirements.Cpu: 1, + TestRequirements.Ram: 32, + # TestRequirements.Ram: 2, + TestRequirements.RamDisk: 0, + }, + Medium: { + TestRequirements.Cpu: 1, + TestRequirements.Ram: 32, + # TestRequirements.Ram: 4, + TestRequirements.RamDisk: 0, + }, + Large: { + TestRequirements.Cpu: 1, + TestRequirements.Ram: 32, + # TestRequirements.Ram: 8, + TestRequirements.RamDisk: 0, + }, + } + + MaxRequirements = { + Small: { + TestRequirements.Cpu: 4, + TestRequirements.Ram: 32, + # TestRequirements.Ram: 4, + TestRequirements.RamDisk: 4, + }, + Medium: { + TestRequirements.Cpu: 4, + # TestRequirements.Cpu: 8, + TestRequirements.Ram: 32, + # TestRequirements.Ram: 16, + TestRequirements.RamDisk: 4, + }, + Large: { TestRequirements.Cpu: 4, - TestRequirements.Ram: 32, - TestRequirements.RamDisk: 4, - }, - } - + TestRequirements.Ram: 32, + TestRequirements.RamDisk: 4, + }, + } + @classmethod def sizes(cls): - return cls.DefaultTimeouts.keys() + return cls.DefaultTimeouts.keys() @classmethod def get_default_timeout(cls, size): - if size in cls.DefaultTimeouts: - return cls.DefaultTimeouts[size] + if size in cls.DefaultTimeouts: + return cls.DefaultTimeouts[size] + raise Exception("Unknown test size '{}'".format(size)) + + @classmethod + def get_default_priorities(cls, size): + if size in cls.DefaultPriorities: + return cls.DefaultPriorities[size] + raise Exception("Unknown test size '{}'".format(size)) + + @classmethod + def get_default_requirements(cls, size): + if size in cls.DefaultRequirements: + return cls.DefaultRequirements[size] raise Exception("Unknown test size '{}'".format(size)) - @classmethod - def get_default_priorities(cls, size): - if size in cls.DefaultPriorities: - return cls.DefaultPriorities[size] - raise Exception("Unknown test size '{}'".format(size)) - - @classmethod - def get_default_requirements(cls, size): - if size in cls.DefaultRequirements: - return cls.DefaultRequirements[size] - raise Exception("Unknown test size '{}'".format(size)) - - @classmethod - def get_max_requirements(cls, size): - if size in cls.MaxRequirements: - return cls.MaxRequirements[size] - raise Exception("Unknown test size '{}'".format(size)) - - + @classmethod + def get_max_requirements(cls, size): + if size in cls.MaxRequirements: + return cls.MaxRequirements[size] + raise Exception("Unknown test size '{}'".format(size)) + + class TestRunExitCode(Enum): Skipped = 2 - Failed = 3 + Failed = 3 TimeOut = 10 InfrastructureError = 12 @@ -223,8 +223,8 @@ class YaTestTags(Enum): Fat = "ya:fat" RunWithAsserts = "ya:relwithdebinfo" Privileged = "ya:privileged" - ExoticPlatform = "ya:exotic_platform" - NotAutocheck = "ya:not_autocheck" + ExoticPlatform = "ya:exotic_platform" + NotAutocheck = "ya:not_autocheck" class Status(object): @@ -256,7 +256,7 @@ class _Colors(object): "white", "yellow", ] - _PREFIXES = ["", "light", "dark"] + _PREFIXES = ["", "light", "dark"] def __init__(self): self._table = {} diff --git a/build/plugins/_xsyn_includes.py b/build/plugins/_xsyn_includes.py index ce23222a93..8d33cea2f0 100644 --- a/build/plugins/_xsyn_includes.py +++ b/build/plugins/_xsyn_includes.py @@ -48,7 +48,7 @@ def process_xsyn(filepath, on_element): # keep a stack of filepathes if on_element calls process_xsyn recursively with open(filepath) as xsyn_file: - from xml.dom.minidom import parse + from xml.dom.minidom import parse tree = parse(xsyn_file) tree.normalize() res = traverse_xsyn(tree, on_element) diff --git a/build/plugins/build_mn_files.py b/build/plugins/build_mn_files.py index 207339ae24..4da76f1852 100644 --- a/build/plugins/build_mn_files.py +++ b/build/plugins/build_mn_files.py @@ -1,6 +1,6 @@ from os.path import basename, splitext - + def on_build_mns_files(unit, *args): files = [] name = '' diff --git a/build/plugins/cp.py b/build/plugins/cp.py index 7341204cff..5c663a3bdd 100644 --- a/build/plugins/cp.py +++ b/build/plugins/cp.py @@ -4,12 +4,12 @@ from _common import sort_by_keywords def oncopy(unit, *args): - keywords = {'RESULT': 1, 'KEEP_DIR_STRUCT': 0, 'DESTINATION': 1, 'FROM': 1} + keywords = {'RESULT': 1, 'KEEP_DIR_STRUCT': 0, 'DESTINATION': 1, 'FROM': 1} flat_args, spec_args = sort_by_keywords(keywords, args) dest_dir = spec_args['DESTINATION'][0] if 'DESTINATION' in spec_args else '' - from_dir = spec_args['FROM'][0] if 'FROM' in spec_args else '' + from_dir = spec_args['FROM'][0] if 'FROM' in spec_args else '' keep_struct = 'KEEP_DIR_STRUCT' in spec_args save_in_var = 'RESULT' in spec_args targets = [] @@ -21,10 +21,10 @@ def oncopy(unit, *args): if keep_struct: if path_list[:-1]: rel_path = os.path.join(*path_list[:-1]) - source_path = os.path.join(from_dir, rel_path, filename) - target_path = os.path.join(dest_dir, rel_path, filename) + source_path = os.path.join(from_dir, rel_path, filename) + target_path = os.path.join(dest_dir, rel_path, filename) if save_in_var: - targets.append(target_path) - unit.oncopy_file([source_path, target_path]) + targets.append(target_path) + unit.oncopy_file([source_path, target_path]) if save_in_var: unit.set([spec_args["RESULT"][0], " ".join(targets)]) diff --git a/build/plugins/create_init_py.py b/build/plugins/create_init_py.py index 90d61c4c25..e41a4d22df 100644 --- a/build/plugins/create_init_py.py +++ b/build/plugins/create_init_py.py @@ -3,13 +3,13 @@ import os from _common import sort_by_keywords -def oncreate_init_py_structure(unit, *args): +def oncreate_init_py_structure(unit, *args): if unit.get('DISTBUILD'): return - target_dir = unit.get('PY_PROTOS_FOR_DIR') - path_list = target_dir.split(os.path.sep)[1:] - inits = [os.path.join("${ARCADIA_BUILD_ROOT}", '__init__.py')] - for i in range(1, len(path_list) + 1): - inits.append(os.path.join("${ARCADIA_BUILD_ROOT}", os.path.join(*path_list[0:i]), '__init__.py')) - unit.ontouch(inits) + target_dir = unit.get('PY_PROTOS_FOR_DIR') + path_list = target_dir.split(os.path.sep)[1:] + inits = [os.path.join("${ARCADIA_BUILD_ROOT}", '__init__.py')] + for i in range(1, len(path_list) + 1): + inits.append(os.path.join("${ARCADIA_BUILD_ROOT}", os.path.join(*path_list[0:i]), '__init__.py')) + unit.ontouch(inits) diff --git a/build/plugins/lib/_metric_resolvers.py b/build/plugins/lib/_metric_resolvers.py index 7c5ea4a9ea..270eb78345 100644 --- a/build/plugins/lib/_metric_resolvers.py +++ b/build/plugins/lib/_metric_resolvers.py @@ -1,11 +1,11 @@ -import re - -VALUE_PATTERN = re.compile(r"^\s*(?P<value>\d+)\s*$") - - -def resolve_value(val): - match = VALUE_PATTERN.match(val) - if not match: - return None - val = match.group('value') - return int(val) +import re + +VALUE_PATTERN = re.compile(r"^\s*(?P<value>\d+)\s*$") + + +def resolve_value(val): + match = VALUE_PATTERN.match(val) + if not match: + return None + val = match.group('value') + return int(val) diff --git a/build/plugins/print_module_type.py b/build/plugins/print_module_type.py index 723970609d..cc54c55675 100644 --- a/build/plugins/print_module_type.py +++ b/build/plugins/print_module_type.py @@ -1,5 +1,5 @@ def onprint_module_type(unit, *args): filepath = unit.get('KIWI_OUT_FILE') - if len(args) >= 2 and filepath is not None: + if len(args) >= 2 and filepath is not None: with open(filepath, "a") as file_handler: print >>file_handler, "{0} {1} {2}".format(args[0], args[1], unit.path()) diff --git a/build/plugins/pybuild.py b/build/plugins/pybuild.py index 5639da6fb0..f32a2d39a0 100644 --- a/build/plugins/pybuild.py +++ b/build/plugins/pybuild.py @@ -48,10 +48,10 @@ def proto_arg(path, mod, unit): def pb_cc_arg(suf, path, unit): return '{}{suf}'.format(stripext(to_build_root(path, unit)), suf=suf) - -def ev_cc_arg(path, unit): - return '{}.ev.pb.cc'.format(stripext(to_build_root(path, unit))) - + +def ev_cc_arg(path, unit): + return '{}.ev.pb.cc'.format(stripext(to_build_root(path, unit))) + def ev_arg(path, mod, unit): return '{}__int___ev_pb2.py={}_ev_pb2'.format(stripext(to_build_root(path, unit)), mod) @@ -301,9 +301,9 @@ def onpy_srcs(unit, *args): else: if arg.startswith('../'): ymake.report_configure_error('PY_SRCS item starts with "../": {!r}'.format(arg)) - if arg.startswith('/'): - ymake.report_configure_error('PY_SRCS item starts with "/": {!r}'.format(arg)) - continue + if arg.startswith('/'): + ymake.report_configure_error('PY_SRCS item starts with "/": {!r}'.format(arg)) + continue mod_name = stripext(arg).replace('/', '.') if py3 and path.endswith('.py') and is_extended_source_search_enabled(path, unit): # Dig out real path from the file path. Unit.path is not enough because of SRCDIR and ADDINCL @@ -499,7 +499,7 @@ def onpy_srcs(unit, *args): unit.onpeerdir(unit.get("PY_PROTO_DEPS").split()) - proto_paths = [path for path, mod in protos] + proto_paths = [path for path, mod in protos] unit.on_generate_py_protos_internal(proto_paths) unit.onpy_srcs([ pb2_arg(py_suf, path, mod, unit) diff --git a/build/plugins/split_codegen.py b/build/plugins/split_codegen.py index 03c534c834..f1e60bc142 100644 --- a/build/plugins/split_codegen.py +++ b/build/plugins/split_codegen.py @@ -4,7 +4,7 @@ from _common import sort_by_keywords _DEFAULT_CPP_PARTS = 20 # See TCodegenParams::MethodStream usage in factor codegen _ADDITIONAL_STREAM_COUNT = 5 - + def onsplit_codegen(unit, *args): ''' diff --git a/build/plugins/swig.py b/build/plugins/swig.py index 6dd30a1ff2..32a37204a6 100644 --- a/build/plugins/swig.py +++ b/build/plugins/swig.py @@ -49,7 +49,7 @@ class Swig(iw.CustomCommand): self._library_dir ] self._incl_dirs = ['$S', '$B'] + [posixpath.join('$S', d) for d in incl_dirs] - + modname = unit.get('REALPRJNAME') self._flags.extend(['-module', modname]) diff --git a/build/plugins/tests/test_common.py b/build/plugins/tests/test_common.py index 6490b6d7c4..e1780354f8 100644 --- a/build/plugins/tests/test_common.py +++ b/build/plugins/tests/test_common.py @@ -1,49 +1,49 @@ -import pytest - -import build.plugins._common as pc - - -def test_sort_by_keywords(): - keywords = {'KEY1': 2, 'KEY2': 0, 'KEY3': 1} - args = 'aaaa bbbb KEY2 KEY1 kkk10 kkk11 ccc ddd KEY3 kkk3 eee'.split() - flat, spec = pc.sort_by_keywords(keywords, args) - assert flat == ['aaaa', 'bbbb', 'ccc', 'ddd', 'eee'] - assert spec == {'KEY1': ['kkk10', 'kkk11'], 'KEY2': True, 'KEY3': ['kkk3']} - - keywords = {'KEY1': 0, 'KEY2': 4} - args = 'aaaa KEY2 eee'.split() - flat, spec = pc.sort_by_keywords(keywords, args) - assert flat == ['aaaa'] - assert spec == {'KEY2': ['eee']} - - keywords = {'KEY1': 2, 'KEY2': 2} - args = 'KEY1 k10 KEY2 k20 KEY1 k11 KEY2 k21 KEY1 k13'.split() - flat, spec = pc.sort_by_keywords(keywords, args) - assert flat == [] - assert spec == {'KEY1': ['k10', 'k11', 'k13'], 'KEY2': ['k20', 'k21']} - - -def test_filter_out_by_keyword(): - assert pc.filter_out_by_keyword([], 'A') == [] - assert pc.filter_out_by_keyword(['x'], 'A') == ['x'] - assert pc.filter_out_by_keyword(['x', 'A'], 'A') == ['x'] - assert pc.filter_out_by_keyword(['x', 'A', 'B'], 'A') == ['x'] - assert pc.filter_out_by_keyword(['x', 'A', 'B', 'y'], 'A') == ['x', 'y'] - assert pc.filter_out_by_keyword(['x', 'A', 'A', 'y'], 'A') == ['x', 'y'] - assert pc.filter_out_by_keyword(['x', 'A', 'A', 'A'], 'A') == ['x'] - 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 +import pytest + +import build.plugins._common as pc + + +def test_sort_by_keywords(): + keywords = {'KEY1': 2, 'KEY2': 0, 'KEY3': 1} + args = 'aaaa bbbb KEY2 KEY1 kkk10 kkk11 ccc ddd KEY3 kkk3 eee'.split() + flat, spec = pc.sort_by_keywords(keywords, args) + assert flat == ['aaaa', 'bbbb', 'ccc', 'ddd', 'eee'] + assert spec == {'KEY1': ['kkk10', 'kkk11'], 'KEY2': True, 'KEY3': ['kkk3']} + + keywords = {'KEY1': 0, 'KEY2': 4} + args = 'aaaa KEY2 eee'.split() + flat, spec = pc.sort_by_keywords(keywords, args) + assert flat == ['aaaa'] + assert spec == {'KEY2': ['eee']} + + keywords = {'KEY1': 2, 'KEY2': 2} + args = 'KEY1 k10 KEY2 k20 KEY1 k11 KEY2 k21 KEY1 k13'.split() + flat, spec = pc.sort_by_keywords(keywords, args) + assert flat == [] + assert spec == {'KEY1': ['k10', 'k11', 'k13'], 'KEY2': ['k20', 'k21']} + + +def test_filter_out_by_keyword(): + assert pc.filter_out_by_keyword([], 'A') == [] + assert pc.filter_out_by_keyword(['x'], 'A') == ['x'] + assert pc.filter_out_by_keyword(['x', 'A'], 'A') == ['x'] + assert pc.filter_out_by_keyword(['x', 'A', 'B'], 'A') == ['x'] + assert pc.filter_out_by_keyword(['x', 'A', 'B', 'y'], 'A') == ['x', 'y'] + assert pc.filter_out_by_keyword(['x', 'A', 'A', 'y'], 'A') == ['x', 'y'] + assert pc.filter_out_by_keyword(['x', 'A', 'A', 'A'], 'A') == ['x'] + 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 diff --git a/build/plugins/tests/test_requirements.py b/build/plugins/tests/test_requirements.py index 4cc913ec15..24d57ac901 100644 --- a/build/plugins/tests/test_requirements.py +++ b/build/plugins/tests/test_requirements.py @@ -1,52 +1,52 @@ -import pytest - -import build.plugins._requirements as requirements -import build.plugins._test_const as consts - - -class TestRequirements(object): - @pytest.mark.parametrize('test_size', consts.TestSize.sizes()) - def test_cpu(self, test_size): - max_cpu = consts.TestSize.get_max_requirements(test_size).get(consts.TestRequirements.Cpu) - min_cpu = consts.TestRequirementsConstants.MinCpu - assert requirements.check_cpu(-1, test_size) - assert requirements.check_cpu(min_cpu - 1, test_size) - assert requirements.check_cpu("unknown", test_size) - assert not requirements.check_cpu(1, test_size) - assert not requirements.check_cpu(3, test_size) - assert requirements.check_cpu(1000, test_size) - if max_cpu != consts.TestRequirementsConstants.All: - assert requirements.check_cpu(max_cpu + 1, test_size) - assert requirements.check_cpu(max_cpu + 4, test_size) - assert requirements.check_cpu(consts.TestRequirementsConstants.All, test_size) - else: - assert not requirements.check_cpu(consts.TestRequirementsConstants.All, test_size) - - @pytest.mark.parametrize('test_size', consts.TestSize.sizes()) - def test_ram(self, test_size): - max_ram = consts.TestSize.get_max_requirements(test_size).get(consts.TestRequirements.Ram) - min_ram = consts.TestRequirementsConstants.MinRam - assert requirements.check_ram(-1, test_size) - assert requirements.check_ram(min_ram - 1, test_size) - assert requirements.check_ram(max_ram + 1, test_size) - assert not requirements.check_ram(1, test_size) - assert not requirements.check_ram(4, test_size) - assert not requirements.check_ram(5, test_size) +import pytest + +import build.plugins._requirements as requirements +import build.plugins._test_const as consts + + +class TestRequirements(object): + @pytest.mark.parametrize('test_size', consts.TestSize.sizes()) + def test_cpu(self, test_size): + max_cpu = consts.TestSize.get_max_requirements(test_size).get(consts.TestRequirements.Cpu) + min_cpu = consts.TestRequirementsConstants.MinCpu + assert requirements.check_cpu(-1, test_size) + assert requirements.check_cpu(min_cpu - 1, test_size) + assert requirements.check_cpu("unknown", test_size) + assert not requirements.check_cpu(1, test_size) + assert not requirements.check_cpu(3, test_size) + assert requirements.check_cpu(1000, test_size) + if max_cpu != consts.TestRequirementsConstants.All: + assert requirements.check_cpu(max_cpu + 1, test_size) + assert requirements.check_cpu(max_cpu + 4, test_size) + assert requirements.check_cpu(consts.TestRequirementsConstants.All, test_size) + else: + assert not requirements.check_cpu(consts.TestRequirementsConstants.All, test_size) + + @pytest.mark.parametrize('test_size', consts.TestSize.sizes()) + def test_ram(self, test_size): + max_ram = consts.TestSize.get_max_requirements(test_size).get(consts.TestRequirements.Ram) + min_ram = consts.TestRequirementsConstants.MinRam + assert requirements.check_ram(-1, test_size) + assert requirements.check_ram(min_ram - 1, test_size) + assert requirements.check_ram(max_ram + 1, test_size) + assert not requirements.check_ram(1, test_size) + assert not requirements.check_ram(4, test_size) + assert not requirements.check_ram(5, test_size) assert not requirements.check_ram(32, consts.TestSize.Large) - assert requirements.check_ram(48, consts.TestSize.Large) - - assert not requirements.check_ram(1, test_size, is_kvm=True) - assert not requirements.check_ram(4, test_size, is_kvm=True) - assert not requirements.check_ram(16, test_size, is_kvm=True) - assert requirements.check_ram(32, test_size, is_kvm=True) - - @pytest.mark.parametrize('test_size', consts.TestSize.sizes()) - def test_ram_disk(self, test_size): - max_ram_disk = consts.TestSize.get_max_requirements(test_size).get(consts.TestRequirements.RamDisk) - min_ram_disk = consts.TestRequirementsConstants.MinRamDisk - assert requirements.check_ram_disk(-1, test_size) - assert requirements.check_ram_disk(min_ram_disk - 1, test_size) - assert requirements.check_ram_disk(max_ram_disk + 1, test_size) - assert requirements.check_ram_disk(8, test_size) - assert not requirements.check_ram_disk(1, test_size) - assert not requirements.check_ram_disk(4, test_size) + assert requirements.check_ram(48, consts.TestSize.Large) + + assert not requirements.check_ram(1, test_size, is_kvm=True) + assert not requirements.check_ram(4, test_size, is_kvm=True) + assert not requirements.check_ram(16, test_size, is_kvm=True) + assert requirements.check_ram(32, test_size, is_kvm=True) + + @pytest.mark.parametrize('test_size', consts.TestSize.sizes()) + def test_ram_disk(self, test_size): + max_ram_disk = consts.TestSize.get_max_requirements(test_size).get(consts.TestRequirements.RamDisk) + min_ram_disk = consts.TestRequirementsConstants.MinRamDisk + assert requirements.check_ram_disk(-1, test_size) + assert requirements.check_ram_disk(min_ram_disk - 1, test_size) + assert requirements.check_ram_disk(max_ram_disk + 1, test_size) + assert requirements.check_ram_disk(8, test_size) + assert not requirements.check_ram_disk(1, test_size) + assert not requirements.check_ram_disk(4, test_size) diff --git a/build/plugins/tests/ya.make b/build/plugins/tests/ya.make index d42a278fe6..87228b98df 100644 --- a/build/plugins/tests/ya.make +++ b/build/plugins/tests/ya.make @@ -1,16 +1,16 @@ PY2TEST() - -OWNER(g:yatool) - -PEERDIR( - build/plugins -) - -TEST_SRCS( + +OWNER(g:yatool) + +PEERDIR( + build/plugins +) + +TEST_SRCS( test_code_generator.py - test_common.py - test_requirements.py + test_common.py + test_requirements.py test_ssqls.py -) - -END() +) + +END() diff --git a/build/plugins/ya.make b/build/plugins/ya.make index 106476752d..4ad5f5988e 100644 --- a/build/plugins/ya.make +++ b/build/plugins/ya.make @@ -2,22 +2,22 @@ OWNER(g:ymake) PY2_LIBRARY() -PY_SRCS( +PY_SRCS( code_generator.py ssqls.py swig.py - + _common.py - _custom_command.py - _import_wrapper.py - _requirements.py - _test_const.py + _custom_command.py + _import_wrapper.py + _requirements.py + _test_const.py ) PEERDIR(build/plugins/lib) END() - -RECURSE( - tests -) + +RECURSE( + tests +) diff --git a/build/plugins/yql_python_udf.py b/build/plugins/yql_python_udf.py index d47cb2e793..c4f949d8a9 100644 --- a/build/plugins/yql_python_udf.py +++ b/build/plugins/yql_python_udf.py @@ -37,10 +37,10 @@ def onregister_yql_python_udf(unit, *args): else: flavor = 'System' - output_includes = [ - 'yql/udfs/common/python/python_udf/python_udf.h', + output_includes = [ + 'yql/udfs/common/python/python_udf/python_udf.h', 'ydb/library/yql/public/udf/udf_registrator.h', - ] + ] if add_libra_modules: output_includes.append('yql/udfs/quality/libra/module/module.h') @@ -50,6 +50,6 @@ def onregister_yql_python_udf(unit, *args): 'build/scripts/gen_yql_python_udf.py', flavor, name, resource_name, path, libra_flag, 'OUT', path, - 'OUTPUT_INCLUDES', - ] + output_includes - ) + 'OUTPUT_INCLUDES', + ] + output_includes + ) diff --git a/build/plugins/ytest.py b/build/plugins/ytest.py index 228474b002..8970837f0f 100644 --- a/build/plugins/ytest.py +++ b/build/plugins/ytest.py @@ -2,13 +2,13 @@ import os import re import sys import json -import copy +import copy import base64 import shlex import _common import lib._metric_resolvers as mr -import _test_const as consts -import _requirements as reqs +import _test_const as consts +import _requirements as reqs import StringIO import subprocess import collections @@ -25,7 +25,7 @@ CANON_MDS_RESOURCE_REGEX = re.compile(re.escape(MDS_URI_PREFIX) + r'(.*?)($|#)') CANON_SB_VAULT_REGEX = re.compile(r"\w+=(value|file):[-\w]+:\w+") CANON_SBR_RESOURCE_REGEX = re.compile(r'(sbr:/?/?(\d+))') -VALID_NETWORK_REQUIREMENTS = ("full", "restricted") +VALID_NETWORK_REQUIREMENTS = ("full", "restricted") VALID_DNS_REQUIREMENTS = ("default", "local", "dns64") BLOCK_SEPARATOR = '=============================================================' SPLIT_FACTOR_MAX_VALUE = 1000 @@ -92,10 +92,10 @@ def validate_force_sandbox_requirement(name, value, test_size, is_force_sandbox, error_msg = validate_numerical_requirement(name, value) if error_msg: return error_msg - return check_func(mr.resolve_value(value), test_size, is_kvm) + return check_func(mr.resolve_value(value), test_size, is_kvm) -# TODO: Remove is_kvm param when there will be guarantees on RAM +# TODO: Remove is_kvm param when there will be guarantees on RAM def validate_requirement(req_name, value, test_size, is_force_sandbox, in_autocheck, is_fuzzing, is_kvm, is_ytexec_run): req_checks = { 'container': validate_numerical_requirement, @@ -125,26 +125,26 @@ def validate_test(unit, kw): def get_list(key): return deserialize_list(kw.get(key, "")) - valid_kw = copy.deepcopy(kw) + valid_kw = copy.deepcopy(kw) errors = [] warnings = [] - if valid_kw.get('SCRIPT-REL-PATH') == 'boost.test': - project_path = valid_kw.get('BUILD-FOLDER-PATH', "") + 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")): errors.append("BOOSTTEST is not allowed here") - elif valid_kw.get('SCRIPT-REL-PATH') == 'gtest': - project_path = valid_kw.get('BUILD-FOLDER-PATH', "") + elif valid_kw.get('SCRIPT-REL-PATH') == 'gtest': + project_path = valid_kw.get('BUILD-FOLDER-PATH', "") if not project_path.startswith(("contrib", "devtools", "mail", "mds", "taxi")): errors.append("GTEST_UGLY is not allowed here, use GTEST instead") - size_timeout = collections.OrderedDict(sorted(consts.TestSize.DefaultTimeouts.items(), key=lambda t: t[1])) + size_timeout = collections.OrderedDict(sorted(consts.TestSize.DefaultTimeouts.items(), key=lambda t: t[1])) - size = valid_kw.get('SIZE', consts.TestSize.Small).lower() - # TODO: use set instead list + size = valid_kw.get('SIZE', consts.TestSize.Small).lower() + # TODO: use set instead list tags = get_list("TAG") requirements_orig = get_list("REQUIREMENTS") - in_autocheck = "ya:not_autocheck" not in tags and 'ya:manual' not in tags + in_autocheck = "ya:not_autocheck" not in tags and 'ya:manual' not in tags is_fat = 'ya:fat' in tags is_force_sandbox = 'ya:force_distbuild' not in tags and is_fat is_ytexec_run = 'ya:yt' in tags @@ -153,10 +153,10 @@ def validate_test(unit, kw): requirements = {} list_requirements = ('sb_vault') for req in requirements_orig: - if req in ('kvm', ): - requirements[req] = str(True) - continue - + if req in ('kvm', ): + requirements[req] = str(True) + continue + if ":" in req: req_name, req_value = req.split(":", 1) if req_name in list_requirements: @@ -169,7 +169,7 @@ def validate_test(unit, kw): elif requirements[req_name] != req_value: warnings.append("Requirement [[imp]]{}[[rst]] is redefined [[imp]]{}[[rst]] -> [[imp]]{}[[rst]]".format(req_name, requirements[req_name], req_value)) requirements[req_name] = req_value - else: + else: requirements[req_name] = req_value else: errors.append("Invalid requirement syntax [[imp]]{}[[rst]]: expect <requirement>:<value>".format(req)) @@ -180,14 +180,14 @@ def validate_test(unit, kw): if error_msg: errors += [error_msg] - invalid_requirements_for_distbuild = [requirement for requirement in requirements.keys() if requirement not in ('ram', 'ram_disk', 'cpu', 'network')] + invalid_requirements_for_distbuild = [requirement for requirement in requirements.keys() if requirement not in ('ram', 'ram_disk', 'cpu', 'network')] sb_tags = [tag for tag in tags if tag.startswith('sb:')] - - if is_fat: + + if is_fat: if size != consts.TestSize.Large: errors.append("Only LARGE test may have ya:fat tag") - if in_autocheck and not is_force_sandbox: + if in_autocheck and not is_force_sandbox: if invalid_requirements_for_distbuild: errors.append("'{}' REQUIREMENTS options can be used only for FAT tests without ya:force_distbuild tag. Remove TAG(ya:force_distbuild) or an option.".format(invalid_requirements_for_distbuild)) if sb_tags: @@ -195,7 +195,7 @@ def validate_test(unit, kw): if 'ya:sandbox_coverage' in tags: errors.append("You can set 'ya:sandbox_coverage' tag only for FAT tests without ya:force_distbuild.") else: - if is_force_sandbox: + if is_force_sandbox: errors.append('ya:force_sandbox can be used with LARGE tests only') if 'ya:nofuse' in tags: errors.append('ya:nofuse can be used with LARGE tests only') @@ -203,15 +203,15 @@ def validate_test(unit, kw): errors.append("ya:privileged can be used with LARGE tests only") if in_autocheck and size == consts.TestSize.Large: errors.append("LARGE test must have ya:fat tag") - - if 'ya:privileged' in tags and 'container' not in requirements: - errors.append("Only tests with 'container' requirement can have 'ya:privileged' tag") - + + if 'ya:privileged' in tags and 'container' not in requirements: + errors.append("Only tests with 'container' requirement can have 'ya:privileged' tag") + if size not in size_timeout: - errors.append("Unknown test size: [[imp]]{}[[rst]], choose from [[imp]]{}[[rst]]".format(size.upper(), ", ".join([sz.upper() for sz in size_timeout.keys()]))) + errors.append("Unknown test size: [[imp]]{}[[rst]], choose from [[imp]]{}[[rst]]".format(size.upper(), ", ".join([sz.upper() for sz in size_timeout.keys()]))) else: try: - timeout = int(valid_kw.get('TEST-TIMEOUT', size_timeout[size]) or size_timeout[size]) + timeout = int(valid_kw.get('TEST-TIMEOUT', size_timeout[size]) or size_timeout[size]) script_rel_path = valid_kw.get('SCRIPT-REL-PATH') if timeout < 0: raise Exception("Timeout must be > 0") @@ -223,19 +223,19 @@ def validate_test(unit, kw): break if suggested_size: - suggested_size = ", suggested size: [[imp]]{}[[rst]]".format(suggested_size.upper()) + suggested_size = ", suggested size: [[imp]]{}[[rst]]".format(suggested_size.upper()) else: suggested_size = "" - errors.append("Max allowed timeout for test size [[imp]]{}[[rst]] is [[imp]]{} sec[[rst]]{}".format(size.upper(), size_timeout[size], suggested_size)) + errors.append("Max allowed timeout for test size [[imp]]{}[[rst]] is [[imp]]{} sec[[rst]]{}".format(size.upper(), size_timeout[size], suggested_size)) except Exception as e: errors.append("Error when parsing test timeout: [[bad]]{}[[rst]]".format(e)) - requiremtens_list = [] - for req_name, req_value in requirements.iteritems(): - requiremtens_list.append(req_name + ":" + req_value) - valid_kw['REQUIREMENTS'] = serialize_list(requiremtens_list) - - if valid_kw.get("FUZZ-OPTS"): + requiremtens_list = [] + for req_name, req_value in requirements.iteritems(): + requiremtens_list.append(req_name + ":" + req_value) + valid_kw['REQUIREMENTS'] = serialize_list(requiremtens_list) + + if valid_kw.get("FUZZ-OPTS"): for option in get_list("FUZZ-OPTS"): if not option.startswith("-"): errors.append("Unrecognized fuzzer option '[[imp]]{}[[rst]]'. All fuzzer options should start with '-'".format(option)) @@ -264,20 +264,20 @@ def validate_test(unit, kw): tags.append("ya:external") tags.append("ya:yt_research_pool") - if valid_kw.get("USE_ARCADIA_PYTHON") == "yes" and valid_kw.get("SCRIPT-REL-PATH") == "py.test": + if valid_kw.get("USE_ARCADIA_PYTHON") == "yes" and valid_kw.get("SCRIPT-REL-PATH") == "py.test": errors.append("PYTEST_SCRIPT is deprecated") partition = valid_kw.get('TEST_PARTITION', 'SEQUENTIAL') if partition not in PARTITION_MODS: raise ValueError('partition mode should be one of {}, detected: {}'.format(PARTITION_MODS, partition)) - if valid_kw.get('SPLIT-FACTOR'): - if valid_kw.get('FORK-MODE') == 'none': + if valid_kw.get('SPLIT-FACTOR'): + if valid_kw.get('FORK-MODE') == 'none': errors.append('SPLIT_FACTOR must be use with FORK_TESTS() or FORK_SUBTESTS() macro') value = 1 try: - value = int(valid_kw.get('SPLIT-FACTOR')) + value = int(valid_kw.get('SPLIT-FACTOR')) if value <= 0: raise ValueError("must be > 0") if value > SPLIT_FACTOR_MAX_VALUE: @@ -305,7 +305,7 @@ def validate_test(unit, kw): return valid_kw, warnings, errors - + def get_norm_unit_path(unit, extra=None): path = _common.strip_roots(unit.path()) if extra: @@ -319,10 +319,10 @@ def dump_test(unit, kw): unit.message(['warn', w]) for e in errors: ymake.report_configure_error(e) - if valid_kw is None: + if valid_kw is None: return None string_handler = StringIO.StringIO() - for k, v in valid_kw.iteritems(): + for k, v in valid_kw.iteritems(): print >>string_handler, k + ': ' + v print >>string_handler, BLOCK_SEPARATOR data = string_handler.getvalue() @@ -515,8 +515,8 @@ def onadd_ytest(unit, *args): if flat_args[1] == 'fuzz.test' and unit.get('FUZZING') == 'yes': test_record['FUZZING'] = '1' - # use all cores if fuzzing requested - test_record['REQUIREMENTS'] = serialize_list(filter(None, deserialize_list(test_record['REQUIREMENTS']) + ["cpu:all", "ram:all"])) + # use all cores if fuzzing requested + test_record['REQUIREMENTS'] = serialize_list(filter(None, deserialize_list(test_record['REQUIREMENTS']) + ["cpu:all", "ram:all"])) data = dump_test(unit, test_record) if data: @@ -548,7 +548,7 @@ def onadd_check(unit, *args): # graph changed for clang_tidy tests return flat_args, spec_args = _common.sort_by_keywords({"DEPENDS": -1, "TIMEOUT": 1, "DATA": -1, "TAG": -1, "REQUIREMENTS": -1, "FORK_MODE": 1, - "SPLIT_FACTOR": 1, "FORK_SUBTESTS": 0, "FORK_TESTS": 0, "SIZE": 1}, args) + "SPLIT_FACTOR": 1, "FORK_SUBTESTS": 0, "FORK_TESTS": 0, "SIZE": 1}, args) check_type = flat_args[0] test_dir = get_norm_unit_path(unit) diff --git a/build/scripts/_fake_src.cpp b/build/scripts/_fake_src.cpp index d99bfa2e4a..139597f9cb 100644 --- a/build/scripts/_fake_src.cpp +++ b/build/scripts/_fake_src.cpp @@ -1,2 +1,2 @@ - - + + diff --git a/build/scripts/build_mn.py b/build/scripts/build_mn.py index f09d935783..5bb03c247c 100755 --- a/build/scripts/build_mn.py +++ b/build/scripts/build_mn.py @@ -1,12 +1,12 @@ -#!/usr/bin/env python -# Ymake MatrixNet support - -import sys -import os -import shutil -import re +#!/usr/bin/env python +# Ymake MatrixNet support + +import sys +import os +import shutil +import re import subprocess - + def get_value(val): dct = val.split('=', 1) @@ -15,41 +15,41 @@ def get_value(val): return '' -class BuildMnBase(object): +class BuildMnBase(object): def Run(self, mninfo, mnname, mnrankingSuffix, mncppPath, check=False, ptr=False, multi=False): - self.mninfo = mninfo - self.mnname = mnname + self.mninfo = mninfo + self.mnname = mnname self.mnrankingSuffix = mnrankingSuffix - self.mncppPath = mncppPath - self.check = check - self.ptr = ptr - self.multi = multi + self.mncppPath = mncppPath + self.check = check + self.ptr = ptr + self.multi = multi dataprefix = "MN_External_" mninfoName = os.path.basename(self.mninfo) data = dataprefix + mnname datasize = data + "Size" - - if self.multi: - if self.ptr: - mntype = "const NMatrixnet::TMnMultiCategPtr" - mnload = "(new NMatrixnet::TMnMultiCateg( {1}, {2}, \"{0}\"))".format(mninfoName, data, datasize) - else: - mntype = "const NMatrixnet::TMnMultiCateg" - mnload = "({1}, {2}, \"{0}\")".format(mninfoName, data, datasize) - else: - if self.ptr: - mntype = "const NMatrixnet::TMnSsePtr" + + if self.multi: + if self.ptr: + mntype = "const NMatrixnet::TMnMultiCategPtr" + mnload = "(new NMatrixnet::TMnMultiCateg( {1}, {2}, \"{0}\"))".format(mninfoName, data, datasize) + else: + mntype = "const NMatrixnet::TMnMultiCateg" + mnload = "({1}, {2}, \"{0}\")".format(mninfoName, data, datasize) + else: + if self.ptr: + mntype = "const NMatrixnet::TMnSsePtr" mnload = "(new NMatrixnet::TMnSseInfo({1}, {2}, \"{0}\"))".format(mninfoName, data, datasize) - else: - mntype = "const NMatrixnet::TMnSseInfo" + else: + mntype = "const NMatrixnet::TMnSseInfo" mnload = "({1}, {2}, \"{0}\")".format(mninfoName, data, datasize) - - if self.check: - self.CheckMn() - - mncpptmpPath = self.mncppPath + ".tmp" - mncpptmp = open(mncpptmpPath, 'w') - + + if self.check: + self.CheckMn() + + mncpptmpPath = self.mncppPath + ".tmp" + mncpptmp = open(mncpptmpPath, 'w') + if self.multi: mncpptmp.write("#include <kernel/matrixnet/mn_multi_categ.h>\n") else: @@ -62,269 +62,269 @@ class BuildMnBase(object): mncpptmp.write(" extern const ui32 {1}{0}Size;\n".format(self.mnname, dataprefix)) mncpptmp.write(" }\n") mncpptmp.write("}\n") - archiverCall = subprocess.Popen([self.archiver, "-q", "-p", "-o", rodatapath, self.mninfo], stdout=None, stderr=subprocess.PIPE) + archiverCall = subprocess.Popen([self.archiver, "-q", "-p", "-o", rodatapath, self.mninfo], stdout=None, stderr=subprocess.PIPE) archiverCall.wait() - mncpptmp.write("extern {0} {1};\n".format(mntype, self.mnname)) - mncpptmp.write("{0} {1}{2};".format(mntype, self.mnname, mnload)) - mncpptmp.close() - shutil.move(mncpptmpPath, self.mncppPath) - - def CheckMn(self): - if not self.fml_unused_tool: - print >>sys.stderr, "fml_unused_tool undefined!" - failed_msg = "fml_unused_tool failed: {0} -A {1} -e -r {2}".format(self.fml_unused_tool, self.SrcRoot, self.mninfo) - assert not subprocess.call([self.fml_unused_tool, "-A", self.SrcRoot, "-e", "-r", self.mninfo]), failed_msg - - -class BuildMn(BuildMnBase): - def Run(self, argv): + mncpptmp.write("extern {0} {1};\n".format(mntype, self.mnname)) + mncpptmp.write("{0} {1}{2};".format(mntype, self.mnname, mnload)) + mncpptmp.close() + shutil.move(mncpptmpPath, self.mncppPath) + + def CheckMn(self): + if not self.fml_unused_tool: + print >>sys.stderr, "fml_unused_tool undefined!" + failed_msg = "fml_unused_tool failed: {0} -A {1} -e -r {2}".format(self.fml_unused_tool, self.SrcRoot, self.mninfo) + assert not subprocess.call([self.fml_unused_tool, "-A", self.SrcRoot, "-e", "-r", self.mninfo]), failed_msg + + +class BuildMn(BuildMnBase): + def Run(self, argv): if len(argv) < 6: print >>sys.stderr, "BuildMn.Run(<ARCADIA_ROOT> <archiver> <mninfo> <mnname> <mnrankingSuffix> <cppOutput> [params...])" - sys.exit(1) - - self.SrcRoot = argv[0] - self.archiver = argv[1] - + sys.exit(1) + + self.SrcRoot = argv[0] + self.archiver = argv[1] + mninfo = argv[2] mnname = argv[3] mnrankingSuffix = argv[4] mncppPath = argv[5] - check = False - ptr = False - multi = False + check = False + ptr = False + multi = False self.fml_unused_tool = '' for param in argv[6:]: - if param == "CHECK": - check = True - elif param == "PTR": - ptr = True - elif param == "MULTI": - multi = True + if param == "CHECK": + check = True + elif param == "PTR": + ptr = True + elif param == "MULTI": + multi = True elif param.startswith('fml_tool='): self.fml_unused_tool = get_value(param) - else: - print >>sys.stdout, "Unknown param: {0}".format(param) - super(BuildMn, self).Run(mninfo, mnname, mnrankingSuffix, mncppPath, check=check, ptr=ptr, multi=multi) - - -class BuildMns(BuildMnBase): + else: + print >>sys.stdout, "Unknown param: {0}".format(param) + super(BuildMn, self).Run(mninfo, mnname, mnrankingSuffix, mncppPath, check=check, ptr=ptr, multi=multi) + + +class BuildMns(BuildMnBase): def InitBase(self, listname, mnrankingSuffix): - self.autogen = '// DO NOT EDIT THIS FILE DIRECTLY, AUTOGENERATED!\n' + self.autogen = '// DO NOT EDIT THIS FILE DIRECTLY, AUTOGENERATED!\n' self.mnrankingSuffix = mnrankingSuffix self.mnlistname = listname + mnrankingSuffix - self.mnlistelem = "const NMatrixnet::TMnSsePtr*" + self.mnlistelem = "const NMatrixnet::TMnSsePtr*" mnlisttype = "TMap< TString, {0} >".format(self.mnlistelem) - self.mnlist = "const {0} {1}".format(mnlisttype, self.mnlistname) - + self.mnlist = "const {0} {1}".format(mnlisttype, self.mnlistname) + self.mnmultilistname = "{0}{1}Multi".format(listname, self.mnrankingSuffix) - self.mnmultilistelem = "const NMatrixnet::TMnMultiCategPtr*" + self.mnmultilistelem = "const NMatrixnet::TMnMultiCategPtr*" mnmultilisttype = "TMap< TString, {0} >".format(self.mnmultilistelem) - self.mnmultilist = "const {0} {1}".format(mnmultilisttype, self.mnmultilistname) - - def InitForAll(self, argv): + self.mnmultilist = "const {0} {1}".format(mnmultilisttype, self.mnmultilistname) + + def InitForAll(self, argv): if len(argv) < 8: print >>sys.stderr, "BuildMns.InitForAll(<ARCADIA_ROOT> <BINDIR> <archiver> <listname> <mnranking_suffix> <hdrfile> <srcfile> <mninfos> [fml_tool=<fml_unused_tool> CHECK])" - sys.exit(1) - - bmns_args = [] - self.check = False + sys.exit(1) + + bmns_args = [] + self.check = False self.fml_unused_tool = '' - for arg in argv: - if arg == "CHECK": - self.check = True + for arg in argv: + if arg == "CHECK": + self.check = True elif arg.startswith('fml_tool='): self.fml_unused_tool = get_value(arg) - else: - bmns_args.append(arg) - - self.SrcRoot = bmns_args[0] - self.BINDIR = bmns_args[1] - self.archiver = bmns_args[2] + else: + bmns_args.append(arg) + + self.SrcRoot = bmns_args[0] + self.BINDIR = bmns_args[1] + self.archiver = bmns_args[2] self.listname = bmns_args[3] self.mnrankingSuffix = get_value(bmns_args[4]) self.hdrfile = bmns_args[5] self.srcfile = bmns_args[6] self.mninfos = bmns_args[7:] - + self.InitBase(self.listname, self.mnrankingSuffix) - - def InitForHeader(self, argv): + + def InitForHeader(self, argv): if len(argv) < 4: print >>sys.stderr, "BuildMns.InitForHeader(<listname> <rankingSuffix> <hdrfile> <mninfos...>)" - sys.exit(1) - - self.listname = argv[0] + sys.exit(1) + + self.listname = argv[0] self.mnrankingSuffix = get_value(argv[1]) self.hdrfile = argv[2] self.mninfos = argv[3:] - + self.InitBase(self.listname, self.mnrankingSuffix) - - def InitForCpp(self, argv): + + def InitForCpp(self, argv): if len(argv) < 5: print >>sys.stderr, "BuildMns.InitForCpp(<listname> <rankingSuffix> <hdrfile> <srcfile> <mninfos...>)" - sys.exit(1) - - self.listname = argv[0] + sys.exit(1) + + self.listname = argv[0] self.mnrankingSuffix = get_value(argv[1]) self.hdrfile = argv[2] self.srcfile = argv[3] self.mninfos = argv[4:] - + self.InitBase(self.listname, self.mnrankingSuffix) - - def InitForFiles(self, argv): + + def InitForFiles(self, argv): if len(argv) < 7: print >>sys.stderr, "BuildMns.InitForFiles(<ARCADIA_ROOT> <BINDIR> <archiver> <fml_unused_tool> <listname> <rankingSuffix> <mninfos...> [CHECK])" - sys.exit(1) - - bmns_args = [] - self.check = False + sys.exit(1) + + bmns_args = [] + self.check = False self.fml_unused_tool = '' - for arg in argv: - if arg == "CHECK": - self.check = True + for arg in argv: + if arg == "CHECK": + self.check = True elif arg.startswith('fml_tool='): self.fml_unused_tool = get_value(arg) - else: - bmns_args.append(arg) - - self.SrcRoot = bmns_args[0] - self.BINDIR = bmns_args[1] - self.archiver = bmns_args[2] + else: + bmns_args.append(arg) + + self.SrcRoot = bmns_args[0] + self.BINDIR = bmns_args[1] + self.archiver = bmns_args[2] self.listname = bmns_args[3] self.mnrankingSuffix = get_value(bmns_args[4]) self.mninfos = bmns_args[5:] - - def BuildMnsHeader(self): - if self.mninfos: - self.mninfos = sorted(set(self.mninfos)) - - tmpHdrPath = self.hdrfile + ".tmp" - tmpHdrFile = open(tmpHdrPath, 'w') - - tmpHdrFile.write(self.autogen) - tmpHdrFile.write("#include <kernel/matrixnet/mn_sse.h>\n") - tmpHdrFile.write("#include <kernel/matrixnet/mn_multi_categ.h>\n\n") - tmpHdrFile.write("extern {0};\n".format(self.mnlist)) - tmpHdrFile.write("extern {0};\n".format(self.mnmultilist)) - - for item in self.mninfos: - mnfilename = os.path.basename(item) - mnfilename, ext = os.path.splitext(mnfilename) - - mnname = re.sub("[^-a-zA-Z0-9_]", "_", mnfilename) - - if ext == ".info": + + def BuildMnsHeader(self): + if self.mninfos: + self.mninfos = sorted(set(self.mninfos)) + + tmpHdrPath = self.hdrfile + ".tmp" + tmpHdrFile = open(tmpHdrPath, 'w') + + tmpHdrFile.write(self.autogen) + tmpHdrFile.write("#include <kernel/matrixnet/mn_sse.h>\n") + tmpHdrFile.write("#include <kernel/matrixnet/mn_multi_categ.h>\n\n") + tmpHdrFile.write("extern {0};\n".format(self.mnlist)) + tmpHdrFile.write("extern {0};\n".format(self.mnmultilist)) + + for item in self.mninfos: + mnfilename = os.path.basename(item) + mnfilename, ext = os.path.splitext(mnfilename) + + mnname = re.sub("[^-a-zA-Z0-9_]", "_", mnfilename) + + if ext == ".info": mnname = "staticMn{0}{1}Ptr".format(self.mnrankingSuffix, mnname) - tmpHdrFile.write("extern const NMatrixnet::TMnSsePtr {0};\n".format(mnname)) - elif ext == ".mnmc": + tmpHdrFile.write("extern const NMatrixnet::TMnSsePtr {0};\n".format(mnname)) + elif ext == ".mnmc": mnname = "staticMnMulti{0}{1}Ptr".format(self.mnrankingSuffix, mnname) - tmpHdrFile.write("extern const NMatrixnet::TMnMultiCategPtr {0};\n".format(mnname)) - - tmpHdrFile.close() - shutil.move(tmpHdrPath, self.hdrfile) - - def BuildMnFiles(self): - for item in self.mninfos: - mnfilename = os.path.basename(item) - mnfilename, ext = os.path.splitext(mnfilename) - - mnname = re.sub("[^-a-zA-Z0-9_]", "_", mnfilename) - - if ext == ".info": + tmpHdrFile.write("extern const NMatrixnet::TMnMultiCategPtr {0};\n".format(mnname)) + + tmpHdrFile.close() + shutil.move(tmpHdrPath, self.hdrfile) + + def BuildMnFiles(self): + for item in self.mninfos: + mnfilename = os.path.basename(item) + mnfilename, ext = os.path.splitext(mnfilename) + + mnname = re.sub("[^-a-zA-Z0-9_]", "_", mnfilename) + + if ext == ".info": mnname = "staticMn{0}{1}Ptr".format(self.mnrankingSuffix, mnname) - super(BuildMns, self).Run(item, mnname, self.mnrankingSuffix, self.BINDIR + "/mn.{0}.cpp".format(mnname), check=self.check, ptr=True, multi=False) - elif ext == ".mnmc": + super(BuildMns, self).Run(item, mnname, self.mnrankingSuffix, self.BINDIR + "/mn.{0}.cpp".format(mnname), check=self.check, ptr=True, multi=False) + elif ext == ".mnmc": mnname = "staticMnMulti{0}{1}Ptr".format(self.mnrankingSuffix, mnname) - # BUILD_MN_PTR_MULTI - super(BuildMns, self).Run(item, mnname, self.mnrankingSuffix, self.BINDIR + "/mnmulti.{0}.cpp".format(mnname), check=False, ptr=True, multi=True) - - def BuildMnsCpp(self): - if self.mninfos: - self.mninfos = sorted(set(self.mninfos)) - - tmpSrcPath = self.srcfile + ".tmp" - tmpSrcFile = open(tmpSrcPath, 'w') - hdrrel = os.path.basename(self.hdrfile) - - mnnames = [] - mnmultinames = [] - for item in self.mninfos: - mnfilename = os.path.basename(item) - mnfilename, ext = os.path.splitext(mnfilename) - - if ext == ".info": - mnnames.append(mnfilename) - elif ext == ".mnmc": + # BUILD_MN_PTR_MULTI + super(BuildMns, self).Run(item, mnname, self.mnrankingSuffix, self.BINDIR + "/mnmulti.{0}.cpp".format(mnname), check=False, ptr=True, multi=True) + + def BuildMnsCpp(self): + if self.mninfos: + self.mninfos = sorted(set(self.mninfos)) + + tmpSrcPath = self.srcfile + ".tmp" + tmpSrcFile = open(tmpSrcPath, 'w') + hdrrel = os.path.basename(self.hdrfile) + + mnnames = [] + mnmultinames = [] + for item in self.mninfos: + mnfilename = os.path.basename(item) + mnfilename, ext = os.path.splitext(mnfilename) + + if ext == ".info": + mnnames.append(mnfilename) + elif ext == ".mnmc": mnmultinames.append(mnfilename) - - tmpSrcFile.write(self.autogen) - tmpSrcFile.write("#include \"{0}\"\n\n".format(hdrrel)) - - if mnnames: - mndata = self.mnlistname + "_data" + + tmpSrcFile.write(self.autogen) + tmpSrcFile.write("#include \"{0}\"\n\n".format(hdrrel)) + + if mnnames: + mndata = self.mnlistname + "_data" tmpSrcFile.write("static const std::pair< TString, {0} > {1}[] = {{\n".format(self.mnlistelem, mndata)) - for item in mnnames: - mnname = re.sub("[^-a-zA-Z0-9_]", "_", item) + for item in mnnames: + mnname = re.sub("[^-a-zA-Z0-9_]", "_", item) tmpSrcFile.write(" std::make_pair(TString(\"{0}\"), &staticMn{1}{2}Ptr),\n".format(item, self.mnrankingSuffix, mnname)) - tmpSrcFile.write("};\n") - tmpSrcFile.write("{0}({1},{1} + sizeof({1}) / sizeof({1}[0]));\n\n".format(self.mnlist, mndata)) - else: - tmpSrcFile.write("{0};\n\n".format(self.mnlist)) - - if mnmultinames: - mnmultidata = self.mnmultilistname + "_data" + tmpSrcFile.write("};\n") + tmpSrcFile.write("{0}({1},{1} + sizeof({1}) / sizeof({1}[0]));\n\n".format(self.mnlist, mndata)) + else: + tmpSrcFile.write("{0};\n\n".format(self.mnlist)) + + if mnmultinames: + mnmultidata = self.mnmultilistname + "_data" tmpSrcFile.write("static const std::pair< TString, {0} > {1}[] = {{\n".format(self.mnmultilistelem, mnmultidata)) - for item in mnmultinames: - mnname = re.sub("[^-a-zA-Z0-9_]", "_", item) + for item in mnmultinames: + mnname = re.sub("[^-a-zA-Z0-9_]", "_", item) tmpSrcFile.write(" std::make_pair(TString(\"{0}\"), &staticMnMulti{1}{2}Ptr),\n".format(item, self.mnrankingSuffix, mnname)) - tmpSrcFile.write("};\n") - tmpSrcFile.write("{0}({1},{1} + sizeof({1}) / sizeof({1}[0]));\n".format(self.mnmultilist, mnmultidata)) - else: - tmpSrcFile.write("{0};\n".format(self.mnmultilist)) - - tmpSrcFile.close() - shutil.move(tmpSrcPath, self.srcfile) - - -def BuildMnsAllF(argv): - bldMns = BuildMns() - bldMns.InitForAll(argv) - bldMns.BuildMnsCpp() - bldMns.BuildMnsHeader() - bldMns.BuildMnFiles() - - -def BuildMnsCppF(argv): - bldMns = BuildMns() - bldMns.InitForCpp(argv) - bldMns.BuildMnsCpp() - - -def BuildMnsHeaderF(argv): - bldMns = BuildMns() - bldMns.InitForHeader(argv) - bldMns.BuildMnsHeader() - - -def BuildMnsFilesF(argv): - bldMns = BuildMns() - bldMns.InitForFiles(argv) - bldMns.BuildMnFiles() - - -def BuildMnF(argv): - bldMn = BuildMn() - bldMn.Run(argv) - - -if __name__ == '__main__': - if len(sys.argv) < 2: + tmpSrcFile.write("};\n") + tmpSrcFile.write("{0}({1},{1} + sizeof({1}) / sizeof({1}[0]));\n".format(self.mnmultilist, mnmultidata)) + else: + tmpSrcFile.write("{0};\n".format(self.mnmultilist)) + + tmpSrcFile.close() + shutil.move(tmpSrcPath, self.srcfile) + + +def BuildMnsAllF(argv): + bldMns = BuildMns() + bldMns.InitForAll(argv) + bldMns.BuildMnsCpp() + bldMns.BuildMnsHeader() + bldMns.BuildMnFiles() + + +def BuildMnsCppF(argv): + bldMns = BuildMns() + bldMns.InitForCpp(argv) + bldMns.BuildMnsCpp() + + +def BuildMnsHeaderF(argv): + bldMns = BuildMns() + bldMns.InitForHeader(argv) + bldMns.BuildMnsHeader() + + +def BuildMnsFilesF(argv): + bldMns = BuildMns() + bldMns.InitForFiles(argv) + bldMns.BuildMnFiles() + + +def BuildMnF(argv): + bldMn = BuildMn() + bldMn.Run(argv) + + +if __name__ == '__main__': + if len(sys.argv) < 2: print >>sys.stderr, "Usage: build_mn.py <funcName> <args...>" - sys.exit(1) - - if (sys.argv[2:]): - globals()[sys.argv[1]](sys.argv[2:]) - else: - globals()[sys.argv[1]]() + sys.exit(1) + + if (sys.argv[2:]): + globals()[sys.argv[1]](sys.argv[2:]) + else: + globals()[sys.argv[1]]() diff --git a/build/scripts/build_pln_header.py b/build/scripts/build_pln_header.py index 413286a11e..c73693f444 100755 --- a/build/scripts/build_pln_header.py +++ b/build/scripts/build_pln_header.py @@ -1,35 +1,35 @@ -#!/usr/bin/env python - -import sys -import os - - -def BuildPlnHeader(): - if len(sys.argv) < 2: +#!/usr/bin/env python + +import sys +import os + + +def BuildPlnHeader(): + if len(sys.argv) < 2: print >>sys.stderr, "Usage: build_pln_header.py <absolute/path/to/OutFile>" - sys.exit(1) - - print >>sys.stdout, "Build Pln Header..." - outPath = sys.argv[1] - tmpPath = outPath + '.tmp' - tmpFile = open(tmpPath, 'w') - + sys.exit(1) + + print >>sys.stdout, "Build Pln Header..." + outPath = sys.argv[1] + tmpPath = outPath + '.tmp' + tmpFile = open(tmpPath, 'w') + tmpFile.write('#include <library/cpp/sse/sse.h>\n') - tmpFile.write('#include <kernel/relevfml/relev_fml.h>\n') - for path in sys.argv[2:]: - name = os.path.basename(path).split(".")[0] # name without extensions - tmpFile.write('\nextern SRelevanceFormula fml{0};\n'.format(name)) - tmpFile.write('float {0}(const float* f);\n'.format(name)) - tmpFile.write('void {0}SSE(const float* const* factors, float* result);\n'.format(name)) - tmpFile.close() - try: + tmpFile.write('#include <kernel/relevfml/relev_fml.h>\n') + for path in sys.argv[2:]: + name = os.path.basename(path).split(".")[0] # name without extensions + tmpFile.write('\nextern SRelevanceFormula fml{0};\n'.format(name)) + tmpFile.write('float {0}(const float* f);\n'.format(name)) + tmpFile.write('void {0}SSE(const float* const* factors, float* result);\n'.format(name)) + tmpFile.close() + try: os.remove(outPath) except: pass try: - os.rename(tmpPath, outPath) - except: - print >>sys.stdout, 'Error: Failed to rename ' + tmpPath + ' to ' + outPath - -if __name__ == '__main__': - BuildPlnHeader() + os.rename(tmpPath, outPath) + except: + print >>sys.stdout, 'Error: Failed to rename ' + tmpPath + ' to ' + outPath + +if __name__ == '__main__': + BuildPlnHeader() diff --git a/build/scripts/cat.py b/build/scripts/cat.py index 7f87ca89be..0c3f73d96f 100755 --- a/build/scripts/cat.py +++ b/build/scripts/cat.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python -import sys -from shutil import copyfileobj as copy +#!/usr/bin/env python +import sys +from shutil import copyfileobj as copy import os.path - + if __name__ == '__main__': for filename in sys.argv[1:] or ["-"]: if filename == "-": diff --git a/build/scripts/configure_file.py b/build/scripts/configure_file.py index 14eec7fa57..1873ed70eb 100755 --- a/build/scripts/configure_file.py +++ b/build/scripts/configure_file.py @@ -1,59 +1,59 @@ -#!/usr/bin/env python2.7 - -import sys -import os.path +#!/usr/bin/env python2.7 + +import sys +import os.path import re - -cmakeDef01 = "#cmakedefine01" -cmakeDef = "#cmakedefine" - - -def replaceLine(l, varDict, define): - words = l.split() - if words: - if words[0] == cmakeDef: - sPos = l.find(cmakeDef) - ePos = sPos + len(cmakeDef) - l = l[:sPos] + define + l[ePos:] + '\n' - if words[0] == cmakeDef01: - var = words[1] - cmakeValue = varDict.get(var) - if cmakeValue == 'yes': - val = '1' - else: - val = '0' - sPos = l.find(cmakeDef01) - ePos = l.find(var) + len(var) - l = l[:sPos] + define + ' ' + var + ' ' + val + l[ePos + 1:] + '\n' - + +cmakeDef01 = "#cmakedefine01" +cmakeDef = "#cmakedefine" + + +def replaceLine(l, varDict, define): + words = l.split() + if words: + if words[0] == cmakeDef: + sPos = l.find(cmakeDef) + ePos = sPos + len(cmakeDef) + l = l[:sPos] + define + l[ePos:] + '\n' + if words[0] == cmakeDef01: + var = words[1] + cmakeValue = varDict.get(var) + if cmakeValue == 'yes': + val = '1' + else: + val = '0' + sPos = l.find(cmakeDef01) + ePos = l.find(var) + len(var) + l = l[:sPos] + define + ' ' + var + ' ' + val + l[ePos + 1:] + '\n' + finder = re.compile(".*?(@[a-zA-Z0-9_]+@).*") - while True: + while True: re_result = finder.match(l) if not re_result: - return l + return l key = re_result.group(1)[1:-1] l = l[:re_result.start(1)] + varDict.get(key, '') + l[re_result.end(1):] - - -def main(inputPath, outputPath, varDict): - define = '#define' if os.path.splitext(outputPath)[1] != '.asm' else '%define' - with open(outputPath, 'w') as output: - with open(inputPath, 'r') as input: - for l in input: - output.write(replaceLine(l, varDict, define)) - - -def usage(): - print "usage: configure_file.py inputPath outputPath key1=value1 ..." - exit(1) - - -if __name__ == "__main__": - if len(sys.argv) < 3: - usage() - varDict = {} - for x in sys.argv[3:]: + + +def main(inputPath, outputPath, varDict): + define = '#define' if os.path.splitext(outputPath)[1] != '.asm' else '%define' + with open(outputPath, 'w') as output: + with open(inputPath, 'r') as input: + for l in input: + output.write(replaceLine(l, varDict, define)) + + +def usage(): + print "usage: configure_file.py inputPath outputPath key1=value1 ..." + exit(1) + + +if __name__ == "__main__": + if len(sys.argv) < 3: + usage() + varDict = {} + for x in sys.argv[3:]: key, value = str(x).split('=', 1) - varDict[key] = value - - main(sys.argv[1], sys.argv[2], varDict) + varDict[key] = value + + main(sys.argv[1], sys.argv[2], varDict) diff --git a/build/scripts/error.py b/build/scripts/error.py index b36d1d9cda..f7d8ecb2cc 100644 --- a/build/scripts/error.py +++ b/build/scripts/error.py @@ -22,7 +22,7 @@ class ExitCodes(object): TEST_FAILED = 10 COMPILATION_FAILED = 11 INFRASTRUCTURE_ERROR = 12 - NOT_RETRIABLE_ERROR = 13 + NOT_RETRIABLE_ERROR = 13 YT_STORE_FETCH_ERROR = 14 diff --git a/build/scripts/fetch_resource.py b/build/scripts/fetch_resource.py index 0808b68ca3..d5af311e5d 100644 --- a/build/scripts/fetch_resource.py +++ b/build/scripts/fetch_resource.py @@ -30,7 +30,7 @@ def fetch_resource(id_): try: return fetch(u) - except Exception: + except Exception: continue raise Exception('Cannot fetch resource {}'.format(id_)) diff --git a/build/scripts/fs_tools.py b/build/scripts/fs_tools.py index 3c286d0a46..dec4c349c8 100644 --- a/build/scripts/fs_tools.py +++ b/build/scripts/fs_tools.py @@ -28,7 +28,7 @@ if __name__ == '__main__': args = pcf.get_args(sys.argv[2:]) if mode == 'copy': - shutil.copy(args[0], args[1]) + 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))]) @@ -45,7 +45,7 @@ if __name__ == '__main__': os.makedirs(os.path.dirname(d)) except OSError: pass - shutil.copy(s, d) + shutil.copy(s, d) elif mode == 'copy_all_files': src = args[0] dst = args[1] diff --git a/build/scripts/mkdir.py b/build/scripts/mkdir.py index aa26988bed..a326b29300 100755 --- a/build/scripts/mkdir.py +++ b/build/scripts/mkdir.py @@ -1,12 +1,12 @@ -#!/usr/bin/env python -import os -import sys - - +#!/usr/bin/env python +import os +import sys + + def mkdir_p(directory): - if not os.path.exists(directory): - os.makedirs(directory) - -if __name__ == "__main__": - for directory in sys.argv[1:]: - mkdir_p(directory) + if not os.path.exists(directory): + os.makedirs(directory) + +if __name__ == "__main__": + for directory in sys.argv[1:]: + mkdir_p(directory) diff --git a/build/scripts/preprocess.py b/build/scripts/preprocess.py index f720ff13d7..4657bef732 100644 --- a/build/scripts/preprocess.py +++ b/build/scripts/preprocess.py @@ -1,5 +1,5 @@ -import sys -import os +import sys +import os def load_file(p): diff --git a/build/scripts/run_msvc_wine.py b/build/scripts/run_msvc_wine.py index e68a381b01..439d1f8831 100644 --- a/build/scripts/run_msvc_wine.py +++ b/build/scripts/run_msvc_wine.py @@ -53,7 +53,7 @@ def subst_path(l): def call_wine_cmd_once(wine, cmd, env, mode): - p = run_subprocess(wine + cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=env, close_fds=True, shell=False) + p = run_subprocess(wine + cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=env, close_fds=True, shell=False) output = find_cmd_out(cmd) error = None @@ -71,20 +71,20 @@ def call_wine_cmd_once(wine, cmd, env, mode): # print >>sys.stderr, cmd, env, wine - stdout_and_stderr, _ = p.communicate() + stdout_and_stderr, _ = p.communicate() - return_code = p.returncode - if not stdout_and_stderr: - if return_code != 0: + return_code = p.returncode + if not stdout_and_stderr: + if return_code != 0: raise Exception('wine did something strange') - return return_code - elif ' : fatal error ' in stdout_and_stderr: - return_code = 1 - elif ' : error ' in stdout_and_stderr: - return_code = 2 + return return_code + elif ' : fatal error ' in stdout_and_stderr: + return_code = 1 + elif ' : error ' in stdout_and_stderr: + return_code = 2 - lines = [x.strip() for x in stdout_and_stderr.split('\n')] + lines = [x.strip() for x in stdout_and_stderr.split('\n')] prefixes = [ 'Microsoft (R)', @@ -135,12 +135,12 @@ def call_wine_cmd_once(wine, cmd, env, mode): if good_line(l): yield subst_path(l.strip()) - stdout_and_stderr = '\n'.join(filter_lines()).strip() + stdout_and_stderr = '\n'.join(filter_lines()).strip() - if stdout_and_stderr: - print >>sys.stderr, stdout_and_stderr + if stdout_and_stderr: + print >>sys.stderr, stdout_and_stderr - return return_code + return return_code def prepare_vc(fr, to): @@ -471,7 +471,7 @@ def run_main(): } slave_cmd = [sys.executable, sys.argv[0], wine, 'slave', json.dumps(args)] - p = run_subprocess(slave_cmd, stderr=subprocess.STDOUT, stdout=subprocess.PIPE, shell=False) + p = run_subprocess(slave_cmd, stderr=subprocess.STDOUT, stdout=subprocess.PIPE, shell=False) out, _ = p.communicate() return p.wait(), out diff --git a/build/scripts/symlink.py b/build/scripts/symlink.py index e8f90c366e..17bc8447f1 100755 --- a/build/scripts/symlink.py +++ b/build/scripts/symlink.py @@ -1,29 +1,29 @@ -#!/usr/bin/env python - -import sys -import os -import platform -from subprocess import call - - -def symlink(): - if len(sys.argv) < 3: - print >>sys.stderr, "Usage: symlink.py <source> <target>" - sys.exit(1) - - source = sys.argv[1] - target = sys.argv[2] - - print "Making a symbolic link from {0} to {1}".format(source, target) - - sysName = platform.system() - if sysName == "Windows": # and not os.path.exists(target) - if os.path.isdir(source): - call(["mklink", "/D", target, source], shell=True) - else: - call(["mklink", target, source], shell=True) - else: - call(["ln", "-f", "-s", "-n", source, target]) - -if __name__ == '__main__': - symlink() +#!/usr/bin/env python + +import sys +import os +import platform +from subprocess import call + + +def symlink(): + if len(sys.argv) < 3: + print >>sys.stderr, "Usage: symlink.py <source> <target>" + sys.exit(1) + + source = sys.argv[1] + target = sys.argv[2] + + print "Making a symbolic link from {0} to {1}".format(source, target) + + sysName = platform.system() + if sysName == "Windows": # and not os.path.exists(target) + if os.path.isdir(source): + call(["mklink", "/D", target, source], shell=True) + else: + call(["mklink", target, source], shell=True) + else: + call(["ln", "-f", "-s", "-n", source, target]) + +if __name__ == '__main__': + symlink() diff --git a/build/scripts/touch.py b/build/scripts/touch.py index 240047ae11..e01ba7f86b 100755 --- a/build/scripts/touch.py +++ b/build/scripts/touch.py @@ -5,14 +5,14 @@ import os import sys import time - + def main(argv): - parser = optparse.OptionParser(add_help_option=False) + parser = optparse.OptionParser(add_help_option=False) parser.disable_interspersed_args() - parser.add_option('-?', '--help', dest='help', - action='store_true', default=None, help='print help') - parser.add_option('-t', dest='t', action='store', default=None) + parser.add_option('-?', '--help', dest='help', + action='store_true', default=None, help='print help') + parser.add_option('-t', dest='t', action='store', default=None) opts, argv_rest = parser.parse_args(argv) if getattr(opts, 'help', False): diff --git a/build/scripts/writer.py b/build/scripts/writer.py index 6006e60f62..21bb3006e5 100644 --- a/build/scripts/writer.py +++ b/build/scripts/writer.py @@ -16,7 +16,7 @@ def parse_args(): parser.add_argument('-P', '--path-list', action='store_true', default=False) return parser.parse_args(args) - + def smart_shell_quote(v): if v is None: return None diff --git a/build/ya.conf.json b/build/ya.conf.json index cf80651547..5f7cc875d6 100644 --- a/build/ya.conf.json +++ b/build/ya.conf.json @@ -3442,14 +3442,14 @@ } ] }, - "cling": { - "tools": { + "cling": { + "tools": { "cling": { "bottle": "cling", "executable": "cling" } - }, - "platforms": [ + }, + "platforms": [ { "host": { "os": "LINUX" @@ -3462,8 +3462,8 @@ }, "default": true } - ] - }, + ] + }, "ninja": { "tools": { "ninja": { @@ -3666,14 +3666,14 @@ } ] }, - "vim": { - "tools": { + "vim": { + "tools": { "vim": { "bottle": "vim", "executable": "vim" } - }, - "platforms": [ + }, + "platforms": [ { "host": { "os": "LINUX" @@ -3686,16 +3686,16 @@ }, "default": true } - ] - }, - "nvim": { - "tools": { + ] + }, + "nvim": { + "tools": { "nvim": { "bottle": "nvim", "executable": "nvim" } - }, - "platforms": [ + }, + "platforms": [ { "host": { "os": "LINUX" @@ -3708,16 +3708,16 @@ }, "default": true } - ] - }, - "emacs": { - "tools": { + ] + }, + "emacs": { + "tools": { "emacs": { "bottle": "emacs", "executable": "emacs" } - }, - "platforms": [ + }, + "platforms": [ { "host": { "os": "LINUX" @@ -3730,8 +3730,8 @@ }, "default": true } - ] - }, + ] + }, "tmux": { "tools": { "tmux": { @@ -3739,11 +3739,11 @@ "executable": "tmux" } }, - "env": { - "TERMINFO": [ + "env": { + "TERMINFO": [ "$(ROOT)/share/terminfo" - ] - }, + ] + }, "platforms": [ { "host": { @@ -4306,15 +4306,15 @@ "default": true } ] - }, - "ctags": { - "tools": { + }, + "ctags": { + "tools": { "ctags": { "bottle": "ctags", "executable": "ctags" } - }, - "platforms": [ + }, + "platforms": [ { "host": { "os": "LINUX" @@ -4327,15 +4327,15 @@ }, "default": true } - ] - }, - "you_complete_me": { - "tools": { + ] + }, + "you_complete_me": { + "tools": { "you_complete_me": { "bottle": "you_complete_me" } - }, - "platforms": [ + }, + "platforms": [ { "host": { "os": "LINUX" @@ -4348,15 +4348,15 @@ }, "default": true } - ] + ] }, - "rtags": { - "tools": { + "rtags": { + "tools": { "rtags": { "bottle": "rtags" } - }, - "platforms": [ + }, + "platforms": [ { "host": { "os": "LINUX" @@ -4369,8 +4369,8 @@ }, "default": true } - ] - }, + ] + }, "afl-fuzz": { "tools": { "afl-fuzz": { @@ -6876,39 +6876,39 @@ ] } }, - "vim": { - "formula": { - "sandbox_id": 82345405, - "match": "vim" - }, - "executable": { + "vim": { + "formula": { + "sandbox_id": 82345405, + "match": "vim" + }, + "executable": { "vim": [ "vim" ] - } - }, - "nvim": { - "formula": { - "sandbox_id": 123061100, - "match": "nvim" - }, - "executable": { + } + }, + "nvim": { + "formula": { + "sandbox_id": 123061100, + "match": "nvim" + }, + "executable": { "nvim": [ "nvim" ] - } - }, - "emacs": { - "formula": { - "sandbox_id": 84328012, - "match": "emacs" - }, - "executable": { + } + }, + "emacs": { + "formula": { + "sandbox_id": 84328012, + "match": "emacs" + }, + "executable": { "emacs": [ "emacs" ] - } - }, + } + }, "tmux": { "formula": { "sandbox_id": [ @@ -7006,17 +7006,17 @@ ] } }, - "cling": { - "formula": { - "sandbox_id": 87671454, - "match": "cling" - }, - "executable": { + "cling": { + "formula": { + "sandbox_id": 87671454, + "match": "cling" + }, + "executable": { "cling": [ "cling" ] - } - }, + } + }, "ninja": { "formula": { "sandbox_id": 19094385, @@ -7147,31 +7147,31 @@ "allure" ] } - }, + }, "ctags": { - "formula": { - "sandbox_id": 55229519, - "match": "ctags" - }, - "executable": { + "formula": { + "sandbox_id": 55229519, + "match": "ctags" + }, + "executable": { "ctags": [ "bin", "ctags" ] - } - }, + } + }, "you_complete_me": { - "formula": { + "formula": { "sandbox_id": 121751471, - "match": "YouCompleteMe" - } + "match": "YouCompleteMe" + } }, "rtags": { - "formula": { - "sandbox_id": 84460170, - "match": "rtags" - } - }, + "formula": { + "sandbox_id": 84460170, + "match": "rtags" + } + }, "afl-fuzz": { "formula": { "sandbox_id": 80600007, diff --git a/build/ya.make b/build/ya.make index 9eab313c0b..407b8f13e0 100644 --- a/build/ya.make +++ b/build/ya.make @@ -19,7 +19,7 @@ PEERDIR( END() -RECURSE( +RECURSE( conf_fatal_error config docs/empty @@ -29,10 +29,10 @@ RECURSE( platform/perl platform/python platform/python/ldflags - plugins + plugins prebuilt - scripts + scripts tests tests_slow yandex_specific/config -) +) diff --git a/build/ymake.core.conf b/build/ymake.core.conf index d39f3a3ec2..081833998b 100644 --- a/build/ymake.core.conf +++ b/build/ymake.core.conf @@ -8,7 +8,7 @@ # Use this with extreme care and only change if it is utlimately needed. Consider more specific XXX_FAKEIDs below instead. FAKEID=3141592653 -SANDBOX_FAKEID=${FAKEID}.7600000 +SANDBOX_FAKEID=${FAKEID}.7600000 CPP_FAKEID=9107927 GO_FAKEID=9056219 ANDROID_FAKEID=8821472 @@ -23,13 +23,13 @@ ECHO=echo INCLUDE_EXTS=.h .hh .hpp .rli .cuh .inc .i CPP_EXT=.cpp OBJ_SUF= -CFLAGS= +CFLAGS= EXTRA_C_FLAGS= SFLAGS= -AUTOCHECK_BALANCING_OPTIONS= +AUTOCHECK_BALANCING_OPTIONS= SO_OTPUTS=no - + @import "${CONF_ROOT}/conf/settings.conf" @import "${CONF_ROOT}/conf/opensource.conf" @import "${CONF_ROOT}/conf/rules.conf" @@ -197,9 +197,9 @@ when ($OS_LINUX && $OS_SDK == "ubuntu-14" && $MUSL != "yes") { } USE_ARCADIA_PYTHON=yes -USE_ARCADIA_LIBM=no +USE_ARCADIA_LIBM=no USE_EAT_MY_DATA=no - + HAVE_MKL= when ($HAVE_MKL == "") { when ($OS_LINUX && $ARCH_X86_64 && !$SANITIZER_TYPE) { @@ -313,7 +313,7 @@ ${output_include;hide:"contrib/libs/python/Include/structmember.h"} \ ${output_include;hide:"contrib/libs/python/Include/traceback.h"} \ ${output_include;hide:"contrib/tools/cython/generated_c_headers.h"} \ ${output_include;hide:"omp.h"} - + # tag:cython-specific CYTHON_CPP_OUTPUT_INCLUDES=${output_include;hide:"contrib/tools/cython/generated_cpp_headers.h"} @@ -849,8 +849,8 @@ macro _CPP_PROTO_CMD(File) { .CMD=$CPP_PROTO_CMDLINE $CPP_PROTO_OPTS $CPP_PROTO_OUTS ${kv;hide:"p PB"} ${kv;hide:"pc yellow"} .SEM=target_proto_mesages PRIVATE ${input:File} ${output;hide;suf=.pb.o:File} ${output;main;hide;norel;nopath;noext:File.pb.h} ${hide;tool:"contrib/tools/protoc/bin"} && set_global_flags COMMON_PROTOC_FLAGS -I=$ARCADIA_ROOT -I=$ARCADIA_BUILD_ROOT && modules_required protobuf.cmake .PEERDIR=contrib/libs/protobuf -} - +} + # tag:proto macro _CPP_VANILLA_PROTO_CMD(File) { .CMD=$CPP_PROTO_CMDLINE $CPP_PROTO_OPTS $CPP_PROTO_OUTS ${kv;hide:"p PB"} ${kv;hide:"pc yellow"} @@ -947,8 +947,8 @@ macro XS_PROTO(File, Dir, Outputs...) { .CMD=$PROTOC -I=${ARCADIA_ROOT}/${Dir} ${pre=-I=:_PROTO__INCLUDE} -I=${ARCADIA_ROOT} -I=${PROTOBUF_PATH} --perlxs_out=${BINDIR} ${input:File} ${hide;output:Outputs} ${output_include;hide;nopath;noext;suf=.pb.h:File} PEERDIR(${Dir}) ADDINCL(${ARCADIA_BUILD_ROOT}/${Dir}) -} - +} + # tag:proto tag:fbs ### @usage: PROTO2FBS(InputProto) ### @@ -961,7 +961,7 @@ macro PROTO2FBS(File) { when ($PY_PROTOS_FOR == "yes") { PEERDIR+=contrib/libs/protobuf/python } - + # tag:python-specific macro _PY_EVLOG_CMD_BASE(File, Suf, Args...) { .CMD=$_PY_PROTO_CMD_BASE($File $Suf $Args) @@ -1173,7 +1173,7 @@ module _BASE_UNIT: _BARE_UNIT { } } - SANITIZER_DEFINED=no + SANITIZER_DEFINED=no when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") { CFLAGS+=-fsanitize=$SANITIZER_TYPE -D${SANITIZER_TYPE}_sanitizer_enabled $SANITIZER_CFLAGS -fno-omit-frame-pointer @@ -1411,14 +1411,14 @@ when ($COMMON_LINK_SETTINGS == "yes") { when (($USE_EAT_MY_DATA == "yes") && ($WIN32 != "yes") && ($DARWIN != "yes") && ($OS_ANDROID != "yes") && ($OS_IOS != "yes")) { PEERDIR+=contrib/libs/libeatmydata/autocheck_wrapper } - + when ($USE_ARCADIA_LIBM == "yes") { PEERDIR+=contrib/libs/libm } when ($USE_ARCADIA_LIBM == "no") { C_SYSTEM_LIBRARIES+=-lm } - + when (($MUSL != "yes" && $WITH_VALGRIND == "yes") || $SANITIZER_DEFINED == "yes") { when ($ALLOCATOR in [ "TCMALLOC", "TCMALLOC_SMALL_BUT_SLOW", "TCMALLOC_NUMA_256K", "TCMALLOC_NUMA_LARGE_PAGES", "TCMALLOC_256K", "GOOGLE", "J", "LF", "LF_YT", "LF_DBG", "B", "BM", "C", "LOCKLESS", "YT", "MIM", "HU" ]) { PEERDIR+=library/cpp/malloc/system @@ -2366,7 +2366,7 @@ module _LIBRARY: _BASE_UNIT { .ALIASES=RES_REQUIREMENTS=PY_REQUIREMENTS GLOBAL_SUFFIX=.global$MODULE_SUFFIX - #TODO: Remove this hack (really we do not need add fake src at all) + #TODO: Remove this hack (really we do not need add fake src at all) ENABLE(NEED_ADD_FAKE_SRC) _REQUIRE_EXPLICIT_LICENSE(contrib/deprecated contrib/libs contrib/restricted contrib/python) CHECK_CONTRIB_CREDITS(contrib/clickhouse contrib/libs contrib/deprecated EXCEPT contrib/deprecated/python) @@ -2403,8 +2403,8 @@ module _LIBRARY: _BASE_UNIT { when ($USE_ARCADIA_LIBM == "yes") { PEERDIR+=contrib/libs/libm } -} - +} + CPP_LIBRARY_SEM=add_library ${MODDIR} $REALPRJNAME ${hide:TARGET} ${hide:AUTO_INPUT} \ && library_fake_marker FAKE_MODULE ${FAKE_MODULE} \ && consumer_link_library PUBLIC $CMAKE_LINK_TARGET \ @@ -2700,7 +2700,7 @@ module PY_ANY_MODULE: DLL_UNIT { } .RESTRICTED=USE_PYTHON2 USE_PYTHON3 PY_SRCS PY_MAIN } - + # tag:python-specific ### @usage: PY2MODULE(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix]) ### @@ -2807,8 +2807,8 @@ module DLL: DLL_UNIT { when ($OS_WINDOWS) { MODULE_SUFFIX=.dll } - - # TODO: Make it possible to use this syntax + + # TODO: Make it possible to use this syntax # DEFAULT(DLL_FOR_DIR no) ### FIXME: XXX ###when ($DLL_FOR_DIR != "no") { @@ -2816,7 +2816,7 @@ module DLL: DLL_UNIT { ### ADDINCL($DLL_FOR_DIR) ###} } - + ### DLL_TOOL is a DLL that can be used as a LD_PRELOAD tool. module DLL_TOOL: DLL { # ymake resolves only program nodes as tools. @@ -5014,8 +5014,8 @@ multimodule SANDBOX_TASK { PEERDIR(sandbox/sdk2 sandbox/sandboxsdk) REGISTER_SANDBOX_IMPORT(${MODDIR}) } -} - +} + # tag:sandbox-specific multimodule SANDBOX_PY23_TASK { module SB_TASK_BIN: _PY2_PROGRAM { @@ -5132,7 +5132,7 @@ macro _PYTHON_ADDINCL() { } } } - + # tag:python-specific ### @usage: PYTHON3_ADDINCL() ### @@ -5182,7 +5182,7 @@ macro _PYTHON3_ADDINCL() { } } } - + # tag:python-specific ### @usage: USE_PYTHON2() ### @@ -5286,7 +5286,7 @@ macro ALLOCATOR(Alloc) { PEERDIR+=___configure_error___unknown_allocator_type___$ALLOCATOR } } - + ### @usage: CC_REQUIREMENTS([cpu: <value>] [ram: <value>]) ### ### Override CPU and RAM requirements for all C/C++ compilation commands in the module @@ -5341,7 +5341,7 @@ when ($STRIP == "yes" && $NO_STRIP != "yes") { DWARF_COMMAND= GO_LINK_FLAGS_VALUE+=-s } - + when ($NO_LINKER_DCE != "yes") { DCE_FLAG=$LD_DCE_FLAG } @@ -5404,7 +5404,7 @@ macro ADD_COMPILABLE_TRANSLATE(Dict, Name, MakeTransDictOptions...) { __translate_dict=${BINDIR}/transdict.${__translatename_lower}.cpp RUN_PROGRAM(dict/tools/maketransdict -i ${Dict} ${MakeTransDictOptions} ${Name} STDOUT_NOAUTO ${__translate_dict} IN ${Dict}) } - + ### @usage ADD_COMPILABLE_TRANSLIT(TranslitTable NGrams Name Options...) ### ### Generate transliteration dictionary code @@ -5420,7 +5420,7 @@ macro ADD_COMPILABLE_TRANSLIT(TranslitTable, NGrams, Name, Options...) { RUN_PROGRAM(${__gentrie_dir} -i ${TranslitTable} -n ${Options} ${__translitname_lower} IN ${TranslitTable} STDOUT ${__translit_table}) RUN_PROGRAM(dict/tools/make_ngrams -i ${NGrams} ${Options} ${__translitname_lower} IN ${NGrams} STDOUT ${__ngrams_table}) } - + # tag:python-specific tag:proto tag:deprecated ### @usage GENERATE_PY_PROTOS(ProtoFiles...) # deprecated @@ -5432,7 +5432,7 @@ macro GENERATE_PY_PROTOS(FILES...) { _PY_PROTO_CMD($FILE) } } - + # tag:python-specific tag:proto macro _GENERATE_PY_PROTOS_INTERNAL(FILES...) { foreach (FILE : $FILES) { @@ -6278,7 +6278,7 @@ macro BUILDWITH_CYTHON_CPP(Src, Options...) { .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS ${Options} --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} -o ${output;tobindir:Src.cpp} $CYTHON_OUTPUT_INCLUDES ${requirements;hide:PY_REQUIREMENTS} ${kv;hide:"p CY"} ${kv;hide:"pc yellow"} ADDINCL(FOR cython contrib/tools/cython/Cython/Includes) } - + # tag:python-processing tag:cython tag:internal ### @usage: _BUILDWITH_CYTHON_CPP_DEP(Src Dep Options...) # internal ### @@ -6408,7 +6408,7 @@ macro ARCHIVE_ASM(NAME="", DONTCOMPRESS?"-p":"", REQUIREMENTS[], Files...) { macro PIRE_INLINE_CMD(SRC) { .CMD=${tool:"library/cpp/regex/pire/inline"} -o ${output:SRC} ${input:SRC} ${output_include;hide:SRC} ${kv;hide:"p PI"} ${kv;hide:"pc yellow"} } - + # tag:yweb-specific macro PIRE_INLINE(FILES...) { foreach (FILE : $FILES) { @@ -6463,7 +6463,7 @@ GENERATE_VCS_JAVA_INFO_NODEP=$YMAKE_PYTHON ${input:"build/scripts/vcs_info.py"} macro UPDATE_VCS_JAVA_INFO_NODEP(Jar) { .CMD=$YMAKE_PYTHON ${input:"build/scripts/vcs_info.py"} output-java $(VCS)/vcs.json $VCS_JAVA $Jar $VCS_INFO_DISABLE_CACHE__NO_UID__ } - + ### @usage: CREATE_BUILDINFO_FOR(GenHdr) ### ### Creates header file to access some information about build specified via configuration variables. @@ -6500,7 +6500,7 @@ macro CONFIGURE_FILE(Src, Dst) { .CMD=$YMAKE_PYTHON ${input:"build/scripts/configure_file.py"} ${input:Src} ${output;addincl:Dst} $CFG_VARS ${kv;hide:"p CF"} ${kv;hide:"pc yellow"} .SEM=set_vasrs ${CFG_VARS} && configure_file $S/${input;rootrel:Src} $B/${output;rootrel:Dst} } - + ### @usage: BASE_CODEGEN(tool_path prefix) ### ### Generator ${prefix}.cpp + ${prefix}.h files based on ${prefix}.in. @@ -6516,7 +6516,7 @@ macro BASE_CODEGEN(Tool, Prefix, Opts...) { macro _SPLIT_CODEGEN_BASE(Tool, Prefix, OUT[], OPTS[], OUTPUT_INCLUDES[]) { .CMD=${tool:Tool} ${input:Prefix.in} ${output;hide:OUT} ${output;nopath;noauto:Prefix.cpp} ${output;nopath:Prefix.h} $OPTS ${output_include;hide:OUTPUT_INCLUDES} ${kv;hide:"p SC"} ${kv;hide:"pc yellow"} } - + STRUCT_CODEGEN_OUTPUT_INCLUDES=${output_include;hide:"util/generic/singleton.h"} \ ${output_include;hide:"util/generic/strbuf.h"} \ ${output_include;hide:"util/generic/vector.h"} \ @@ -6531,7 +6531,7 @@ macro STRUCT_CODEGEN(Prefix) { .CMD=$BASE_CODEGEN(kernel/struct_codegen/codegen_tool, $Prefix, $STRUCT_CODEGEN_OUTPUT_INCLUDES) .PEERDIR=kernel/struct_codegen/metadata kernel/struct_codegen/reflection } - + ### @usage: DUMPERF_CODEGEN(Prefix) ### A special case BASE_CODEGEN, in which the extsearch/images/robot/tools/dumperf/codegen tool is used macro DUMPERF_CODEGEN(Prefix) { @@ -6579,14 +6579,14 @@ macro CONLYFLAGS(Flags...) { macro CXXFLAGS(Flags...) { SET_APPEND_WITH_GLOBAL(USER_CXXFLAGS $Flags) } - + # tag:flags ### @usage: CUDA_NVCC_FLAGS(compiler flags) ### Add the specified flags to the compile line .cu-files. macro CUDA_NVCC_FLAGS(Flags...) { SET_APPEND(CUDA_NVCC_FLAGS $Flags) -} - +} + # tag:flags ### @usage: NVCC_DEVICE_LINK(file.cu...) ### Run nvcc --device-link on objects compiled from srcs with --device-c. @@ -6601,14 +6601,14 @@ macro NVCC_DEVICE_LINK(Srcs...) { ### This macro doesn't work in LIBRARY's, UNION's and PACKAGE's. macro STRIP() { ENABLE(STRIP) -} - +} + ### @usage: NO_OPTIMIZE() ### Build code without any optimizations (-O0 mode). macro NO_OPTIMIZE() { ENABLE(NO_OPTIMIZE) -} - +} + ### @usage: NO_COMPILER_WARNINGS() ### Disable all compiler warnings in the module. ### Priorities: NO_COMPILER_WARNINGS > NO_WERROR > WERROR_MODE > WERROR. @@ -6622,15 +6622,15 @@ macro NO_COMPILER_WARNINGS() { ### Priorities: NO_COMPILER_WARNINGS > NO_WERROR > WERROR_MODE > WERROR. macro WERROR() { ENABLE(WERROR) -} - +} + ### @usage: NO_WERROR() ### Override WERROR() behavior ### Priorities: NO_COMPILER_WARNINGS > NO_WERROR > WERROR_MODE > WERROR. macro NO_WERROR() { DISABLE(WERROR) -} - +} + ### @usage: NO_WSHADOW() ### Disable C++ shadowing warnings. macro NO_WSHADOW() { @@ -6659,8 +6659,8 @@ macro NO_CODENAVIGATION() { ### so using util headers/functions/classes may not be detected at build time and may lead to unpredictable behavors at configure time. macro NO_UTIL() { ENABLE(NOUTIL) -} - +} + ### @usage: NO_RUNTIME() ### ### This macro: @@ -6672,8 +6672,8 @@ macro NO_RUNTIME() { SET(USE_ARCADIA_LIBM no) NO_UTIL() ENABLE(NORUNTIME) -} - +} + ### @usage: NO_LIBC() ### ### Exclude dependencies on C++ and C runtimes (including util, musl and libeatmydata). @@ -6682,8 +6682,8 @@ macro NO_RUNTIME() { macro NO_LIBC() { NO_RUNTIME() DISABLE(MUSL) -} - +} + ### @usage: NO_PLATFORM() ### ### Exclude dependencies on C++ and C runtimes (including util, musl and libeatmydata) and set NO_PLATFORM variable for special processing. @@ -6717,8 +6717,8 @@ macro USE_UTIL() { ### This macro currently does nothing. This is default behavior which cannot be overridden at module level. macro NO_JOIN_SRC() { ENABLE(UNUSED_MACRO) -} - +} + # tag:deprecated ### @usage: JOINSRC() # deprecated, does-nothing ### This macro currently does nothing. Use JOIN_SRCS and similar macros to make one file of set of sources. @@ -6732,8 +6732,8 @@ macro JOINSRC() { ### Disable all sanitizers for the module. macro NO_SANITIZE() { DISABLE(SANITIZER_TYPE) -} - +} + # tag:coverage tag:sanitize ### @usage: NO_SANITIZE_COVERAGE() ### @@ -6833,7 +6833,7 @@ macro GENERATE_ENUM_SERIALIZATION_WITH_HEADER(File) { macro DEB_VERSION(File) { .CMD=$YMAKE_PYTHON ${input:"build/scripts/mkver.py"} ${input:File} ${output;stdout:"DebianVersion.h"} ${kv;hide:"p CL"} ${kv;hide:"pc yellow"} } - + BUILD_MN_SCRIPT=build/scripts/build_mn.py # tag:matrixnet @@ -6853,12 +6853,12 @@ MNS_OUTPUT=mnmodels macro _BUILD_MNS_CPP(NAME="", CHECK?, RANKING_SUFFIX="", Files...) { .CMD=$YMAKE_PYTHON ${input:BUILD_MN_SCRIPT} BuildMnsCppF $NAME ranking_suffix=$RANKING_SUFFIX ${input:MNS_OUTPUT.h} ${output:MNS_OUTPUT.cpp} ${input:Files} ${output_include;hide:MNS_OUTPUT.h} ${output_include;hide:"kernel/matrixnet/mn_sse.h"} ${kv;hide:"p MN"} ${kv;hide:"pc yellow"} -} - +} + macro _BUILD_MNS_HEADER(NAME="", CHECK?, RANKING_SUFFIX="", Files...) { .CMD=$YMAKE_PYTHON ${input:BUILD_MN_SCRIPT} BuildMnsHeaderF $NAME ranking_suffix=$RANKING_SUFFIX ${output:MNS_OUTPUT.h} ${input:Files} ${output_include;hide:"kernel/matrixnet/mn_sse.h"} ${output_include;hide:"kernel/matrixnet/mn_multi_categ.h"} ${kv;hide:"p MN"} ${kv;hide:"pc yellow"} -} - +} + # TODO: support foreach_in and keywords simultaneous usage (look at BUILD_MNS_FILES) # tag:matrixnet @@ -6870,8 +6870,8 @@ macro BUILD_MNS(Files...) { _BUILD_MNS_HEADER($Files) _BUILD_MNS_CPP($Files) _BUILD_MNS_FILES($Files) -} - +} + ### @usage: BUILD_PLNS(Src...) ### ### Generate interface header plnmodels.h for Relev model (PLN). @@ -6915,10 +6915,10 @@ macro NO_NEED_CHECK(Flags...) { ### Reviewers are listed in the macro OWNER. The use of this macro is disabled by default. ### Details can be found here: https://clubs.at.yandex-team.ru/arcadia/6104 macro NEED_REVIEW(Flags...) { - # TODO: FIXME + # TODO: FIXME ENABLE(UNUSED_MACRO) -} - +} + ### @usage: VERSION(Args...) ### ### Specify version of a module. Currently unused by build system, only informative. @@ -6968,7 +6968,7 @@ macro GEN_SCHEEME2(ScheemeName, FromFile) { macro SYMLINK(From, To) { .CMD=$YMAKE_PYTHON ${input:"build/scripts/symlink.py"} ${input;dirallowed:From} ${output;noauto:To} ${kv;hide:"p LN"} ${kv;hide:"pc light-cyan"} } - + ### @usage: RUN_PROGRAM(tool_path args... [CWD dir] [ENV key=value...] [TOOL tools...] [IN inputs...] [OUT[_NOAUTO] outputs...] [STDOUT[_NOAUTO] output] [OUTPUT_INCLUDES output_includes...] [REQUIREMENTS reqs]) ### ### Run a program from arcadia. @@ -6991,7 +6991,7 @@ macro SYMLINK(From, To) { ### Note that Tool is always built for the host platform, so be careful to provide that tool can be built for all Arcadia major host platforms (Linux, MacOS and Windows). macro RUN_PROGRAM(Tool, IN{input}[], OUT{output}[], OUT_NOAUTO{output}[], TOOL{tool}[], OUTPUT_INCLUDES[], IN_DEPS[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], REQUIREMENTS[], Args...) { .CMD=${cwd:CWD} ${env:ENV} ${tool:Tool} $Args ${input;hide:IN} ${input;hide:IN_DEPS} ${output_include;hide:OUTPUT_INCLUDES} ${tool;hide:TOOL} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${requirements;hide:REQUIREMENTS} ${requirements;hide:"network:restricted"} ${kv;hide:"p PR"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"} -} +} # tag:lua-specific ### @usage: LUA(script_path args... [CWD dir] [ENV key=value...] [TOOL tools...] [IN inputs...] [OUT[_NOAUTO] outputs...] [STDOUT[_NOAUTO] output] [OUTPUT_INCLUDES output_includes...][ REQUIREMENTS reqs]) @@ -7083,7 +7083,7 @@ macro FROM_MDS(Key, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], FILE ###requirements;hide ### Use resource described as .external file as [FROM_SANDBOX()](#macro_FROM_SANDBOX)/[FROM_MDS()](#macro_FROM_MDS). macro _FROM_EXTERNAL(File, OutFile, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], AUTOUPDATED="", PREFIX=".", RENAME[], EXECUTABLE?"--executable":"", EXT="ext:") { - .CMD=${hide:SANDBOX_FAKEID} ${cwd:BINDIR} ${resource;pre=$EXT;suf=.external:OutFile} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_external.py"} --external-file ${input:File} --resource-file $(RESOURCE_ROOT)/ext/$OutFile --copy-to-dir $PREFIX ${pre=--rename :RENAME} $EXECUTABLE -- $OUT $OUT_NOAUTO ${input;hide:"build/scripts/fetch_from.py"} ${input;hide:"build/scripts/fetch_from_sandbox.py"} ${input;hide:"build/scripts/fetch_from_mds.py"} ${output_include;hide:OUTPUT_INCLUDES} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${requirements;hide:"network:full"} ${kv;hide:"p XT"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"} + .CMD=${hide:SANDBOX_FAKEID} ${cwd:BINDIR} ${resource;pre=$EXT;suf=.external:OutFile} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_external.py"} --external-file ${input:File} --resource-file $(RESOURCE_ROOT)/ext/$OutFile --copy-to-dir $PREFIX ${pre=--rename :RENAME} $EXECUTABLE -- $OUT $OUT_NOAUTO ${input;hide:"build/scripts/fetch_from.py"} ${input;hide:"build/scripts/fetch_from_sandbox.py"} ${input;hide:"build/scripts/fetch_from_mds.py"} ${output_include;hide:OUTPUT_INCLUDES} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${requirements;hide:"network:full"} ${kv;hide:"p XT"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"} #FIXME: add '${resource;pre=$EXT:OutFile}' when support of the scheme is added to executors #FIXME: add 'ADD_CHECK(check.external $File)' when proper testing is implemented @@ -7409,7 +7409,7 @@ macro TASKLET_REG(Name, Lang, Impl, Includes...) { PEERDIR+=tasklet/runtime/js } - .CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_tasklet_reg.py"} $Name -l $Lang -i $Impl ${output;noauto:Name.task.cpp} $Includes ${output_include;hide:Includes} $TASKLET_REG_INCLUDES ${kv;hide:"p TT"} ${kv;hide:"pc yellow"} + .CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_tasklet_reg.py"} $Name -l $Lang -i $Impl ${output;noauto:Name.task.cpp} $Includes ${output_include;hide:Includes} $TASKLET_REG_INCLUDES ${kv;hide:"p TT"} ${kv;hide:"pc yellow"} SRCS(GLOBAL $Name.task.cpp) } @@ -7418,7 +7418,7 @@ macro TASKLET_REG(Name, Lang, Impl, Includes...) { macro TASKLET_REG_EXT(Name, Lang, Impl, Wrapper, Includes...) { PEERDIR(tasklet/domain sandbox/bin sandbox/taskbox/worker) - .CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_tasklet_reg.py"} $Name -l $Lang -i $Impl -w $Wrapper ${output;noauto:Name.task.cpp} $Includes ${output_include;hide:Includes} $TASKLET_REG_INCLUDES ${kv;hide:"p TT"} ${kv;hide:"pc yellow"} + .CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_tasklet_reg.py"} $Name -l $Lang -i $Impl -w $Wrapper ${output;noauto:Name.task.cpp} $Includes ${output_include;hide:Includes} $TASKLET_REG_INCLUDES ${kv;hide:"p TT"} ${kv;hide:"pc yellow"} SRCS(GLOBAL $Name.task.cpp) } diff --git a/build/ymake_conf.py b/build/ymake_conf.py index cbf37a8e44..30219eb85e 100755 --- a/build/ymake_conf.py +++ b/build/ymake_conf.py @@ -550,11 +550,11 @@ class Build(object): return self.build_type == 'coverage' @property - def is_sanitized(self): + def is_sanitized(self): sanitizer = preset('SANITIZER_TYPE') return bool(sanitizer) and not is_negative_str(sanitizer) - - @property + + @property def with_ndebug(self): return self.build_type in ('release', 'minsizerel', 'valgrind-release', 'profile', 'gprof', 'debugnoasserts') @@ -681,14 +681,14 @@ class Build(object): if isinstance(o, dict): return {un_unicode(k): un_unicode(v) for k, v in six.iteritems(o)} return o - + return un_unicode(json.loads(base64.b64decode(base64str))) - + class YMake(object): def __init__(self, arcadia): self.arcadia = arcadia - + def print_presets(self): presets = opts().presets if presets and 'YMAKE_JAVA_MODULES' not in presets: @@ -945,7 +945,7 @@ class ToolchainOptions(object): self.c_compiler = self.params['c_compiler'] self.cxx_compiler = self.params['cxx_compiler'] - + # TODO(somov): Требовать номер версии всегда. self.compiler_version = self.params.get('gcc_version') or self.params.get('version') or '0' self.compiler_version_list = list(map(int, self.compiler_version.split('.'))) @@ -1928,7 +1928,7 @@ class LD(Linker): self.ld_flags.append('-pg') # TODO(somov): Единое условие на coverage. - if self.build.is_coverage or is_positive('GCOV_COVERAGE') or is_positive('CLANG_COVERAGE') or self.build.is_sanitized: + if self.build.is_coverage or is_positive('GCOV_COVERAGE') or is_positive('CLANG_COVERAGE') or self.build.is_sanitized: self.use_stdlib = None self.ld_sdk = select(default=None, selectors=[ @@ -2834,7 +2834,7 @@ class Ragel(object): if isinstance(compiler, MSVCCompiler): self.set_default_flags(optimized=False) elif isinstance(compiler, GnuCompiler): - self.set_default_flags(optimized=build.is_release and not build.is_sanitized) + self.set_default_flags(optimized=build.is_release and not build.is_sanitized) else: raise ConfigureError('Unexpected compiler {}'.format(compiler)) |