diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:17 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:17 +0300 |
commit | d3a398281c6fd1d3672036cb2d63f842d2cb28c5 (patch) | |
tree | dd4bd3ca0f36b817e96812825ffaf10d645803f2 /build | |
parent | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (diff) | |
download | ydb-d3a398281c6fd1d3672036cb2d63f842d2cb28c5.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 2 of 2.
Diffstat (limited to 'build')
35 files changed, 1354 insertions, 1354 deletions
diff --git a/build/plugins/_common.py b/build/plugins/_common.py index 37b01baa2f..2f831a94db 100644 --- a/build/plugins/_common.py +++ b/build/plugins/_common.py @@ -105,8 +105,8 @@ def resolve_common_const(path): if path.startswith('${ARCADIA_BUILD_ROOT}'): return path.replace('${ARCADIA_BUILD_ROOT}', '$B', 1) return path - - + + def resolve_to_abs_path(path, source_root, build_root): if path.startswith('$S') and source_root is not None: return path.replace('$S', source_root, 1) diff --git a/build/plugins/_custom_command.py b/build/plugins/_custom_command.py index 5e554ee97f..9692214b22 100644 --- a/build/plugins/_custom_command.py +++ b/build/plugins/_custom_command.py @@ -1,7 +1,7 @@ import subprocess import sys -import os - +import os + import _common as common @@ -25,29 +25,29 @@ class CustomCommand(object): def call(self, args, **kwargs): cwd = self._get_call_specs('cwd', kwargs) stdout_path = self._get_call_specs('stdout', kwargs) - + resolved_args = [] - + for arg in args: - resolved_args.append(self.resolve_path(arg)) + resolved_args.append(self.resolve_path(arg)) if stdout_path: stdout = open(stdout_path, 'wb') else: stdout = None - env = os.environ.copy() - env['ASAN_OPTIONS'] = 'detect_leaks=0' + env = os.environ.copy() + env['ASAN_OPTIONS'] = 'detect_leaks=0' + + rc = subprocess.call(resolved_args, cwd=cwd, stdout=stdout, env=env) - rc = subprocess.call(resolved_args, cwd=cwd, stdout=stdout, env=env) - if stdout: stdout.close() if rc: sys.exit(rc) - def resolve_path(self, path): - return common.resolve_to_abs_path(path, self._source_root, self._build_root) + def resolve_path(self, path): + return common.resolve_to_abs_path(path, self._source_root, self._build_root) def _get_call_specs(self, name, kwargs): if isinstance(kwargs, dict): @@ -55,7 +55,7 @@ class CustomCommand(object): if param: return self.resolve_path(param) return None - + def addrule(*unused): pass diff --git a/build/plugins/_import_wrapper.py b/build/plugins/_import_wrapper.py index 2f26f90974..883f662314 100644 --- a/build/plugins/_import_wrapper.py +++ b/build/plugins/_import_wrapper.py @@ -1,24 +1,24 @@ try: - from ymake import CustomCommand as RealCustomCommand + from ymake import CustomCommand as RealCustomCommand from ymake import addrule from ymake import addparser - from ymake import subst + from ymake import subst + + class CustomCommand(RealCustomCommand): + def __init__(self, *args, **kwargs): + RealCustomCommand.__init__(*args, **kwargs) + + def resolve_path(self, path): + return subst(path) - class CustomCommand(RealCustomCommand): - def __init__(self, *args, **kwargs): - RealCustomCommand.__init__(*args, **kwargs) - - def resolve_path(self, path): - return subst(path) - except ImportError: from _custom_command import CustomCommand # noqa from _custom_command import addrule # noqa from _custom_command import addparser # noqa - - -try: - from ymake import engine_version -except ImportError: - def engine_version(): - return -1 + + +try: + from ymake import engine_version +except ImportError: + def engine_version(): + return -1 diff --git a/build/plugins/_unpickler.py b/build/plugins/_unpickler.py index 5d0ec085fb..e01e7b3118 100644 --- a/build/plugins/_unpickler.py +++ b/build/plugins/_unpickler.py @@ -27,7 +27,7 @@ def main(): assert (int(tools[0]) == len(tools[1:])), "tools quantity != tools number!" - cmd_object = pickle.loads(base64.b64decode(encoded_cmd)) + cmd_object = pickle.loads(base64.b64decode(encoded_cmd)) cmd_object.set_source_root(src_root) cmd_object.set_build_root(build_root) diff --git a/build/plugins/bundle.py b/build/plugins/bundle.py index c7864dc4f3..0bec8254ee 100644 --- a/build/plugins/bundle.py +++ b/build/plugins/bundle.py @@ -1,7 +1,7 @@ -import os - - -def onbundle(unit, *args): +import os + + +def onbundle(unit, *args): """ @usage BUNDLE(<Dir [NAME Name]>...) diff --git a/build/plugins/cp.py b/build/plugins/cp.py index 0685d5521a..5c663a3bdd 100644 --- a/build/plugins/cp.py +++ b/build/plugins/cp.py @@ -1,5 +1,5 @@ import os - + from _common import sort_by_keywords diff --git a/build/plugins/cpp_style.py b/build/plugins/cpp_style.py index feca9bc66f..3ab78b7320 100644 --- a/build/plugins/cpp_style.py +++ b/build/plugins/cpp_style.py @@ -1,19 +1,19 @@ -import os - -from _common import sort_by_keywords - - -def on_style(unit, *args): - def it(): - yield 'DONT_PARSE' - - for f in args: - f = f[len('${ARCADIA_ROOT}') + 1:] - - if '/generated/' in f: - continue - - yield f +import os + +from _common import sort_by_keywords + + +def on_style(unit, *args): + def it(): + yield 'DONT_PARSE' + + for f in args: + f = f[len('${ARCADIA_ROOT}') + 1:] + + if '/generated/' in f: + continue + + yield f yield '/cpp_style/files/' + f - - unit.onresource(list(it())) + + unit.onresource(list(it())) diff --git a/build/plugins/create_init_py.py b/build/plugins/create_init_py.py index 131bda1dbb..e41a4d22df 100644 --- a/build/plugins/create_init_py.py +++ b/build/plugins/create_init_py.py @@ -1,8 +1,8 @@ import os - + from _common import sort_by_keywords - + def oncreate_init_py_structure(unit, *args): if unit.get('DISTBUILD'): return diff --git a/build/plugins/mx_archive.py b/build/plugins/mx_archive.py index ca32bfc8d1..56b0d4d16e 100644 --- a/build/plugins/mx_archive.py +++ b/build/plugins/mx_archive.py @@ -1,16 +1,16 @@ -def onmx_formulas(unit, *args): +def onmx_formulas(unit, *args): """ @usage: MX_FORMULAS(BinFiles...) # deprecated, matrixnet Create MatrixNet formulas archive """ - def iter_infos(): - for a in args: - if a.endswith('.bin'): + def iter_infos(): + for a in args: + if a.endswith('.bin'): unit.on_mx_bin_to_info([a]) - yield a[:-3] + 'info' - else: - yield a - - infos = list(iter_infos()) - unit.onarchive_asm(['NAME', 'MxFormulas'] + infos) + yield a[:-3] + 'info' + else: + yield a + + infos = list(iter_infos()) + unit.onarchive_asm(['NAME', 'MxFormulas'] + infos) unit.on_mx_gen_table(infos) diff --git a/build/plugins/pybuild.py b/build/plugins/pybuild.py index 621eb7805e..f32a2d39a0 100644 --- a/build/plugins/pybuild.py +++ b/build/plugins/pybuild.py @@ -5,7 +5,7 @@ from hashlib import md5 import ymake from _common import stripext, rootrel_arc_src, tobuilddir, listid, resolve_to_ymake_path, generate_chunks, pathid - + YA_IDE_VENV_VAR = 'YA_IDE_VENV' PY_NAMESPACE_PREFIX = 'py/namespace' BUILTIN_PROTO = 'builtin_proto' @@ -16,7 +16,7 @@ def is_arc_src(src, unit): src.startswith('${CURDIR}/') or unit.resolve_arc_path(src).startswith('$S/') ) - + def is_extended_source_search_enabled(path, unit): if not is_arc_src(path, unit): return False @@ -28,7 +28,7 @@ def to_build_root(path, unit): if is_arc_src(path, unit): return '${ARCADIA_BUILD_ROOT}/' + rootrel_arc_src(path, unit) return path - + def uniq_suffix(path, unit): upath = unit.path() if '/' not in path: @@ -168,7 +168,7 @@ def py_program(unit, py3): unit.onadd_check_py_imports() -def onpy_srcs(unit, *args): +def onpy_srcs(unit, *args): """ @usage PY_SRCS({| CYTHON_C} { | TOP_LEVEL | NAMESPACE ns} Files...) @@ -201,10 +201,10 @@ def onpy_srcs(unit, *args): venv = unit.get(YA_IDE_VENV_VAR) need_gazetteer_peerdir = False trim = 0 - + if not upath.startswith('contrib/tools/python') and not upath.startswith('library/python/runtime') and unit.get('NO_PYTHON_INCLS') != 'yes': unit.onpeerdir(['contrib/libs/python']) - + unit_needs_main = unit.get('MODULE_TYPE') in ('PROGRAM', 'DLL') if unit_needs_main: py_program(unit, py3) @@ -222,7 +222,7 @@ def onpy_srcs(unit, *args): cython_directives = [] if cython_coverage: cython_directives += ['-X', 'linetrace=True'] - + pyxs_c = [] pyxs_c_h = [] pyxs_c_api_h = [] @@ -236,7 +236,7 @@ def onpy_srcs(unit, *args): evs = [] fbss = [] py_namespaces = {} - + dump_dir = unit.get('PYTHON_BUILD_DUMP_DIR') dump_output = None if dump_dir: @@ -324,7 +324,7 @@ def onpy_srcs(unit, *args): ymake.report_configure_error('TOP_LEVEL __main__.py is not allowed in PY3_PROGRAM') pathmod = (path, mod) - + if dump_output is not None: dump_output.write('{path}\t{module}\n'.format(path=rootrel_arc_src(path, unit), module=mod)) @@ -493,10 +493,10 @@ def onpy_srcs(unit, *args): py_runtime_path = 'contrib/python/protobuf' builtin_proto_path = cpp_runtime_path + '/' + BUILTIN_PROTO - if protos: + if protos: if not upath.startswith(py_runtime_path) and not upath.startswith(builtin_proto_path): unit.onpeerdir(py_runtime_path) - + unit.onpeerdir(unit.get("PY_PROTO_DEPS").split()) proto_paths = [path for path, mod in protos] @@ -514,7 +514,7 @@ def onpy_srcs(unit, *args): unit.onpeerdir([cpp_runtime_path]) unit.on_generate_py_evs_internal([path for path, mod in evs]) unit.onpy_srcs([ev_arg(path, mod, unit) for path, mod in evs]) - + if fbss: unit.onpeerdir(unit.get('_PY_FBS_DEPS').split()) pysrc_base_name = listid(fbss) diff --git a/build/plugins/res.py b/build/plugins/res.py index 48fb57b426..a937caba81 100644 --- a/build/plugins/res.py +++ b/build/plugins/res.py @@ -1,6 +1,6 @@ from _common import iterpair, listid, pathid, rootrel_arc_src, tobuilddir, filter_out_by_keyword - + def split(lst, limit): # paths are specified with replaceable prefix # real length is unknown at the moment, that why we use root_lenght diff --git a/build/plugins/rodata.py b/build/plugins/rodata.py index 98defaff65..3ecb0f9a83 100644 --- a/build/plugins/rodata.py +++ b/build/plugins/rodata.py @@ -1,15 +1,15 @@ import argparse -import os - -import _common as common -import _import_wrapper as iw - - +import os + +import _common as common +import _import_wrapper as iw + + class ROData(iw.CustomCommand): def __init__(self, path, unit): self._path = path self._flags = [] - + prefix = unit.get('ASM_PREFIX') if prefix: @@ -118,51 +118,51 @@ class ROData(iw.CustomCommand): self.call(cmd) -class RODataCXX(iw.CustomCommand): - def __init__(self, path, unit): - self._path = path - self._base = os.path.basename(common.stripext(self._path)) - - def descr(self): - return 'RD', self._path, 'light-green' - - def input(self): +class RODataCXX(iw.CustomCommand): + def __init__(self, path, unit): + self._path = path + self._base = os.path.basename(common.stripext(self._path)) + + def descr(self): + return 'RD', self._path, 'light-green' + + def input(self): return common.make_tuples([self._path]) - - def main_out(self): - return common.tobuilddir(common.stripext(self._path)) + '.cpp' - - def output(self): + + def main_out(self): + return common.tobuilddir(common.stripext(self._path)) + '.cpp' + + def output(self): return common.make_tuples([self.main_out()]) - + def run(self, extra_args, binary): - with open(self.resolve_path(self.main_out()), 'w') as f: - f.write('static_assert(sizeof(unsigned int) == 4, "ups, something gone wrong");\n\n') - f.write('extern "C" {\n') - f.write(' extern const unsigned char ' + self._base + '[] = {\n') - - cnt = 0 - - with open(self.resolve_path(self._path), 'r') as input: - for ch in input.read(): - f.write('0x%02x, ' % ord(ch)) - - cnt += 1 - - if cnt % 50 == 1: - f.write('\n') - - f.write(' };\n') - f.write(' extern const unsigned int ' + self._base + 'Size = sizeof(' + self._base + ');\n') - f.write('}\n') - - -def ro_data(path, unit): + with open(self.resolve_path(self.main_out()), 'w') as f: + f.write('static_assert(sizeof(unsigned int) == 4, "ups, something gone wrong");\n\n') + f.write('extern "C" {\n') + f.write(' extern const unsigned char ' + self._base + '[] = {\n') + + cnt = 0 + + with open(self.resolve_path(self._path), 'r') as input: + for ch in input.read(): + f.write('0x%02x, ' % ord(ch)) + + cnt += 1 + + if cnt % 50 == 1: + f.write('\n') + + f.write(' };\n') + f.write(' extern const unsigned int ' + self._base + 'Size = sizeof(' + self._base + ');\n') + f.write('}\n') + + +def ro_data(path, unit): if unit.enabled('ARCH_AARCH64') or unit.enabled('ARCH_ARM') or unit.enabled('ARCH_PPC64LE'): - return RODataCXX(path, unit) - - return ROData(path, unit) - - + return RODataCXX(path, unit) + + return ROData(path, unit) + + def init(): iw.addrule('rodata', ro_data) diff --git a/build/rules/contrib_deps.policy b/build/rules/contrib_deps.policy index b0c8fdfc54..9af4b85cc2 100644 --- a/build/rules/contrib_deps.policy +++ b/build/rules/contrib_deps.policy @@ -1,7 +1,7 @@ ALLOW contrib/clickhouse -> library/cpp/consistent_hashing ALLOW contrib -> contrib ALLOW contrib -> build -ALLOW contrib -> library/python/resource +ALLOW contrib -> library/python/resource ALLOW contrib -> library/cpp/testing/unittest_main ALLOW contrib -> library/cpp/testing/unittest ALLOW contrib -> library/cpp/getopt diff --git a/build/scripts/check_config_h.py b/build/scripts/check_config_h.py index a19a405d0a..07bc12e230 100644 --- a/build/scripts/check_config_h.py +++ b/build/scripts/check_config_h.py @@ -1,88 +1,88 @@ -import sys - -data = """ -#if defined(SIZEOF_LONG) +import sys + +data = """ +#if defined(SIZEOF_LONG) static_assert(sizeof(long) == SIZEOF_LONG, "fixme 1"); -#endif - -#if defined(SIZEOF_PTHREAD_T) -#include <pthread.h> - +#endif + +#if defined(SIZEOF_PTHREAD_T) +#include <pthread.h> + static_assert(sizeof(pthread_t) == SIZEOF_PTHREAD_T, "fixme 2"); -#endif - -#if defined(SIZEOF_SIZE_T) -#include <stddef.h> - +#endif + +#if defined(SIZEOF_SIZE_T) +#include <stddef.h> + static_assert(sizeof(size_t) == SIZEOF_SIZE_T, "fixme 3"); -#endif - -#if defined(SIZEOF_TIME_T) -#include <time.h> - +#endif + +#if defined(SIZEOF_TIME_T) +#include <time.h> + static_assert(sizeof(time_t) == SIZEOF_TIME_T, "fixme 4"); -#endif - -#if defined(SIZEOF_UINTPTR_T) -#include <stdint.h> - +#endif + +#if defined(SIZEOF_UINTPTR_T) +#include <stdint.h> + static_assert(sizeof(uintptr_t) == SIZEOF_UINTPTR_T, "fixme 5"); -#endif - -#if defined(SIZEOF_VOID_P) +#endif + +#if defined(SIZEOF_VOID_P) static_assert(sizeof(void*) == SIZEOF_VOID_P, "fixme 6"); -#endif - -#if defined(SIZEOF_FPOS_T) -#include <stdio.h> - +#endif + +#if defined(SIZEOF_FPOS_T) +#include <stdio.h> + static_assert(sizeof(fpos_t) == SIZEOF_FPOS_T, "fixme 7"); -#endif - -#if defined(SIZEOF_DOUBLE) +#endif + +#if defined(SIZEOF_DOUBLE) static_assert(sizeof(double) == SIZEOF_DOUBLE, "fixme 8"); -#endif - -#if defined(SIZEOF_LONG_DOUBLE) +#endif + +#if defined(SIZEOF_LONG_DOUBLE) static_assert(sizeof(long double) == SIZEOF_LONG_DOUBLE, "fixme 9"); -#endif - -#if defined(SIZEOF_FLOAT) +#endif + +#if defined(SIZEOF_FLOAT) static_assert(sizeof(float) == SIZEOF_FLOAT, "fixme 10"); -#endif - -#if defined(SIZEOF_INT) +#endif + +#if defined(SIZEOF_INT) static_assert(sizeof(int) == SIZEOF_INT, "fixme 11"); -#endif - -#if defined(SIZEOF_LONG_LONG) +#endif + +#if defined(SIZEOF_LONG_LONG) static_assert(sizeof(long long) == SIZEOF_LONG_LONG, "fixme 12"); -#endif - -#if defined(SIZEOF_OFF_T) -#include <stdio.h> - +#endif + +#if defined(SIZEOF_OFF_T) +#include <stdio.h> + static_assert(sizeof(off_t) == SIZEOF_OFF_T, "fixme 13"); -#endif - -#if defined(SIZEOF_PID_T) -#include <unistd.h> - +#endif + +#if defined(SIZEOF_PID_T) +#include <unistd.h> + static_assert(sizeof(pid_t) == SIZEOF_PID_T, "fixme 14"); -#endif - -#if defined(SIZEOF_SHORT) +#endif + +#if defined(SIZEOF_SHORT) static_assert(sizeof(short) == SIZEOF_SHORT, "fixme 15"); -#endif - -#if defined(SIZEOF_WCHAR_T) +#endif + +#if defined(SIZEOF_WCHAR_T) static_assert(sizeof(wchar_t) == SIZEOF_WCHAR_T, "fixme 16"); -#endif - -#if defined(SIZEOF__BOOL) -//TODO -#endif -""" +#endif + +#if defined(SIZEOF__BOOL) +//TODO +#endif +""" if __name__ == '__main__': with open(sys.argv[2], 'w') as f: f.write('#include <' + sys.argv[1] + '>\n\n') diff --git a/build/scripts/f2c.py b/build/scripts/f2c.py index 243d3965a4..7021e1391f 100644 --- a/build/scripts/f2c.py +++ b/build/scripts/f2c.py @@ -1,8 +1,8 @@ -import sys -import subprocess -import argparse -import os - +import sys +import subprocess +import argparse +import os + header = '''\ #ifdef __GNUC__ @@ -30,11 +30,11 @@ def mkdir_p(directory): if __name__ == '__main__': parser = argparse.ArgumentParser() - + parser.add_argument('-t', '--tool') parser.add_argument('-c', '--input') parser.add_argument('-o', '--output') - + args = parser.parse_args() tmpdir = args.output + '.f2c' mkdir_p(tmpdir) @@ -44,14 +44,14 @@ if __name__ == '__main__': stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE) stdout, stderr = p.communicate(input=open(args.input).read()) ret = p.wait() - + if ret: print >>sys.stderr, 'f2c failed: %s, %s' % (stderr, ret) sys.exit(ret) - + if 'Error' in stderr: print >>sys.stderr, stderr - + with open(args.output, 'w') as f: f.write(header) f.write(stdout) diff --git a/build/scripts/fetch_from_sandbox.py b/build/scripts/fetch_from_sandbox.py index bd84f7a4d2..a99542e174 100755 --- a/build/scripts/fetch_from_sandbox.py +++ b/build/scripts/fetch_from_sandbox.py @@ -6,12 +6,12 @@ import os import random import subprocess import sys -import time +import time import urllib2 import uuid - + import fetch_from - + ORIGIN_SUFFIX = '?origin=fetch-from-sandbox' MDS_PREFIX = 'http://storage-int.mds.yandex.net/get-sandbox/' diff --git a/build/scripts/fs_tools.py b/build/scripts/fs_tools.py index d420e85c50..dec4c349c8 100644 --- a/build/scripts/fs_tools.py +++ b/build/scripts/fs_tools.py @@ -1,11 +1,11 @@ from __future__ import print_function -import os +import os import platform -import sys -import shutil +import sys +import shutil import errno - + import process_command_files as pcf @@ -26,7 +26,7 @@ def link_or_copy(src, dst): if __name__ == '__main__': mode = sys.argv[1] args = pcf.get_args(sys.argv[2:]) - + if mode == 'copy': shutil.copy(args[0], args[1]) elif mode == 'copy_tree_no_link': diff --git a/build/scripts/gen_join_srcs.py b/build/scripts/gen_join_srcs.py index b4ddbb587e..e0c2df161a 100644 --- a/build/scripts/gen_join_srcs.py +++ b/build/scripts/gen_join_srcs.py @@ -1,16 +1,16 @@ -import sys - +import sys + import process_command_files as pcf - -with open(sys.argv[1], 'w') as f: - f.write('#if defined(__GNUC__)\n') - f.write('#pragma GCC diagnostic ignored "-Wunknown-pragmas"\n') - f.write('#if defined(__clang__)\n') - f.write('#pragma GCC diagnostic ignored "-Wunknown-warning-option"\n') - f.write('#endif\n') - f.write('#pragma GCC diagnostic ignored "-Wsubobject-linkage"\n') - f.write('#endif\n\n') - + +with open(sys.argv[1], 'w') as f: + f.write('#if defined(__GNUC__)\n') + f.write('#pragma GCC diagnostic ignored "-Wunknown-pragmas"\n') + f.write('#if defined(__clang__)\n') + f.write('#pragma GCC diagnostic ignored "-Wunknown-warning-option"\n') + f.write('#endif\n') + f.write('#pragma GCC diagnostic ignored "-Wsubobject-linkage"\n') + f.write('#endif\n\n') + for arg in pcf.iter_args(sys.argv[2:]): f.write('#include "' + arg + '"\n') diff --git a/build/scripts/gen_mx_table.py b/build/scripts/gen_mx_table.py index cce69e5cfb..187c21c539 100644 --- a/build/scripts/gen_mx_table.py +++ b/build/scripts/gen_mx_table.py @@ -1,75 +1,75 @@ -import sys - -tmpl = """ -#include "yabs_mx_calc_table.h" - -#include <kernel/matrixnet/mn_sse.h> - +import sys + +tmpl = """ +#include "yabs_mx_calc_table.h" + +#include <kernel/matrixnet/mn_sse.h> + #include <library/cpp/archive/yarchive.h> - -#include <util/memory/blob.h> -#include <util/generic/hash.h> -#include <util/generic/ptr.h> -#include <util/generic/singleton.h> - -using namespace NMatrixnet; - -extern "C" { - extern const unsigned char MxFormulas[]; - extern const ui32 MxFormulasSize; -} - -namespace { - struct TFml: public TBlob, public TMnSseInfo { - inline TFml(const TBlob& b) - : TBlob(b) - , TMnSseInfo(Data(), Size()) - { - } - }; - + +#include <util/memory/blob.h> +#include <util/generic/hash.h> +#include <util/generic/ptr.h> +#include <util/generic/singleton.h> + +using namespace NMatrixnet; + +extern "C" { + extern const unsigned char MxFormulas[]; + extern const ui32 MxFormulasSize; +} + +namespace { + struct TFml: public TBlob, public TMnSseInfo { + inline TFml(const TBlob& b) + : TBlob(b) + , TMnSseInfo(Data(), Size()) + { + } + }; + struct TFormulas: public THashMap<size_t, TAutoPtr<TFml>> { - inline TFormulas() { - TBlob b = TBlob::NoCopy(MxFormulas, MxFormulasSize); - TArchiveReader ar(b); - %s - } - + inline TFormulas() { + TBlob b = TBlob::NoCopy(MxFormulas, MxFormulasSize); + TArchiveReader ar(b); + %s + } + inline const TMnSseInfo& at(size_t n) const noexcept { - return *find(n)->second; - } - }; - - %s - - static func_descr_t yabs_funcs[] = { - %s - }; -} - -yabs_mx_calc_table_t yabs_mx_calc_table = {YABS_MX_CALC_VERSION, 10000, 0, yabs_funcs}; -""" - + return *find(n)->second; + } + }; + + %s + + static func_descr_t yabs_funcs[] = { + %s + }; +} + +yabs_mx_calc_table_t yabs_mx_calc_table = {YABS_MX_CALC_VERSION, 10000, 0, yabs_funcs}; +""" + if __name__ == '__main__': init = [] body = [] defs = {} - + for i in sys.argv[1:]: name = i.replace('.', '_') num = long(name.split('_')[1]) - + init.append('(*this)[%s] = new TFml(ar.ObjectBlobByKey("%s"));' % (num, '/' + i)) - + f1 = 'static void yabs_%s(size_t count, const float** args, double* res) {Singleton<TFormulas>()->at(%s).DoCalcRelevs(args, res, count);}' % (name, num) f2 = 'static size_t yabs_%s_factor_count() {return Singleton<TFormulas>()->at(%s).MaxFactorIndex() + 1;}' % (name, num) - + body.append(f1) body.append(f2) - + d1 = 'yabs_%s' % name d2 = 'yabs_%s_factor_count' % name - + defs[num] = '{%s, %s}' % (d1, d2) - + print tmpl % ('\n'.join(init), '\n\n'.join(body), ',\n'.join((defs.get(i, '{nullptr, nullptr}') for i in range(0, 10000)))) diff --git a/build/scripts/gen_py_reg.py b/build/scripts/gen_py_reg.py index 7526198395..1560135ae8 100644 --- a/build/scripts/gen_py_reg.py +++ b/build/scripts/gen_py_reg.py @@ -1,19 +1,19 @@ import sys -template = ''' +template = ''' extern "C" void PyImport_AppendInittab(const char* name, void (*fn)(void)); extern "C" void {1}(); - -namespace { - struct TRegistrar { - inline TRegistrar() { + +namespace { + struct TRegistrar { + inline TRegistrar() { PyImport_AppendInittab("{0}", {1}); - } - } REG; -} -''' - - + } + } REG; +} +''' + + def mangle(name): if '.' not in name: return name diff --git a/build/scripts/gen_ub.py b/build/scripts/gen_ub.py index cced92e99b..ad79cda926 100644 --- a/build/scripts/gen_ub.py +++ b/build/scripts/gen_ub.py @@ -1,86 +1,86 @@ -import argparse -import os -import tarfile -import contextlib -import hashlib -import base64 -import io - - -stub = """#!/usr/bin/env python - -info = {info} -data = "{data}" - -import platform -import os -import sys -import tarfile -import contextlib -import io -import base64 - - -def current_platform(): - arch = platform.machine().upper() - - if arch == 'AMD64': - arch = 'X86_64' - - platf = platform.system().upper() - - if platf.startswith('WIN'): - platf = 'WIN' - - return (platf + '-' + arch).lower() - - -def extract_file(fname): - with contextlib.closing(tarfile.open(fileobj=io.BytesIO(base64.b64decode(data)))) as f: - return f.extractfile(fname).read() - - -fname = info[current_platform()] -my_path = os.path.realpath(os.path.abspath(__file__)) -tmp_path = my_path + '.tmp' - -with open(tmp_path, 'wb') as f: - f.write(extract_file(fname)) - -os.rename(tmp_path, my_path) -os.chmod(my_path, 0775) -os.execv(sys.argv[0], sys.argv) -""" - - -def gen_ub(output, data): - info = {} - binary = io.BytesIO() - - with contextlib.closing(tarfile.open(mode='w:bz2', fileobj=binary, dereference=True)) as f: - for pl, path in data: - fname = os.path.basename(path) - pl = pl.split('-') - pl = pl[1] + '-' + pl[2] - info[pl] = fname - f.add(path, arcname=fname) - - binary = binary.getvalue() - info['md5'] = hashlib.md5(binary).hexdigest() - - with open(output, 'w') as f: - f.write(stub.format(info=info, data=base64.b64encode(binary))) - - os.chmod(output, 0775) - - -if __name__ == '__main__': - parser = argparse.ArgumentParser() - - parser.add_argument('--path', action='append') - parser.add_argument('--platform', action='append') - parser.add_argument('--output', action='store') - - args = parser.parse_args() - - gen_ub(args.output, zip(args.platform, args.path)) +import argparse +import os +import tarfile +import contextlib +import hashlib +import base64 +import io + + +stub = """#!/usr/bin/env python + +info = {info} +data = "{data}" + +import platform +import os +import sys +import tarfile +import contextlib +import io +import base64 + + +def current_platform(): + arch = platform.machine().upper() + + if arch == 'AMD64': + arch = 'X86_64' + + platf = platform.system().upper() + + if platf.startswith('WIN'): + platf = 'WIN' + + return (platf + '-' + arch).lower() + + +def extract_file(fname): + with contextlib.closing(tarfile.open(fileobj=io.BytesIO(base64.b64decode(data)))) as f: + return f.extractfile(fname).read() + + +fname = info[current_platform()] +my_path = os.path.realpath(os.path.abspath(__file__)) +tmp_path = my_path + '.tmp' + +with open(tmp_path, 'wb') as f: + f.write(extract_file(fname)) + +os.rename(tmp_path, my_path) +os.chmod(my_path, 0775) +os.execv(sys.argv[0], sys.argv) +""" + + +def gen_ub(output, data): + info = {} + binary = io.BytesIO() + + with contextlib.closing(tarfile.open(mode='w:bz2', fileobj=binary, dereference=True)) as f: + for pl, path in data: + fname = os.path.basename(path) + pl = pl.split('-') + pl = pl[1] + '-' + pl[2] + info[pl] = fname + f.add(path, arcname=fname) + + binary = binary.getvalue() + info['md5'] = hashlib.md5(binary).hexdigest() + + with open(output, 'w') as f: + f.write(stub.format(info=info, data=base64.b64encode(binary))) + + os.chmod(output, 0775) + + +if __name__ == '__main__': + parser = argparse.ArgumentParser() + + parser.add_argument('--path', action='append') + parser.add_argument('--platform', action='append') + parser.add_argument('--output', action='store') + + args = parser.parse_args() + + gen_ub(args.output, zip(args.platform, args.path)) diff --git a/build/scripts/link_dyn_lib.py b/build/scripts/link_dyn_lib.py index 58ae45d101..23487f5c1e 100644 --- a/build/scripts/link_dyn_lib.py +++ b/build/scripts/link_dyn_lib.py @@ -1,13 +1,13 @@ -import sys -import os +import sys +import os import subprocess -import tempfile -import collections +import tempfile +import collections import optparse import pipes - + from process_whole_archive_option import ProcessWholeArchiveOption - + def shlex_join(cmd): # equivalent to shlex.join() in python 3 @@ -17,12 +17,12 @@ def shlex_join(cmd): ) -def parse_export_file(p): - with open(p, 'r') as f: +def parse_export_file(p): + with open(p, 'r') as f: for l in f: - l = l.strip() - - if l and '#' not in l: + l = l.strip() + + if l and '#' not in l: words = l.split() if len(words) == 2 and words[0] == 'linux_version': yield {'linux_version': words[1]} @@ -32,8 +32,8 @@ def parse_export_file(p): yield {'lang': 'C', 'sym': words[0]} else: raise Exception('unsupported exports line: ' + l) - - + + def to_c(sym): symbols = collections.deque(sym.split('::')) c_prefixes = [ # demangle prefixes for c++ symbols @@ -60,24 +60,24 @@ def to_c(sym): return ['{prefix}{sym}'.format(prefix=prefix, sym=c_sym) for prefix in c_prefixes] -def fix_darwin_param(ex): - for item in ex: +def fix_darwin_param(ex): + for item in ex: if item.get('linux_version'): continue - if item['lang'] == 'C': - yield '-Wl,-exported_symbol,_' + item['sym'] + if item['lang'] == 'C': + yield '-Wl,-exported_symbol,_' + item['sym'] elif item['lang'] == 'C++': for sym in to_c(item['sym']): yield '-Wl,-exported_symbol,_' + sym - else: - raise Exception('unsupported lang: ' + item['lang']) - - -def fix_gnu_param(arch, ex): - d = collections.defaultdict(list) + else: + raise Exception('unsupported lang: ' + item['lang']) + + +def fix_gnu_param(arch, ex): + d = collections.defaultdict(list) version = None - for item in ex: + for item in ex: if item.get('linux_version'): if not version: version = item.get('linux_version') @@ -87,31 +87,31 @@ def fix_gnu_param(arch, ex): d['C'].extend(to_c(item['sym'])) else: d[item['lang']].append(item['sym']) - + with tempfile.NamedTemporaryFile(mode='wt', delete=False) as f: if version: f.write('{} {{\nglobal:\n'.format(version)) else: f.write('{\nglobal:\n') - - for k, v in d.items(): - f.write(' extern "' + k + '" {\n') - - for x in v: + + for k, v in d.items(): + f.write(' extern "' + k + '" {\n') + + for x in v: f.write(' ' + x + ';\n') - - f.write(' };\n') - - f.write('local: *;\n};\n') - - ret = ['-Wl,--version-script=' + f.name] - - if arch == 'ANDROID': - ret += ['-Wl,--export-dynamic'] - - return ret - - + + f.write(' };\n') + + f.write('local: *;\n};\n') + + ret = ['-Wl,--version-script=' + f.name] + + if arch == 'ANDROID': + ret += ['-Wl,--export-dynamic'] + + return ret + + def fix_windows_param(ex): with tempfile.NamedTemporaryFile(delete=False) as def_file: exports = [] @@ -131,33 +131,33 @@ def fix_cmd(arch, musl, c): if arch == 'WINDOWS': prefix = '/DEF:' f = fix_windows_param - else: + else: prefix = '-Wl,--version-script=' if arch in ('DARWIN', 'IOS'): f = fix_darwin_param else: f = lambda x: fix_gnu_param(arch, x) - - def do_fix(p): + + def do_fix(p): if musl and p in musl_libs: return [] - if p.startswith(prefix) and p.endswith('.exports'): - fname = p[len(prefix):] - - return list(f(list(parse_export_file(fname)))) - + if p.startswith(prefix) and p.endswith('.exports'): + fname = p[len(prefix):] + + return list(f(list(parse_export_file(fname)))) + if p.endswith('.supp'): return [] if p.endswith('.pkg.fake'): return [] - return [p] - - return sum((do_fix(x) for x in c), []) - - + return [p] + + return sum((do_fix(x) for x in c), []) + + def parse_args(): parser = optparse.OptionParser() parser.disable_interspersed_args() diff --git a/build/scripts/link_lib.py b/build/scripts/link_lib.py index c3ef7b9607..344d50d4eb 100644 --- a/build/scripts/link_lib.py +++ b/build/scripts/link_lib.py @@ -49,18 +49,18 @@ if __name__ == "__main__": os.environ['SYM64_THRESHOLD'] = '31' def call(): - try: - p = subprocess.Popen(cmd, stdin=stdin, cwd=opts.build_root) - rc = p.wait() - return rc - except OSError as e: - raise Exception('while running %s: %s' % (' '.join(cmd), e)) + try: + p = subprocess.Popen(cmd, stdin=stdin, cwd=opts.build_root) + rc = p.wait() + return rc + except OSError as e: + raise Exception('while running %s: %s' % (' '.join(cmd), e)) + + try: + os.unlink(opts.output) + except OSError: + pass - try: - os.unlink(opts.output) - except OSError: - pass - if not opts.libs: cmd = [opts.archiver] + opts.create_flags + opts.plugin_flags + [opts.output] + opts.objs stdin = None diff --git a/build/scripts/mkver.py b/build/scripts/mkver.py index 6b4ac58bf7..321cdaade1 100755 --- a/build/scripts/mkver.py +++ b/build/scripts/mkver.py @@ -1,12 +1,12 @@ -import sys - +import sys + if __name__ == '__main__': with open(sys.argv[1], 'r') as f: data = f.readline() - + beg = data.find('(') + 1 end = data.find(')') version = data[beg:end] - + print '#pragma once' print '#define DEBIAN_VERSION "%s"' % version diff --git a/build/scripts/perl_wrapper.py b/build/scripts/perl_wrapper.py index cd456e3056..cb4027f1d3 100644 --- a/build/scripts/perl_wrapper.py +++ b/build/scripts/perl_wrapper.py @@ -1,24 +1,24 @@ import os import sys -import shutil +import shutil if __name__ == '__main__': path = sys.argv[1] to = sys.argv[-1] fr = sys.argv[-2] to_dir = os.path.dirname(to) - + os.chdir(to_dir) - + f1 = os.path.basename(fr) fr_ = os.path.dirname(fr) f2 = os.path.basename(fr_) fr_ = os.path.dirname(fr_) - + os.makedirs(f2) shutil.copyfile(fr, os.path.join(f2, f1)) - + if path[0] != '/': path = os.path.join(os.path.dirname(__file__), path) - + os.execv(path, [path] + sys.argv[2:]) diff --git a/build/scripts/preprocess.py b/build/scripts/preprocess.py index 24846b4c23..4657bef732 100644 --- a/build/scripts/preprocess.py +++ b/build/scripts/preprocess.py @@ -1,48 +1,48 @@ import sys import os - - -def load_file(p): - with open(p, 'r') as f: - return f.read() - - -def step(base, data, hh): - def flt(): - for l in data.split('\n'): - if l in hh: - pp = os.path.join(base, hh[l]) - - yield '\n\n' + load_file(pp) + '\n\n' - - os.unlink(pp) - else: - yield l - - return '\n'.join(flt()) - - -def subst_headers(path, headers): - hh = dict() - - for h in headers: - hh['# include "' + h + '"'] = h - - data = load_file(path) - prev = data - - while True: - ret = step(os.path.dirname(path), prev, hh) - - if ret == prev: - break - - prev = ret - - if data != prev: - with open(path, 'w') as f: - f.write(prev) - - + + +def load_file(p): + with open(p, 'r') as f: + return f.read() + + +def step(base, data, hh): + def flt(): + for l in data.split('\n'): + if l in hh: + pp = os.path.join(base, hh[l]) + + yield '\n\n' + load_file(pp) + '\n\n' + + os.unlink(pp) + else: + yield l + + return '\n'.join(flt()) + + +def subst_headers(path, headers): + hh = dict() + + for h in headers: + hh['# include "' + h + '"'] = h + + data = load_file(path) + prev = data + + while True: + ret = step(os.path.dirname(path), prev, hh) + + if ret == prev: + break + + prev = ret + + if data != prev: + with open(path, 'w') as f: + f.write(prev) + + if __name__ == '__main__': subst_headers(sys.argv[1], ['stack.hh', 'position.hh', 'location.hh']) diff --git a/build/scripts/run_msvc_wine.py b/build/scripts/run_msvc_wine.py index 4763a39f70..439d1f8831 100644 --- a/build/scripts/run_msvc_wine.py +++ b/build/scripts/run_msvc_wine.py @@ -1,60 +1,60 @@ -import sys -import os +import sys +import os import re -import subprocess -import signal -import time -import json +import subprocess +import signal +import time +import json import argparse import errno - + import process_command_files as pcf import process_whole_archive_option as pwa - -procs = [] -build_kekeke = 45 - - + +procs = [] +build_kekeke = 45 + + def stringize(s): return s.encode('utf-8') if isinstance(s, unicode) else s -def run_subprocess(*args, **kwargs): +def run_subprocess(*args, **kwargs): if 'env' in kwargs: kwargs['env'] = {stringize(k): stringize(v) for k, v in kwargs['env'].iteritems()} - p = subprocess.Popen(*args, **kwargs) - - procs.append(p) - - return p - - -def terminate_slaves(): - for p in procs: - try: - p.terminate() - except Exception: - pass - - -def sig_term(sig, fr): - terminate_slaves() - sys.exit(sig) - - -def subst_path(l): - if len(l) > 3: - if l[:3].lower() in ('z:\\', 'z:/'): - return l[2:].replace('\\', '/') - - return l - - + p = subprocess.Popen(*args, **kwargs) + + procs.append(p) + + return p + + +def terminate_slaves(): + for p in procs: + try: + p.terminate() + except Exception: + pass + + +def sig_term(sig, fr): + terminate_slaves() + sys.exit(sig) + + +def subst_path(l): + if len(l) > 3: + if l[:3].lower() in ('z:\\', 'z:/'): + return l[2:].replace('\\', '/') + + return 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) - + output = find_cmd_out(cmd) error = None if output is not None and os.path.exists(output): @@ -69,15 +69,15 @@ def call_wine_cmd_once(wine, cmd, env, mode): if error is not None: print >> sys.stderr, 'Output {} already exists and we have failed to remove it: {}'.format(output, error) - # print >>sys.stderr, cmd, env, wine - + # print >>sys.stderr, cmd, env, wine + stdout_and_stderr, _ = p.communicate() - + 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 @@ -85,27 +85,27 @@ def call_wine_cmd_once(wine, cmd, env, mode): return_code = 2 lines = [x.strip() for x in stdout_and_stderr.split('\n')] - - prefixes = [ - 'Microsoft (R)', - 'Copyright (C)', - 'Application tried to create a window', - 'The graphics driver is missing', - 'Could not load wine-gecko', - 'wine: configuration in', - 'wine: created the configuration directory', + + prefixes = [ + 'Microsoft (R)', + 'Copyright (C)', + 'Application tried to create a window', + 'The graphics driver is missing', + 'Could not load wine-gecko', + 'wine: configuration in', + 'wine: created the configuration directory', 'libpng warning:' - ] - - suffixes = [ - '.c', - '.cxx', - '.cc', - '.cpp', - '.masm', - ] - - substrs = [ + ] + + suffixes = [ + '.c', + '.cxx', + '.cc', + '.cpp', + '.masm', + ] + + substrs = [ 'Creating library Z:', 'err:heap', 'err:menubuilder:', @@ -113,211 +113,211 @@ def call_wine_cmd_once(wine, cmd, env, mode): 'err:ole:', 'err:wincodecs:', 'err:winediag:', - ] - - def good_line(l): - for x in prefixes: - if l.startswith(x): - return False - - for x in suffixes: - if l.endswith(x): - return False - - for x in substrs: - if x in l: - return False - - return True - - def filter_lines(): - for l in lines: - if good_line(l): - yield subst_path(l.strip()) - + ] + + def good_line(l): + for x in prefixes: + if l.startswith(x): + return False + + for x in suffixes: + if l.endswith(x): + return False + + for x in substrs: + if x in l: + return False + + return True + + def filter_lines(): + for l in lines: + if good_line(l): + yield subst_path(l.strip()) + stdout_and_stderr = '\n'.join(filter_lines()).strip() - + if stdout_and_stderr: print >>sys.stderr, stdout_and_stderr - + return return_code - - -def prepare_vc(fr, to): - for p in os.listdir(fr): - fr_p = os.path.join(fr, p) - to_p = os.path.join(to, p) - - if not os.path.exists(to_p): - print >>sys.stderr, 'install %s -> %s' % (fr_p, to_p) - - os.link(fr_p, to_p) - - -def run_slave(): + + +def prepare_vc(fr, to): + for p in os.listdir(fr): + fr_p = os.path.join(fr, p) + to_p = os.path.join(to, p) + + if not os.path.exists(to_p): + print >>sys.stderr, 'install %s -> %s' % (fr_p, to_p) + + os.link(fr_p, to_p) + + +def run_slave(): args = json.loads(sys.argv[3]) wine = sys.argv[1] - - signal.signal(signal.SIGTERM, sig_term) - - if args.get('tout', None): - signal.signal(signal.SIGALRM, sig_term) - signal.alarm(args['tout']) - - tout = 0.1 - - while True: - try: + + signal.signal(signal.SIGTERM, sig_term) + + if args.get('tout', None): + signal.signal(signal.SIGALRM, sig_term) + signal.alarm(args['tout']) + + tout = 0.1 + + while True: + try: return call_wine_cmd_once([wine], args['cmd'], args['env'], args['mode']) - except Exception as e: - print >>sys.stderr, '%s, will retry in %s' % (str(e), tout) - - time.sleep(tout) - tout = min(2 * tout, 4) - - -def find_cmd_out(args): - for arg in args: - if arg.startswith('/Fo'): - return arg[3:] - - if arg.startswith('/OUT:'): - return arg[5:] - - -def calc_zero_cnt(data): - zero_cnt = 0 - - for ch in data: - if ch == chr(0): - zero_cnt += 1 - - return zero_cnt - - -def is_good_file(p): - if not os.path.isfile(p): - return False - - if os.path.getsize(p) < 300: - return False - + except Exception as e: + print >>sys.stderr, '%s, will retry in %s' % (str(e), tout) + + time.sleep(tout) + tout = min(2 * tout, 4) + + +def find_cmd_out(args): + for arg in args: + if arg.startswith('/Fo'): + return arg[3:] + + if arg.startswith('/OUT:'): + return arg[5:] + + +def calc_zero_cnt(data): + zero_cnt = 0 + + for ch in data: + if ch == chr(0): + zero_cnt += 1 + + return zero_cnt + + +def is_good_file(p): + if not os.path.isfile(p): + return False + + if os.path.getsize(p) < 300: + return False + asm_pattern = re.compile('asm(\.\w+)?\.obj$') if asm_pattern.search(p): - pass - elif p.endswith('.obj'): - with open(p, 'rb') as f: - prefix = f.read(200) - - if ord(prefix[0]) != 0: - return False - - if ord(prefix[1]) != 0: - return False - - if ord(prefix[2]) != 0xFF: - return False - - if ord(prefix[3]) != 0xFF: - return False - - if calc_zero_cnt(prefix) > 195: - return False - - f.seek(-100, os.SEEK_END) - last = f.read(100) - - if calc_zero_cnt(last) > 95: - return False - - if last[-1] != chr(0): - return False - elif p.endswith('.lib'): - with open(p, 'rb') as f: - if f.read(7) != '!<arch>': - return False - - return True - - -RED = '\x1b[31;1m' -GRAY = '\x1b[30;1m' -RST = '\x1b[0m' -MGT = '\x1b[35m' -YEL = '\x1b[33m' -GRN = '\x1b[32m' -CYA = '\x1b[36m' - - -def colorize_strings(l): - p = l.find("'") - - if p >= 0: - yield l[:p] - - l = l[p + 1:] - - p = l.find("'") - - if p >= 0: - yield CYA + "'" + subst_path(l[:p]) + "'" + RST - - for x in colorize_strings(l[p + 1:]): - yield x - else: - yield "'" + l - else: - yield l - - -def colorize_line(l): - lll = l - - try: - parts = [] - - if l.startswith('(compiler file'): - return ''.join(colorize_strings(l)) - - if l.startswith('/'): - p = l.find('(') - parts.append(GRAY + l[:p] + RST) - l = l[p:] - - if l and l.startswith('('): - p = l.find(')') - parts.append(':' + MGT + l[1:p] + RST) - l = l[p + 1:] - - if l: - if l.startswith(' : '): - l = l[1:] - - if l.startswith(': error'): - parts.append(': ' + RED + 'error' + RST) - l = l[7:] - elif l.startswith(': warning'): - parts.append(': ' + YEL + 'warning' + RST) - l = l[9:] - elif l.startswith(': note'): - parts.append(': ' + GRN + 'note' + RST) - l = l[6:] - elif l.startswith('fatal error'): - parts.append(RED + 'fatal error' + RST) - l = l[11:] - - if l: - parts.extend(colorize_strings(l)) - - return ''.join(parts) + pass + elif p.endswith('.obj'): + with open(p, 'rb') as f: + prefix = f.read(200) + + if ord(prefix[0]) != 0: + return False + + if ord(prefix[1]) != 0: + return False + + if ord(prefix[2]) != 0xFF: + return False + + if ord(prefix[3]) != 0xFF: + return False + + if calc_zero_cnt(prefix) > 195: + return False + + f.seek(-100, os.SEEK_END) + last = f.read(100) + + if calc_zero_cnt(last) > 95: + return False + + if last[-1] != chr(0): + return False + elif p.endswith('.lib'): + with open(p, 'rb') as f: + if f.read(7) != '!<arch>': + return False + + return True + + +RED = '\x1b[31;1m' +GRAY = '\x1b[30;1m' +RST = '\x1b[0m' +MGT = '\x1b[35m' +YEL = '\x1b[33m' +GRN = '\x1b[32m' +CYA = '\x1b[36m' + + +def colorize_strings(l): + p = l.find("'") + + if p >= 0: + yield l[:p] + + l = l[p + 1:] + + p = l.find("'") + + if p >= 0: + yield CYA + "'" + subst_path(l[:p]) + "'" + RST + + for x in colorize_strings(l[p + 1:]): + yield x + else: + yield "'" + l + else: + yield l + + +def colorize_line(l): + lll = l + + try: + parts = [] + + if l.startswith('(compiler file'): + return ''.join(colorize_strings(l)) + + if l.startswith('/'): + p = l.find('(') + parts.append(GRAY + l[:p] + RST) + l = l[p:] + + if l and l.startswith('('): + p = l.find(')') + parts.append(':' + MGT + l[1:p] + RST) + l = l[p + 1:] + + if l: + if l.startswith(' : '): + l = l[1:] + + if l.startswith(': error'): + parts.append(': ' + RED + 'error' + RST) + l = l[7:] + elif l.startswith(': warning'): + parts.append(': ' + YEL + 'warning' + RST) + l = l[9:] + elif l.startswith(': note'): + parts.append(': ' + GRN + 'note' + RST) + l = l[6:] + elif l.startswith('fatal error'): + parts.append(RED + 'fatal error' + RST) + l = l[11:] + + if l: + parts.extend(colorize_strings(l)) + + return ''.join(parts) except Exception: - return lll - - -def colorize(out): - return '\n'.join(colorize_line(l) for l in out.split('\n')) - - + return lll + + +def colorize(out): + return '\n'.join(colorize_line(l) for l in out.split('\n')) + + def trim_path(path, winepath): p1 = run_subprocess([winepath, '-w', path], stdout=subprocess.PIPE, stderr=subprocess.PIPE) p1_stdout, p1_stderr = p1.communicate() @@ -376,7 +376,7 @@ def fix_path(p): if p.startswith('/Fo'): return '/Fo' + p[3:].replace('/', '\\') return p - + def process_free_args(args, wine, bld_root, mode): whole_archive_prefix = '/WHOLEARCHIVE:' short_names = {} @@ -385,16 +385,16 @@ def process_free_args(args, wine, bld_root, mode): # Slow for no benefit. # arc_root = args.arcadia_root # short_names[arc_root] = trim_path(arc_root, winepath) - + free_args, wa_peers, wa_libs = pwa.get_whole_archive_peers_and_libs(pcf.skip_markers(args)) - + process_link = lambda x: make_full_path_arg(x, bld_root, short_names[bld_root]) if mode in ('link', 'lib') else x def process_arg(arg): with_wa_prefix = arg.startswith(whole_archive_prefix) prefix = whole_archive_prefix if with_wa_prefix else '' without_prefix_arg = arg[len(prefix):] return prefix + fix_path(process_link(downsize_path(without_prefix_arg, short_names))) - + result = [] for arg in free_args: if pcf.is_cmdfile_arg(arg): @@ -430,51 +430,51 @@ def run_main(): free_args = args.free_args wine_dir = os.path.dirname(os.path.dirname(wine)) - bin_dir = os.path.dirname(binary) + bin_dir = os.path.dirname(binary) tc_dir = os.path.dirname(os.path.dirname(os.path.dirname(bin_dir))) if not incl_paths: incl_paths = [tc_dir + '/VC/include', tc_dir + '/include'] - + cmd_out = find_cmd_out(free_args) - env = os.environ.copy() - - env.pop('DISPLAY', None) - + env = os.environ.copy() + + env.pop('DISPLAY', None) + env['WINEDLLOVERRIDES'] = 'msvcr{}=n'.format(version) - env['WINEDEBUG'] = 'fixme-all' + env['WINEDEBUG'] = 'fixme-all' env['INCLUDE'] = ';'.join(fix_path(p) for p in incl_paths) - env['VSINSTALLDIR'] = fix_path(tc_dir) - env['VCINSTALLDIR'] = fix_path(tc_dir + '/VC') - env['WindowsSdkDir'] = fix_path(tc_dir) + env['VSINSTALLDIR'] = fix_path(tc_dir) + env['VCINSTALLDIR'] = fix_path(tc_dir + '/VC') + env['WindowsSdkDir'] = fix_path(tc_dir) env['LIBPATH'] = fix_path(tc_dir + '/VC/lib/amd64') env['LIB'] = fix_path(tc_dir + '/VC/lib/amd64') env['LD_LIBRARY_PATH'] = ':'.join(wine_dir + d for d in ['/lib', '/lib64', '/lib64/wine']) - + cmd = [binary] + process_free_args(free_args, wine, bld_root, mode) for x in ('/NOLOGO', '/nologo', '/FD'): - try: - cmd.remove(x) - except ValueError: - pass - - def run_process(sleep, tout): - if sleep: - time.sleep(sleep) - - args = { - 'cmd': cmd, - 'env': env, - 'mode': mode, - 'tout': tout - } - + try: + cmd.remove(x) + except ValueError: + pass + + def run_process(sleep, tout): + if sleep: + time.sleep(sleep) + + args = { + 'cmd': cmd, + 'env': env, + 'mode': mode, + 'tout': tout + } + 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) - out, _ = p.communicate() - return p.wait(), out - + out, _ = p.communicate() + return p.wait(), out + def print_err_log(log): if not log: return @@ -483,74 +483,74 @@ def run_main(): print >>sys.stderr, log tout = 200 - - while True: - rc, out = run_process(0, tout) - - if rc in (-signal.SIGALRM, signal.SIGALRM): + + while True: + rc, out = run_process(0, tout) + + if rc in (-signal.SIGALRM, signal.SIGALRM): print_err_log(out) - print >>sys.stderr, '##append_tag##time out' + print >>sys.stderr, '##append_tag##time out' elif out and ' stack overflow ' in out: - print >>sys.stderr, '##append_tag##stack overflow' - elif out and 'recvmsg: Connection reset by peer' in out: - print >>sys.stderr, '##append_tag##wine gone' - elif out and 'D8037' in out: - print >>sys.stderr, '##append_tag##repair wine' - - try: - os.unlink(os.path.join(os.environ['WINEPREFIX'], '.update-timestamp')) - except Exception as e: - print >>sys.stderr, e - - else: + print >>sys.stderr, '##append_tag##stack overflow' + elif out and 'recvmsg: Connection reset by peer' in out: + print >>sys.stderr, '##append_tag##wine gone' + elif out and 'D8037' in out: + print >>sys.stderr, '##append_tag##repair wine' + + try: + os.unlink(os.path.join(os.environ['WINEPREFIX'], '.update-timestamp')) + except Exception as e: + print >>sys.stderr, e + + else: print_err_log(out) - - # non-zero return code - bad, return it immediately - if rc: + + # non-zero return code - bad, return it immediately + if rc: print >>sys.stderr, '##win_cmd##' + ' '.join(cmd) print >>sys.stderr, '##args##' + ' '.join(free_args) - return rc - - # check for output existence(if we expect it!) and real length - if cmd_out: - if is_good_file(cmd_out): - return 0 - else: - # retry! - print >>sys.stderr, '##append_tag##no output' - else: - return 0 - - tout *= 3 - - -def main(): + return rc + + # check for output existence(if we expect it!) and real length + if cmd_out: + if is_good_file(cmd_out): + return 0 + else: + # retry! + print >>sys.stderr, '##append_tag##no output' + else: + return 0 + + tout *= 3 + + +def main(): prefix_suffix = os.environ.pop('WINEPREFIX_SUFFIX', None) if prefix_suffix is not None: prefix = os.environ.pop('WINEPREFIX', None) if prefix is not None: os.environ['WINEPREFIX'] = os.path.join(prefix, prefix_suffix) - # just in case - signal.alarm(2000) - - if sys.argv[2] == 'slave': - func = run_slave - else: - func = run_main - - try: - try: - sys.exit(func()) - finally: - terminate_slaves() - except KeyboardInterrupt: - sys.exit(4) - except Exception as e: - print >>sys.stderr, str(e) - - sys.exit(3) - - -if __name__ == '__main__': - main() + # just in case + signal.alarm(2000) + + if sys.argv[2] == 'slave': + func = run_slave + else: + func = run_main + + try: + try: + sys.exit(func()) + finally: + terminate_slaves() + except KeyboardInterrupt: + sys.exit(4) + except Exception as e: + print >>sys.stderr, str(e) + + sys.exit(3) + + +if __name__ == '__main__': + main() diff --git a/build/scripts/run_tool.py b/build/scripts/run_tool.py index fe4b544617..00e3ff6f1e 100755 --- a/build/scripts/run_tool.py +++ b/build/scripts/run_tool.py @@ -1,7 +1,7 @@ -import sys -import subprocess +import sys +import subprocess import os - + if __name__ == '__main__': env = os.environ.copy() diff --git a/build/scripts/xargs.py b/build/scripts/xargs.py index 64295d594f..5d68929ecc 100644 --- a/build/scripts/xargs.py +++ b/build/scripts/xargs.py @@ -1,18 +1,18 @@ -import sys -import os -import subprocess - +import sys +import os +import subprocess + if __name__ == '__main__': pos = sys.argv.index('--') fname = sys.argv[pos + 1] cmd = sys.argv[pos + 2:] - + with open(fname, 'r') as f: args = [x.strip() for x in f] - + os.remove(fname) - + p = subprocess.Popen(cmd + args, shell=False, stderr=sys.stderr, stdout=sys.stdout) p.communicate() - + sys.exit(p.returncode) diff --git a/build/scripts/yield_line.py b/build/scripts/yield_line.py index e95ab5ec62..9c1c539146 100644 --- a/build/scripts/yield_line.py +++ b/build/scripts/yield_line.py @@ -1,7 +1,7 @@ -import sys - +import sys + if __name__ == '__main__': pos = sys.argv.index('--') - + with open(sys.argv[pos + 1], 'a') as f: f.write(' '.join(sys.argv[pos + 2:]) + '\n') diff --git a/build/scripts/yndexer.py b/build/scripts/yndexer.py index 82defb59f8..a38e28ba99 100644 --- a/build/scripts/yndexer.py +++ b/build/scripts/yndexer.py @@ -17,7 +17,7 @@ def _try_to_kill(process): def touch(path): if not os.path.exists(path): - with open(path, 'w'): + with open(path, 'w'): pass diff --git a/build/stdafx.hpp b/build/stdafx.hpp index 17f7f5c5f5..98b15adda0 100644 --- a/build/stdafx.hpp +++ b/build/stdafx.hpp @@ -1,332 +1,332 @@ -#if !defined(LIBCXXRT) -#include <algorithm> -#include <array> -#include <atomic> -#include <bitset> -#include <cassert> -#include <ccomplex> -#include <cctype> -#include <cerrno> -#include <cfenv> -#include <cfloat> -#include <chrono> -#include <cinttypes> -#include <ciso646> -#include <climits> -#include <clocale> -#include <cmath> -#include <codecvt> -#include <complex> -#include <condition_variable> -#include <csetjmp> -#include <csignal> -#include <cstdarg> -#include <cstdbool> -#include <cstddef> -#include <cstdint> -#include <cstdio> -#include <cstdlib> -#include <cstring> -#include <ctgmath> -#include <ctime> -#include <cwchar> -#include <cwctype> -#include <deque> -#include <exception> -//#include <experimental> -//#include <ext> -#include <forward_list> -#include <fstream> -#include <functional> -#include <future> -//#include <incs> -#include <initializer_list> -#include <iomanip> -#include <ios> -#include <iosfwd> -#include <iostream> -#include <istream> -#include <iterator> -#include <limits> -#include <list> -#include <locale> -#include <map> -#include <memory> -#include <mutex> -#include <new> -#include <numeric> -#include <ostream> -#include <queue> -#include <random> -#include <ratio> -#include <regex> -#include <scoped_allocator> -#include <set> -#include <shared_mutex> -#include <sstream> -#include <stack> -#include <stdexcept> +#if !defined(LIBCXXRT) +#include <algorithm> +#include <array> +#include <atomic> +#include <bitset> +#include <cassert> +#include <ccomplex> +#include <cctype> +#include <cerrno> +#include <cfenv> +#include <cfloat> +#include <chrono> +#include <cinttypes> +#include <ciso646> +#include <climits> +#include <clocale> +#include <cmath> +#include <codecvt> +#include <complex> +#include <condition_variable> +#include <csetjmp> +#include <csignal> +#include <cstdarg> +#include <cstdbool> +#include <cstddef> +#include <cstdint> +#include <cstdio> +#include <cstdlib> +#include <cstring> +#include <ctgmath> +#include <ctime> +#include <cwchar> +#include <cwctype> +#include <deque> +#include <exception> +//#include <experimental> +//#include <ext> +#include <forward_list> +#include <fstream> +#include <functional> +#include <future> +//#include <incs> +#include <initializer_list> +#include <iomanip> +#include <ios> +#include <iosfwd> +#include <iostream> +#include <istream> +#include <iterator> +#include <limits> +#include <list> +#include <locale> +#include <map> +#include <memory> +#include <mutex> +#include <new> +#include <numeric> +#include <ostream> +#include <queue> +#include <random> +#include <ratio> +#include <regex> +#include <scoped_allocator> +#include <set> +#include <shared_mutex> +#include <sstream> +#include <stack> +#include <stdexcept> #include <stlfwd> -#include <streambuf> -#include <string> -#include <strstream> -//#include <support> -#include <system_error> -#include <thread> -#include <tuple> -#include <typeindex> -#include <typeinfo> -#include <type_traits> -#include <unordered_map> -#include <unordered_set> -#include <utility> -#include <valarray> -#include <vector> -//#include <wrappers> - -#include <util/network/hostip.h> -#include <util/network/address.h> -#include <util/network/poller.h> -#include <util/network/socket.h> -#include <util/network/iovec.h> -#include <util/network/ip.h> -#include <util/network/endpoint.h> -#include <util/network/nonblock.h> -#include <util/network/sock.h> -#include <util/network/pair.h> -#include <util/network/interface.h> -#include <util/network/init.h> -#include <util/network/pollerimpl.h> -#include <util/system/tls.h> -#include <util/system/direct_io.h> -#include <util/system/flock.h> -#include <util/system/fhandle.h> -#include <util/system/pipe.h> -#include <util/system/dynlib.h> -#include <util/system/condvar.h> -#include <util/system/atomic_ops.h> -#include <util/system/guard.h> -#include <util/system/execpath.h> -#include <util/system/spinlock.h> -#include <util/system/progname.h> -#include <util/system/types.h> -#include <util/system/fs.h> -#include <util/system/compat.h> -#include <util/system/error.h> -#include <util/system/cpu_id.h> -//#include <util/system/fs_win.h> -//#include <util/system/context_i686.h> -#include <util/system/rwlock.h> -#include <util/system/info.h> -#include <util/system/getpid.h> -#include <util/system/file_lock.h> -#include <util/system/nice.h> -//#include <util/system/context_aarch64.h> -#include <util/system/src_root.h> -#include <util/system/daemon.h> -#include <util/system/align.h> -#include <util/system/sem.h> -#include <util/system/hostname.h> -#include <util/system/compiler.h> -#include <util/system/thread.h> -#include <util/system/fstat.h> -#include <util/system/madvise.h> -#include <util/system/valgrind.h> +#include <streambuf> +#include <string> +#include <strstream> +//#include <support> +#include <system_error> +#include <thread> +#include <tuple> +#include <typeindex> +#include <typeinfo> +#include <type_traits> +#include <unordered_map> +#include <unordered_set> +#include <utility> +#include <valarray> +#include <vector> +//#include <wrappers> + +#include <util/network/hostip.h> +#include <util/network/address.h> +#include <util/network/poller.h> +#include <util/network/socket.h> +#include <util/network/iovec.h> +#include <util/network/ip.h> +#include <util/network/endpoint.h> +#include <util/network/nonblock.h> +#include <util/network/sock.h> +#include <util/network/pair.h> +#include <util/network/interface.h> +#include <util/network/init.h> +#include <util/network/pollerimpl.h> +#include <util/system/tls.h> +#include <util/system/direct_io.h> +#include <util/system/flock.h> +#include <util/system/fhandle.h> +#include <util/system/pipe.h> +#include <util/system/dynlib.h> +#include <util/system/condvar.h> +#include <util/system/atomic_ops.h> +#include <util/system/guard.h> +#include <util/system/execpath.h> +#include <util/system/spinlock.h> +#include <util/system/progname.h> +#include <util/system/types.h> +#include <util/system/fs.h> +#include <util/system/compat.h> +#include <util/system/error.h> +#include <util/system/cpu_id.h> +//#include <util/system/fs_win.h> +//#include <util/system/context_i686.h> +#include <util/system/rwlock.h> +#include <util/system/info.h> +#include <util/system/getpid.h> +#include <util/system/file_lock.h> +#include <util/system/nice.h> +//#include <util/system/context_aarch64.h> +#include <util/system/src_root.h> +#include <util/system/daemon.h> +#include <util/system/align.h> +#include <util/system/sem.h> +#include <util/system/hostname.h> +#include <util/system/compiler.h> +#include <util/system/thread.h> +#include <util/system/fstat.h> +#include <util/system/madvise.h> +#include <util/system/valgrind.h> #include <util/system/shmat.h> -#include <util/system/rusage.h> -#include <util/system/yassert.h> +#include <util/system/rusage.h> +#include <util/system/yassert.h> #include <util/system/tempfile.h> -#include <util/system/atomic.h> -#include <util/system/yield.h> -#include <util/system/filemap.h> +#include <util/system/atomic.h> +#include <util/system/yield.h> +#include <util/system/filemap.h> #include <library/cpp/deprecated/mapped_file/mapped_file.h> -#include <util/system/sys_alloc.h> -#include <util/system/sysstat.h> -#include <util/system/env.h> -#include <util/system/shellcommand.h> -//#include <util/system/winint.h> -#include <util/system/defaults.h> -#include <util/system/context_x86_64.h> -#include <util/system/protect.h> -#include <util/system/mutex.h> -#include <util/system/sigset.h> -#include <util/system/event.h> -#include <util/system/byteorder.h> -#include <util/system/maxlen.h> -#include <util/system/hp_timer.h> -#include <util/system/unaligned_mem.h> -#include <util/system/src_location.h> -#include <util/system/fasttime.h> -#include <util/system/atomic_gcc.h> -#include <util/system/user.h> -#include <util/system/mem_info.h> -#include <util/system/datetime.h> -#include <util/system/utime.h> -#include <util/system/mlock.h> +#include <util/system/sys_alloc.h> +#include <util/system/sysstat.h> +#include <util/system/env.h> +#include <util/system/shellcommand.h> +//#include <util/system/winint.h> +#include <util/system/defaults.h> +#include <util/system/context_x86_64.h> +#include <util/system/protect.h> +#include <util/system/mutex.h> +#include <util/system/sigset.h> +#include <util/system/event.h> +#include <util/system/byteorder.h> +#include <util/system/maxlen.h> +#include <util/system/hp_timer.h> +#include <util/system/unaligned_mem.h> +#include <util/system/src_location.h> +#include <util/system/fasttime.h> +#include <util/system/atomic_gcc.h> +#include <util/system/user.h> +#include <util/system/mem_info.h> +#include <util/system/datetime.h> +#include <util/system/utime.h> +#include <util/system/mlock.h> #include <util/system/type_name.h> -#include <util/system/file.h> -#include <util/system/atexit.h> -#include <util/system/context_x86.h> -#include <util/system/backtrace.h> -#include <util/system/platform.h> -//#include <util/system/atomic_win.h> -#include <util/system/context.h> -#include <util/memory/segpool_alloc.h> -#include <util/memory/tempbuf.h> -#include <util/memory/pool.h> -#include <util/memory/addstorage.h> -#include <util/memory/alloc.h> -#include <util/memory/blob.h> -#include <util/memory/smallobj.h> -#include <util/memory/segmented_string_pool.h> -#include <util/memory/mmapalloc.h> +#include <util/system/file.h> +#include <util/system/atexit.h> +#include <util/system/context_x86.h> +#include <util/system/backtrace.h> +#include <util/system/platform.h> +//#include <util/system/atomic_win.h> +#include <util/system/context.h> +#include <util/memory/segpool_alloc.h> +#include <util/memory/tempbuf.h> +#include <util/memory/pool.h> +#include <util/memory/addstorage.h> +#include <util/memory/alloc.h> +#include <util/memory/blob.h> +#include <util/memory/smallobj.h> +#include <util/memory/segmented_string_pool.h> +#include <util/memory/mmapalloc.h> #include <library/cpp/deprecated/split/delim_string_iter.h> -#include <util/draft/ip.h> -#include <util/draft/matrix.h> -#include <util/draft/date.h> -#include <util/draft/enum.h> -#include <util/draft/memory.h> -#include <util/draft/holder_vector.h> +#include <util/draft/ip.h> +#include <util/draft/matrix.h> +#include <util/draft/date.h> +#include <util/draft/enum.h> +#include <util/draft/memory.h> +#include <util/draft/holder_vector.h> #include <util/generic/object_counter.h> -#include <util/draft/datetime.h> +#include <util/draft/datetime.h> #include <library/cpp/deprecated/estimators/estimators.h> #include <library/cpp/deprecated/enum_codegen/enum_codegen.h> -#include <util/generic/array_size.h> -#include <util/generic/bitmap.h> -#include <util/generic/intrlist.h> -#include <util/generic/deque.h> -#include <util/generic/bt_exception.h> -#include <util/generic/yexception_ut.h> -#include <util/generic/singleton.h> -#include <util/generic/set.h> -#include <util/generic/iterator.h> -#include <util/generic/ptr.h> -#include <util/generic/mapfindptr.h> -#include <util/generic/vector.h> -#include <util/generic/va_args.h> -#include <util/generic/refcount.h> -#include <util/generic/list.h> +#include <util/generic/array_size.h> +#include <util/generic/bitmap.h> +#include <util/generic/intrlist.h> +#include <util/generic/deque.h> +#include <util/generic/bt_exception.h> +#include <util/generic/yexception_ut.h> +#include <util/generic/singleton.h> +#include <util/generic/set.h> +#include <util/generic/iterator.h> +#include <util/generic/ptr.h> +#include <util/generic/mapfindptr.h> +#include <util/generic/vector.h> +#include <util/generic/va_args.h> +#include <util/generic/refcount.h> +#include <util/generic/list.h> #include <util/generic/array_ref.h> -#include <util/generic/noncopyable.h> -#include <util/generic/strbuf.h> -#include <util/generic/lazy_value.h> -#include <util/generic/variant.h> -#include <util/generic/store_policy.h> -#include <util/generic/ymath.h> -#include <util/generic/stack.h> -#include <util/generic/xrange.h> -#include <util/generic/fwd.h> -#include <util/generic/is_in.h> -#include <util/generic/buffer.h> -#include <util/generic/yexception.h> -#include <util/generic/typelist.h> -#include <util/generic/utility.h> -#include <util/generic/bitops.h> -#include <util/generic/typetraits.h> -#include <util/generic/algorithm.h> -#include <util/generic/hash_set.h> -#include <util/generic/cast.h> -#include <util/generic/ylimits.h> -#include <util/generic/hash.h> -#include <util/generic/mem_copy.h> -#include <util/generic/guid.h> -#include <util/generic/hash_primes.h> -#include <util/generic/map.h> -#include <util/generic/maybe.h> -#include <util/generic/function.h> -#include <util/generic/flags.h> -#include <util/generic/strfcpy.h> +#include <util/generic/noncopyable.h> +#include <util/generic/strbuf.h> +#include <util/generic/lazy_value.h> +#include <util/generic/variant.h> +#include <util/generic/store_policy.h> +#include <util/generic/ymath.h> +#include <util/generic/stack.h> +#include <util/generic/xrange.h> +#include <util/generic/fwd.h> +#include <util/generic/is_in.h> +#include <util/generic/buffer.h> +#include <util/generic/yexception.h> +#include <util/generic/typelist.h> +#include <util/generic/utility.h> +#include <util/generic/bitops.h> +#include <util/generic/typetraits.h> +#include <util/generic/algorithm.h> +#include <util/generic/hash_set.h> +#include <util/generic/cast.h> +#include <util/generic/ylimits.h> +#include <util/generic/hash.h> +#include <util/generic/mem_copy.h> +#include <util/generic/guid.h> +#include <util/generic/hash_primes.h> +#include <util/generic/map.h> +#include <util/generic/maybe.h> +#include <util/generic/function.h> +#include <util/generic/flags.h> +#include <util/generic/strfcpy.h> #include <util/generic/string.h> -#include <util/generic/fastqueue.h> -#include <util/generic/explicit_type.h> -#include <util/generic/queue.h> -#include <util/generic/adaptor.h> -#include <util/string/escape.h> +#include <util/generic/fastqueue.h> +#include <util/generic/explicit_type.h> +#include <util/generic/queue.h> +#include <util/generic/adaptor.h> +#include <util/string/escape.h> #include <library/cpp/string_utils/scan/scan.h> -#include <util/string/type.h> -#include <util/string/join.h> -#include <util/string/vector.h> -#include <util/string/split.h> -#include <util/string/cstriter.h> -#include <util/string/strspn.h> -#include <util/string/subst.h> -#include <util/string/hex.h> -#include <util/string/printf.h> -#include <util/string/ascii.h> -#include <util/string/cast.h> +#include <util/string/type.h> +#include <util/string/join.h> +#include <util/string/vector.h> +#include <util/string/split.h> +#include <util/string/cstriter.h> +#include <util/string/strspn.h> +#include <util/string/subst.h> +#include <util/string/hex.h> +#include <util/string/printf.h> +#include <util/string/ascii.h> +#include <util/string/cast.h> #include <library/cpp/deprecated/split/split_iterator.h> -#include <util/string/util.h> -#include <util/string/strip.h> -#include <util/string/builder.h> -#include <util/digest/city.h> -#include <util/digest/multi.h> -#include <util/digest/numeric.h> -#include <util/digest/fnv.h> -#include <util/digest/murmur.h> -#include <util/ysaveload.h> +#include <util/string/util.h> +#include <util/string/strip.h> +#include <util/string/builder.h> +#include <util/digest/city.h> +#include <util/digest/multi.h> +#include <util/digest/numeric.h> +#include <util/digest/fnv.h> +#include <util/digest/murmur.h> +#include <util/ysaveload.h> #include <util/thread/factory.h> -#include <util/thread/lfstack.h> -#include <util/thread/singleton.h> -#include <util/thread/lfqueue.h> +#include <util/thread/lfstack.h> +#include <util/thread/singleton.h> +#include <util/thread/lfqueue.h> #include <util/thread/pool.h> -#include <util/str_stl.h> -#include <util/folder/path.h> -#include <util/folder/dirut.h> -#include <util/folder/iterator.h> -//#include <util/folder/dirent_win.h> -//#include <util/folder/lstat_win.h> -#include <util/folder/pathsplit.h> -#include <util/folder/tempdir.h> -#include <util/folder/filelist.h> -#include <util/folder/fts.h> -#include <util/stream/null.h> -#include <util/stream/holder.h> -#include <util/stream/direct_io.h> -#include <util/stream/tempbuf.h> -#include <util/stream/pipe.h> -#include <util/stream/tokenizer.h> -#include <util/stream/buffered.h> -#include <util/stream/input.h> -#include <util/stream/trace.h> -#include <util/stream/output.h> +#include <util/str_stl.h> +#include <util/folder/path.h> +#include <util/folder/dirut.h> +#include <util/folder/iterator.h> +//#include <util/folder/dirent_win.h> +//#include <util/folder/lstat_win.h> +#include <util/folder/pathsplit.h> +#include <util/folder/tempdir.h> +#include <util/folder/filelist.h> +#include <util/folder/fts.h> +#include <util/stream/null.h> +#include <util/stream/holder.h> +#include <util/stream/direct_io.h> +#include <util/stream/tempbuf.h> +#include <util/stream/pipe.h> +#include <util/stream/tokenizer.h> +#include <util/stream/buffered.h> +#include <util/stream/input.h> +#include <util/stream/trace.h> #include <util/stream/output.h> -#include <util/stream/format.h> -#include <util/stream/tee.h> -#include <util/stream/multi.h> -#include <util/stream/aligned.h> -#include <util/stream/labeled.h> -#include <util/stream/buffer.h> -#include <util/stream/hex.h> -#include <util/stream/printf.h> -#include <util/stream/walk.h> -#include <util/stream/zlib.h> -#include <util/stream/debug.h> -#include <util/stream/mem.h> -#include <util/stream/length.h> -#include <util/stream/str.h> -#include <util/stream/file.h> -#include <util/stream/zerocopy.h> #include <util/stream/output.h> -#include <util/random/common_ops.h> -#include <util/random/shuffle.h> -#include <util/random/lcg_engine.h> -#include <util/random/random.h> -#include <util/random/normal.h> -#include <util/random/mersenne32.h> -#include <util/random/entropy.h> -#include <util/random/mersenne.h> -//#include <util/random/easy.h> -#include <util/random/mersenne64.h> -#include <util/random/fast.h> -#include <util/ysafeptr.h> -#include <util/charset/utf8.h> -#include <util/charset/unidata.h> -#include <util/charset/unicode_table.h> -#include <util/charset/wide.h> -#include <util/charset/recode_result.h> -#include <util/datetime/constants.h> -#include <util/datetime/base.h> -#include <util/datetime/parser.h> -#include <util/datetime/cputimer.h> -#include <util/datetime/systime.h> -#endif +#include <util/stream/format.h> +#include <util/stream/tee.h> +#include <util/stream/multi.h> +#include <util/stream/aligned.h> +#include <util/stream/labeled.h> +#include <util/stream/buffer.h> +#include <util/stream/hex.h> +#include <util/stream/printf.h> +#include <util/stream/walk.h> +#include <util/stream/zlib.h> +#include <util/stream/debug.h> +#include <util/stream/mem.h> +#include <util/stream/length.h> +#include <util/stream/str.h> +#include <util/stream/file.h> +#include <util/stream/zerocopy.h> +#include <util/stream/output.h> +#include <util/random/common_ops.h> +#include <util/random/shuffle.h> +#include <util/random/lcg_engine.h> +#include <util/random/random.h> +#include <util/random/normal.h> +#include <util/random/mersenne32.h> +#include <util/random/entropy.h> +#include <util/random/mersenne.h> +//#include <util/random/easy.h> +#include <util/random/mersenne64.h> +#include <util/random/fast.h> +#include <util/ysafeptr.h> +#include <util/charset/utf8.h> +#include <util/charset/unidata.h> +#include <util/charset/unicode_table.h> +#include <util/charset/wide.h> +#include <util/charset/recode_result.h> +#include <util/datetime/constants.h> +#include <util/datetime/base.h> +#include <util/datetime/parser.h> +#include <util/datetime/cputimer.h> +#include <util/datetime/systime.h> +#endif diff --git a/build/ya.conf.json b/build/ya.conf.json index 739feadf3b..5f7cc875d6 100644 --- a/build/ya.conf.json +++ b/build/ya.conf.json @@ -2646,14 +2646,14 @@ "android_ndk_version": 24 } }, - "bloat": { - "tools": { + "bloat": { + "tools": { "bloat": { "bottle": "bloat", "executable": "bloat" } - }, - "platforms": [ + }, + "platforms": [ { "host": { "os": "LINUX" @@ -2666,8 +2666,8 @@ }, "default": true } - ] - }, + ] + }, "pprof": { "tools": { "pprof": { @@ -2925,13 +2925,13 @@ } ] }, - "deploy": { - "tools": { + "deploy": { + "tools": { "deploy": { "bottle": "deploy", "executable": "deploy" } - }, + }, "platforms": [ { "host": { @@ -2940,15 +2940,15 @@ "default": true } ] - }, - "yt": { - "tools": { + }, + "yt": { + "tools": { "yt": { "bottle": "yt", "executable": "yt" } - }, - "platforms": [ + }, + "platforms": [ { "host": { "os": "LINUX" @@ -2961,8 +2961,8 @@ }, "default": true } - ] - }, + ] + }, "yndexer": { "tools": { "yndexer": { @@ -3079,13 +3079,13 @@ } ] }, - "uc": { - "tools": { + "uc": { + "tools": { "uc": { "bottle": "uc", "executable": "uc" } - }, + }, "platforms": [ { "host": { @@ -3094,14 +3094,14 @@ "default": true } ] - }, - "perf": { - "tools": { + }, + "perf": { + "tools": { "perf": { "bottle": "perf", "executable": "perf" } - }, + }, "platforms": [ { "host": { @@ -3110,7 +3110,7 @@ "default": true } ] - }, + }, "cuda-check": { "tools": { "cuda-check": { @@ -3143,14 +3143,14 @@ } ] }, - "samogonctl": { - "tools": { + "samogonctl": { + "tools": { "samogonctl": { "bottle": "samogonctl", "executable": "samogonctl" } - }, - "platforms": [ + }, + "platforms": [ { "host": { "os": "LINUX" @@ -3163,8 +3163,8 @@ }, "default": true } - ] - }, + ] + }, "jdk": { "tools": { "javac": { @@ -5944,19 +5944,19 @@ ] } }, - "bloat": { - "formula": { + "bloat": { + "formula": { "sandbox_id": [ 801218211 ], - "match": "Bloat" - }, - "executable": { + "match": "Bloat" + }, + "executable": { "bloat": [ "bloat" ] - } - }, + } + }, "jdk": { "formula": { "sandbox_id": [ @@ -6507,31 +6507,31 @@ ] } }, - "deploy": { - "formula": { + "deploy": { + "formula": { "sandbox_id": 243231127, - "match": "DEPLOY" - }, - "executable": { + "match": "DEPLOY" + }, + "executable": { "deploy": [ "samogon", "deploy" ] - } - }, - "yt": { - "formula": { + } + }, + "yt": { + "formula": { "sandbox_id": [ 1195249182 ], - "match": "YT" - }, - "executable": { + "match": "YT" + }, + "executable": { "yt": [ "yt" ] - } - }, + } + }, "yndexer": { "formula": { "sandbox_id": 992600186, @@ -6587,28 +6587,28 @@ ] } }, - "uc": { - "formula": { + "uc": { + "formula": { "sandbox_id": 505682252, - "match": "UC" - }, - "executable": { + "match": "UC" + }, + "executable": { "uc": [ "uc" ] - } - }, - "perf": { - "formula": { + } + }, + "perf": { + "formula": { "sandbox_id": 1130176134, "match": "infra/kernel/tools/perf/build/perf-static.tar.gz" - }, - "executable": { + }, + "executable": { "perf": [ "perf" ] - } - }, + } + }, "cuda-check": { "formula": { "sandbox_id": "1128218000", @@ -6635,17 +6635,17 @@ ] } }, - "samogonctl": { - "formula": { + "samogonctl": { + "formula": { "sandbox_id": 438053038, - "match": "SAMOGONCTL" - }, - "executable": { + "match": "SAMOGONCTL" + }, + "executable": { "samogonctl": [ "samogonctl" ] - } - }, + } + }, "gcc61": { "formula": { "sandbox_id": 63189766, diff --git a/build/ymake.core.conf b/build/ymake.core.conf index 650d90caf6..081833998b 100644 --- a/build/ymake.core.conf +++ b/build/ymake.core.conf @@ -6,7 +6,7 @@ # - Distributed (YT) cache warmup will take signigicant time to catch up and will need to recache everithing. # - Autocheck will rebuild and recache everything. # Use this with extreme care and only change if it is utlimately needed. Consider more specific XXX_FAKEIDs below instead. -FAKEID=3141592653 +FAKEID=3141592653 SANDBOX_FAKEID=${FAKEID}.7600000 CPP_FAKEID=9107927 @@ -136,18 +136,18 @@ when ($OS_CYGWIN == "yes") { USE_ASMLIB=no FSTACK= } - + CFLAGS+=$COVERAGE_FLAGS LDFLAGS+=$COVERAGE_FLAGS CHECKFLAG= LEX_FLAGS= NO_MAPREDUCE= - + when ($NO_MAPREDUCE == "yes") { C_DEFINES+=-DNO_MAPREDUCE } - + when ($OS_ANDROID == "yes") { PIE=yes } @@ -416,12 +416,12 @@ DEFAULT_ALLOCATOR=LF when ($OS_ANDROID == "yes" || $MSVC == "yes") { DEFAULT_ALLOCATOR=J } - + # tag:allocator when ($OS_CYGWIN == "yes" || $ARCH_PPC64LE == "yes") { DEFAULT_ALLOCATOR=SYSTEM -} - +} + # tag:allocator when ($OS_DARWIN == "yes") { DEFAULT_ALLOCATOR=SYSTEM @@ -991,19 +991,19 @@ RUN_NO_SANITIZE=$YMAKE_PYTHON ${input:"build/scripts/run_tool.py"} -- when ($IS_CROSS_SANITIZE) { RUN_NO_SANITIZE= } - + YIELD=$YMAKE_PYTHON ${input:"build/scripts/yield_line.py"} -- ${BINDIR}/__args XARGS=$YMAKE_PYTHON ${input:"build/scripts/xargs.py"} -- ${BINDIR}/__args - + RESPFILE_CMD=$YMAKE_PYTHON ${input:"build/scripts/writer.py"} FS_TOOLS=$YMAKE_PYTHON ${input:"build/scripts/fs_tools.py"} - -COPY_CMD=$FS_TOOLS copy + +COPY_CMD=$FS_TOOLS copy LINK_OR_COPY_CMD=$FS_TOOLS link_or_copy -REMOVE_FILE=$FS_TOOLS remove -MOVE_FILE=$FS_TOOLS rename - +REMOVE_FILE=$FS_TOOLS remove +MOVE_FILE=$FS_TOOLS rename + # tag:allocator tag:windows-specific MSVC_DYNAMICBASE=/DYNAMICBASE when ($ALLOCATOR == "LF") { @@ -1174,7 +1174,7 @@ module _BASE_UNIT: _BARE_UNIT { } SANITIZER_DEFINED=no - + when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") { CFLAGS+=-fsanitize=$SANITIZER_TYPE -D${SANITIZER_TYPE}_sanitizer_enabled $SANITIZER_CFLAGS -fno-omit-frame-pointer LDFLAGS+=-fsanitize=$SANITIZER_TYPE @@ -1185,7 +1185,7 @@ module _BASE_UNIT: _BARE_UNIT { LDFLAGS+=-fsanitize-blacklist=${input:"build/sanitize-blacklist.txt"} } } - + when ($SANITIZE_COVERAGE && $SANITIZE_COVERAGE != "no") { CFLAGS+=-fsanitize-coverage=$SANITIZE_COVERAGE LDFLAGS+=-fsanitize-coverage=$SANITIZE_COVERAGE @@ -1426,12 +1426,12 @@ when ($COMMON_LINK_SETTINGS == "yes") { } otherwise { select ($ALLOCATOR) { - "MIM" ? { - PEERDIR+=library/cpp/malloc/mimalloc - } - "HU" ? { - PEERDIR+=library/cpp/malloc/hu - } + "MIM" ? { + PEERDIR+=library/cpp/malloc/mimalloc + } + "HU" ? { + PEERDIR+=library/cpp/malloc/hu + } "TCMALLOC_256K" ? { PEERDIR+=library/cpp/malloc/tcmalloc PEERDIR+=contrib/libs/tcmalloc @@ -1628,12 +1628,12 @@ module _BASE_PROGRAM: _LINK_UNIT { } when ($MUSL == "yes") { - when ($MUSL_LITE == "yes") { - PEERDIR += contrib/libs/musl - } - otherwise { - PEERDIR += contrib/libs/musl/full - } + when ($MUSL_LITE == "yes") { + PEERDIR += contrib/libs/musl + } + otherwise { + PEERDIR += contrib/libs/musl/full + } } DEFAULT(CPU_CHECK yes) @@ -2234,15 +2234,15 @@ multimodule PY3TEST { # tag:cpp-specific tag:test module CPP_STYLE_TEST: PY3TEST_BIN { - DEPENDS(contrib/libs/clang12/tools/clang-format) - PEERDIR+=library/python/cpp_test -} - -macro STYLE(Globs...) { - _GLOB(STYLE_SRCS_GLOB ${pre=${ARCADIA_ROOT}:Globs}) - _STYLE(${STYLE_SRCS_GLOB}) -} - + DEPENDS(contrib/libs/clang12/tools/clang-format) + PEERDIR+=library/python/cpp_test +} + +macro STYLE(Globs...) { + _GLOB(STYLE_SRCS_GLOB ${pre=${ARCADIA_ROOT}:Globs}) + _STYLE(${STYLE_SRCS_GLOB}) +} + # tag:cpp-specific tag:deprecated tag:test ### @usage: GTEST_UGLY([name]) ### @@ -2305,8 +2305,8 @@ module EXECTEST: _BARE_UNIT { module Y_BENCHMARK: PROGRAM { PEERDIR(library/cpp/testing/benchmark/main) SET(MODULE_LANG CPP) -} - +} + # tag:cpp-specific tag:test ### @usage: G_BENCHMARK([benchmarkname]) ### @@ -2685,7 +2685,7 @@ module PY_ANY_MODULE: DLL_UNIT { } _SONAME=$SONAME$MODULE_VERSION - # -bundle + # -bundle when ($DARWIN == "yes") { LDFLAGS+=-flat_namespace } @@ -5258,7 +5258,7 @@ macro ADD_PERL_MODULE(Dir, Module) { ### Set memory allocator implementation for the PROGRAM()/DLL() module. ### This may only be specified for programs and dlls, use in other modules leads to configuration errors. ### -### Available allocators are: "LF", "LF_YT", "LF_DBG", "YT", "J", "B", "BM", "C", "TCMALLOC", "GOOGLE", "LOCKLESS", "SYSTEM", "FAKE", "MIM", "HU". +### Available allocators are: "LF", "LF_YT", "LF_DBG", "YT", "J", "B", "BM", "C", "TCMALLOC", "GOOGLE", "LOCKLESS", "SYSTEM", "FAKE", "MIM", "HU". ### - LF - lfalloc (https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/lfalloc) ### - LF_YT - Allocator selection for YT (https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/lfalloc/yt/ya.make) ### - LF_DBG - Debug allocator selection (https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/lfalloc/dbg/ya.make) @@ -5269,7 +5269,7 @@ macro ADD_PERL_MODULE(Dir, Module) { ### - Code: https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/balloc ### - BM - The balloc for market (agri@ commits from july 2018 till November 2018 saved) ### - C - Like B, but can be disabled for each thread to LF or SYSTEM one (B can be disabled only to SYSTEM) -### - MIM - Microsoft's mimalloc (actual version) (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/mimalloc) +### - MIM - Microsoft's mimalloc (actual version) (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/mimalloc) ### - TCMALLOC - Google TCMalloc (actual version) (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/tcmalloc) ### - GOOGLE - Google TCMalloc (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/galloc) ### - LOCKLESS - Allocator based upon lockless queues (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/lockless) @@ -5394,8 +5394,8 @@ when ($SPLIT_DWARF_VALUE == "yes" && $NO_SPLIT_DWARF != "yes" && $NO_DEBUGINFO ! ### Add the specified external static libraries to the program link macro EXTRALIBS_STATIC(Args...) { LDFLAGS(-Wl,-Bstatic ${Args} -Wl,-Bdynamic) -} - +} + ### @usage ADD_COMPILABLE_TRANSLATE(Dict Name Options...) ### ### Generate translation dictionary code to transdict.LOWER(Name).cpp that will than be compiled into library @@ -5578,18 +5578,18 @@ macro JOIN_SRCS(Out, Src...) { .CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_join_srcs.py"} ${output:Out} --ya-start-command-file ${input;rootrel:Src} --ya-end-command-file ${output_include;hide:Src} ${kv;hide:"p JS"} ${kv;hide:"pc magenta"} .SEM=target_joined_source $Out ${input:Src} ${output;hide;suf=.o:Out} && modules_required yandex_common.cmake _CONDITIONAL_SRCS($TIDY_VALUE $Src) -} - +} + ### @usage: JOIN_SRCS_GLOBAL(Out Src...) ### ### Join set of sources into single file named Out and send it for further processing as if it were listed as SRCS(GLOBAL Out). ### This macro doesn't place all file into Out, it emits #include<Src>... Use the for C++ source files only. ### You should specify file name with the extension as Out. Further processing will be done according to this extension. -macro JOIN_SRCS_GLOBAL(Out, Src...) { +macro JOIN_SRCS_GLOBAL(Out, Src...) { .CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_join_srcs.py"} ${output;noauto:Out} --ya-start-command-file ${input;rootrel:Src} --ya-end-command-file ${output_include;hide:Src} ${kv;hide:"p JS"} ${kv;hide:"pc magenta"} - SRCS(GLOBAL $Out) -} - + SRCS(GLOBAL $Out) +} + ### @usage: FLAT_JOIN_SRCS_GLOBAL(Out Src...) ### ### Join set of sources into single file named Out and send it for further processing as if it were listed as SRCS(GLOBAL Out). @@ -6351,9 +6351,9 @@ macro _SWIG_PYTHON_C(Src, DstSubPrefix) { macro BUILDWITH_RAGEL6(Src, Options...) { .CMD=$RUN_NO_SANITIZE ${tool:"contrib/tools/ragel6"} $RAGEL6_FLAGS ${Options} -I${ARCADIA_ROOT} -o ${output;nopath;noext;defext=.rl6.cpp:Src} ${input:Src} ${kv;hide:"p R6"} ${kv;hide:"pc yellow"} } - + # tag:python-processing tag:internal -# TODO: use it in [.pyx] cmd +# TODO: use it in [.pyx] cmd ### @usage: _PY_REGISTER() # internal ### ### Register Python 2.x module in internal resource file system. Arcadia Python 2.x importer will be retrieve these on import directive. @@ -6362,8 +6362,8 @@ macro BUILDWITH_RAGEL6(Src, Options...) { macro _PY_REGISTER(Func) { .CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_py_reg.py"} $Func ${output;noauto:Func.reg.cpp} ${requirements;hide:PY_REQUIREMENTS} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"} SRCS(GLOBAL $Func.reg.cpp) -} - +} + # tag:python-processing tag:internal ### @usage: _PY3_REGISTER() # internal ### @@ -6402,8 +6402,8 @@ macro _PY3_COMPILE_BYTECODE(SrcX, Src, Dst) { ### 2. Different syntax (see examples in codesearch or users/pg/tests/archive_test) macro ARCHIVE_ASM(NAME="", DONTCOMPRESS?"-p":"", REQUIREMENTS[], Files...) { .CMD=$ARCH_TOOL -q $DONTCOMPRESS ${input;join=\: :Files}: -o ${output;chksum;suf=$OBJ_SUF.rodata:NAME} ${requirements;hide:REQUIREMENTS} ${kv;hide:"p AR"} ${kv;hide:"pc light-cyan"} -} - +} + # tag:yweb-specific 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"} @@ -6787,21 +6787,21 @@ macro _LUAJIT_21_OBJDUMP(Src, OUT="") { macro _MX_BIN_TO_INFO(Src) { .CMD=${tool:"tools/mx_bin2info"} ${input:Src} ${output;nopath;noext;noauto:Src.info} ${kv;hide:"p MX"} ${kv;hide:"pc yellow"} } - -MX_GEN_TABLE_INCLS=${output_include;hide:"yabs_mx_calc_table.h"} \ -${output_include;hide:"kernel/matrixnet/mn_sse.h"} \ + +MX_GEN_TABLE_INCLS=${output_include;hide:"yabs_mx_calc_table.h"} \ +${output_include;hide:"kernel/matrixnet/mn_sse.h"} \ ${output_include;hide:"library/cpp/archive/yarchive.h"} \ -${output_include;hide:"util/memory/blob.h"} \ -${output_include;hide:"util/generic/hash.h"} \ -${output_include;hide:"util/generic/ptr.h"} \ -${output_include;hide:"util/generic/singleton.h"} - +${output_include;hide:"util/memory/blob.h"} \ +${output_include;hide:"util/generic/hash.h"} \ +${output_include;hide:"util/generic/ptr.h"} \ +${output_include;hide:"util/generic/singleton.h"} + macro _MX_GEN_TABLE(Srcs...) { .CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_mx_table.py"} $Srcs ${output;stdout:"mx_tables.cpp"} $MX_GEN_TABLE_INCLS ${kv;hide:"p MX"} ${kv;hide:"pc yellow"} PEERDIR(kernel/matrixnet) PEERDIR(library/cpp/archive) -} - +} + RELEV_FML_CODEGEN_INCLS=${output_include;hide:"kernel/relevfml/relev_fml.h"} ${output_include;hide:"library/cpp/sse/sse.h"} ### @usage: GENERATE_ENUM_SERIALIZATION(File.h) @@ -6826,7 +6826,7 @@ macro GENERATE_ENUM_SERIALIZATION_WITH_HEADER(File) { .SEM=generate_enum_serilization ${input:File} ${output;hide;suf=_serialized.o:File} GEN_HEADER ${output;suf=_serialized.h:File} INCLUDE_HEADERS ${input;rootrel:File} ${tool;hide:"tools/enum_parser/enum_parser/bin"} PEERDIR(tools/enum_parser/enum_serialization_runtime) } - + ### @usage: DEB_VERSION(File) ### ### Creates a header file DebianVersion.h define the DEBIAN_VERSION taken from the File. @@ -7039,8 +7039,8 @@ macro LUA(ScriptPath, IN{input}[], OUT{output}[], OUT_NOAUTO{output}[], TOOL{too ### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used. macro PYTHON(ScriptPath, 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} $YMAKE_PYTHON ${input:ScriptPath} $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 PY"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"} -} - +} + # tag:java-specific macro _RUN_JAVA(IN{input}[], OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], TOOL[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], HIDE_OUTPUT?"stderr2stdout":"stdout2stderr", REQUIREMENTS[], Args...) { PEERDIR(build/platform/java/jdk $JDK_RESOURCE_PEERDIR) @@ -7068,8 +7068,8 @@ macro _RUN_JAVA(IN{input}[], OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDE macro FROM_SANDBOX(Id, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], FILE?"--copy-to-dir":"--untar-to", AUTOUPDATED="", PREFIX=".", RENAME[], EXECUTABLE?"--executable":"", SBR="sbr:", REQUIREMENTS[]) { .CMD=${hide:SANDBOX_FAKEID} ${cwd:BINDIR} ${resource;pre=$SBR:Id} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_sandbox.py"} --resource-file $(RESOURCE_ROOT)/sbr/$Id/resource --resource-id $Id $FILE $PREFIX ${pre=--rename :RENAME} $EXECUTABLE -- $OUT $OUT_NOAUTO ${input;hide:"build/scripts/fetch_from.py"} ${output_include;hide:OUTPUT_INCLUDES} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${requirements;hide:REQUIREMENTS} ${requirements;hide:"network:full"} ${kv;hide:"p SB"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"} ADD_CHECK(check.resource $Id) -} - +} + ### @usage: FROM_MDS([FILE] key [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE]) ### ### Download resource from MDS with the specified key and process like [FROM_SANDBOX()](#macro_FROM_SANDBOX). @@ -7120,8 +7120,8 @@ otherwise { ### Compile .c files as .cpp ones within a module. macro COMPILE_C_AS_CXX() { SET(EXTRA_C_FLAGS $C_AS_CXX_FLAGS) -} - +} + ### @usage: NO_DEBUG_INFO() ### ### Compile files without debug info collection. @@ -7249,7 +7249,7 @@ when ($CLANG && $DEBUGINFO_LINES_ONLY == "yes" && $NO_DEBUGINFO != "yes") { } # TODO: configurable tar and touch -PACK_TGZ=${cwd:ARCADIA_BUILD_ROOT} tar -czf ${rootrel:OUTPUT} ${rootrel:INPUT} ${kv;hide:"p AR"} ${kv;hide:"pc light-red"} +PACK_TGZ=${cwd:ARCADIA_BUILD_ROOT} tar -czf ${rootrel:OUTPUT} ${rootrel:INPUT} ${kv;hide:"p AR"} ${kv;hide:"pc light-red"} # tag:internal ### @usage TOUCH(Outputs...) # internal diff --git a/build/ymake_conf.py b/build/ymake_conf.py index f186dc95c7..30219eb85e 100755 --- a/build/ymake_conf.py +++ b/build/ymake_conf.py @@ -488,10 +488,10 @@ class Build(object): def print_build(self): self._print_build_settings() - + host_os = System(self.host) host_os.print_host_settings() - + target_os = System(self.target) target_os.print_target_settings() @@ -522,21 +522,21 @@ class Build(object): emit('DISTBUILD', 'yes') elif self.build_system != 'ymake': raise ConfigureError() - + python_bin = preset('BUILD_PYTHON_BIN', '$(PYTHON)/python') emit('YMAKE_PYTHON', python_bin) emit('YMAKE_UNPICKLER', python_bin, '$ARCADIA_ROOT/build/plugins/_unpickler.py') - + @property def is_release(self): # TODO(somov): Проверить, бывают ли тут суффиксы на самом деле return self.build_type in ('release', 'relwithdebinfo', 'minsizerel', 'profile', 'gprof') or self.build_type.endswith('-release') - + @property def is_debug(self): return self.build_type in ('debug', 'debugnoasserts', 'fastdebug') or self.build_type.endswith('-debug') - + @property def is_fast_debug(self): return self.build_type == 'fastdebug' @@ -548,7 +548,7 @@ class Build(object): @property def is_coverage(self): return self.build_type == 'coverage' - + @property def is_sanitized(self): sanitizer = preset('SANITIZER_TYPE') @@ -684,7 +684,7 @@ class Build(object): return un_unicode(json.loads(base64.b64decode(base64str))) - + class YMake(object): def __init__(self, arcadia): self.arcadia = arcadia @@ -1415,11 +1415,11 @@ class GnuCompiler(Compiler): self.debug_info_flags.append('-ggnu-pubnames') self.cross_suffix = '' if is_positive('FORCE_NO_PIC') else '.pic' - + self.optimize = None - + self.configure_build_type() - + if self.tc.is_clang: self.sfdl_flags.append('-Qunused-arguments') @@ -1456,7 +1456,7 @@ class GnuCompiler(Compiler): def configure_build_type(self): if self.build.is_valgrind: self.c_defines.append('-DWITH_VALGRIND=1') - + if self.build.is_debug: self.c_foptions.append('$FSTACK') @@ -1516,7 +1516,7 @@ class GnuCompiler(Compiler): CFLAGS+=-fPIE LDFLAGS+=-fPIE -pie }''') - + append('CFLAGS', self.c_flags, '$DEBUG_INFO_FLAGS', self.c_foptions, '$C_WARNING_OPTS', '$GCC_PREPROCESSOR_OPTS', '$USER_CFLAGS', '$USER_CFLAGS_GLOBAL') append('CXXFLAGS', '$CFLAGS', '-std=' + self.tc.cxx_std, '$CXX_WARNING_OPTS', '$USER_CXXFLAGS', '$USER_CXXFLAGS_GLOBAL') append('CONLYFLAGS', '$USER_CONLYFLAGS', '$USER_CONLYFLAGS_GLOBAL') @@ -1528,7 +1528,7 @@ class GnuCompiler(Compiler): # TODO(somov): Убрать чтение настройки из os.environ emit('USE_ARC_PROFILE', 'yes' if preset('USE_ARC_PROFILE') or os.environ.get('USE_ARC_PROFILE') else 'no') emit('DEBUG_INFO_FLAGS', self.debug_info_flags) - + emit_big(''' when ($NO_WSHADOW == "yes") { C_WARNING_OPTS += -Wno-shadow @@ -1663,7 +1663,7 @@ class GnuCompiler(Compiler): emit('COMPILER_TIME_TRACE_POSTPROCESS') append('EXTRA_OUTPUT') - + style = ['${requirements;hide:CC_REQUIREMENTS} ${hide;kv:"p CC"} ${hide;kv:"pc green"}'] cxx_args = [ '$CLANG_TIDY_ARGS', @@ -1683,7 +1683,7 @@ class GnuCompiler(Compiler): '$YNDEXER_OUTPUT', '&& $COMPILER_TIME_TRACE_POSTPROCESS', ] + style - + c_args = [ '$CLANG_TIDY_ARGS', '$YNDEXER_ARGS', @@ -1722,7 +1722,7 @@ class GnuCompiler(Compiler): emit('_SRC_C_CMD', ' '.join(c_args)) emit('_SRC_M_CMD', '$SRC_c($SRC $SRCFLAGS)') emit('_SRC_MASM_CMD', '$_EMPTY_CMD') - + # fuzzing configuration if self.tc.is_clang: if self.tc.version_at_least(12): @@ -1823,7 +1823,7 @@ class LD(Linker): self.ar = '{}/gcc/bin/gcc-ar'.format(self.tc.name_marker) else: self.ar = 'ar' - + self.ar_type = 'GNU_AR' self.llvm_ar_format = 'None' @@ -1887,7 +1887,7 @@ class LD(Linker): self.ld_flags.append('-Wl,-no_deduplicate') if not self.tc.is_clang: self.ld_flags.append('-Wl,-no_compact_unwind') - + self.thread_library = select([ (target.is_linux or target.is_macos, '-lpthread'), ]) @@ -1906,7 +1906,7 @@ class LD(Linker): if target.is_linux or target.is_android: self.ld_export_dynamic_flag = '-rdynamic' self.use_stdlib = '-nodefaultlibs' - + if target.is_linux or target.is_android or target.is_cygwin or target.is_none: self.start_group = '-Wl,--start-group' self.end_group = '-Wl,--end-group' @@ -1914,13 +1914,13 @@ class LD(Linker): self.no_whole_archive = '-Wl,--no-whole-archive' self.ld_stripflag = '-s' self.soname_option = '-soname' - + if target.is_macos or target.is_ios: self.use_stdlib = '-nodefaultlibs' self.soname_option = '-install_name' if not preset('NO_DEBUGINFO'): self.dwarf_command = '$DWARF_TOOL $TARGET -o ${output;pre=$MODULE_PREFIX$REALPRJNAME.dSYM/Contents/Resources/DWARF/$MODULE_PREFIX:REALPRJNAME}' - + if self.target.is_ios and preset('MAPSMOBI_BUILD_TARGET') and self.target.is_arm: self.ld_flags.extend(('-fembed-bitcode', '-Wl,-bitcode_verify')) |