diff options
author | mekagem <mekagem@yandex-team.ru> | 2022-02-10 16:48:44 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:48:44 +0300 |
commit | da8aac97277cff07a0d2e4461ef132cc358bb403 (patch) | |
tree | fa6463a828ea6cc0dee98b32737fa8e31236ab83 | |
parent | 42763e077672e2c34762ae2170d753999fd09f97 (diff) | |
download | ydb-da8aac97277cff07a0d2e4461ef132cc358bb403.tar.gz |
Restoring authorship annotation for <mekagem@yandex-team.ru>. Commit 1 of 2.
-rw-r--r-- | build/scripts/error.py | 38 | ||||
-rw-r--r-- | build/scripts/generate_pom.py | 148 | ||||
-rw-r--r-- | build/ya.conf.json | 26 | ||||
-rw-r--r-- | contrib/python/ya.make | 2 | ||||
-rw-r--r-- | library/python/strings/strings.py | 2 | ||||
-rw-r--r-- | util/system/platform.h | 2 |
6 files changed, 109 insertions, 109 deletions
diff --git a/build/scripts/error.py b/build/scripts/error.py index f7d8ecb2cc..f9e803ca19 100644 --- a/build/scripts/error.py +++ b/build/scripts/error.py @@ -1,35 +1,35 @@ # Sync content of this file with devtools/ya/core/error/__init__.py -TEMPORARY_ERROR_MESSAGES = [ +TEMPORARY_ERROR_MESSAGES = [ 'Connection reset by peer', 'Connection timed out', 'Function not implemented', 'I/O operation on closed file', 'Internal Server Error', 'Network connection closed unexpectedly', - 'Network is unreachable', + 'Network is unreachable', 'No route to host', 'No space left on device', 'Not enough space', 'Temporary failure in name resolution', 'The read operation timed out', 'timeout: timed out', -] - - -# Node exit codes -class ExitCodes(object): - TEST_FAILED = 10 - COMPILATION_FAILED = 11 - INFRASTRUCTURE_ERROR = 12 +] + + +# Node exit codes +class ExitCodes(object): + TEST_FAILED = 10 + COMPILATION_FAILED = 11 + INFRASTRUCTURE_ERROR = 12 NOT_RETRIABLE_ERROR = 13 YT_STORE_FETCH_ERROR = 14 - - -def merge_exit_codes(exit_codes): + + +def merge_exit_codes(exit_codes): return max(e if e >= 0 else 1 for e in exit_codes) if exit_codes else 0 - - + + def is_temporary_error(exc): import logging logger = logging.getLogger(__name__) @@ -47,7 +47,7 @@ def is_temporary_error(exc): import socket - if isinstance(exc, socket.timeout) or isinstance(getattr(exc, 'reason', None), socket.timeout): + if isinstance(exc, socket.timeout) or isinstance(getattr(exc, 'reason', None), socket.timeout): logger.debug("Socket timeout exception: %s", exc) return True @@ -69,9 +69,9 @@ def is_temporary_error(exc): exc_str = str(exc) - for message in TEMPORARY_ERROR_MESSAGES: - if message in exc_str: + for message in TEMPORARY_ERROR_MESSAGES: + if message in exc_str: logger.debug("Found temporary error pattern (%s): %s", message, exc_str) - return True + return True return False diff --git a/build/scripts/generate_pom.py b/build/scripts/generate_pom.py index 200caebc0b..827ecf2120 100644 --- a/build/scripts/generate_pom.py +++ b/build/scripts/generate_pom.py @@ -1,27 +1,27 @@ -import sys -import xml.etree.ElementTree as et -import argparse +import sys +import xml.etree.ElementTree as et +import argparse import os import json import base64 import re - - -DEFAULT_YANDEX_GROUP_ID = 'ru.yandex' -DEFAULT_NAMESPACE = 'http://maven.apache.org/POM/4.0.0' -XSI_NAMESPACE = 'http://www.w3.org/2001/XMLSchema-instance' -SCHEMA_LOCATION = 'http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd' -MODEL_VERSION = '4.0.0' - -MAVEN_PLUGIN_GROUP_ID = 'org.apache.maven.plugins' -MAVEN_PLUGIN_ARTIFACT_ID = 'maven-compiler-plugin' -MAVEN_PLUGIN_VERSION = '3.3' -JAVA_LANGUAGE_LEVEL = '1.8' - + + +DEFAULT_YANDEX_GROUP_ID = 'ru.yandex' +DEFAULT_NAMESPACE = 'http://maven.apache.org/POM/4.0.0' +XSI_NAMESPACE = 'http://www.w3.org/2001/XMLSchema-instance' +SCHEMA_LOCATION = 'http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd' +MODEL_VERSION = '4.0.0' + +MAVEN_PLUGIN_GROUP_ID = 'org.apache.maven.plugins' +MAVEN_PLUGIN_ARTIFACT_ID = 'maven-compiler-plugin' +MAVEN_PLUGIN_VERSION = '3.3' +JAVA_LANGUAGE_LEVEL = '1.8' + MAVEN_BUILD_HELPER_GROUP_ID = 'org.codehaus.mojo' MAVEN_BUILD_HELPER_ARTIFACT_ID = 'build-helper-maven-plugin' MAVEN_BUILD_HELPER_VERSION = '1.9.1' - + MAVEN_EXEC_GROUP_ID = 'org.codehaus.mojo' MAVEN_EXEC_ARTIFACT_ID = 'exec-maven-plugin' MAVEN_EXEC_VERSION = '1.5.0' @@ -31,10 +31,10 @@ MAVEN_SUREFIRE_ARTIFACT_ID = 'maven-surefire-plugin' MAVEN_SUREFIRE_VERSION = '2.12.2' -def target_from_contrib(target_path): - return target_path.startswith('contrib') - - +def target_from_contrib(target_path): + return target_path.startswith('contrib') + + def split_artifacts(s): m = re.match('^([^:]*:[^:]*:[^:]*:[^:]*)(.*)$', s) if not m or not m.groups(): @@ -62,40 +62,40 @@ def build_pom_and_export_to_maven(**kwargs): run_java_programs = [json.loads(base64.b64decode(i)) for i in kwargs.get('run_java_programs')] test_source_dirs = kwargs.get('test_source_dirs') test_resource_dirs = kwargs.get('test_resource_dirs') - + modules = [] - def _indent(elem, level=0): - ind = "\n" + level * " " - if len(elem): - if not elem.text or not elem.text.strip(): - elem.text = ind + " " - if not elem.tail or not elem.tail.strip(): - elem.tail = ind - for elem in elem: - _indent(elem, level + 1) - if not elem.tail or not elem.tail.strip(): - elem.tail = ind - else: - if level and (not elem.tail or not elem.tail.strip()): - elem.tail = ind - - project = et.Element( - '{}{}{}project'.format('{', DEFAULT_NAMESPACE, '}'), - attrib={'{}{}{}schemaLocation'.format('{', XSI_NAMESPACE, '}'): SCHEMA_LOCATION} - ) - - group_id, artifact_id, version = target.split(':') - - et.SubElement(project, 'modelVersion').text = MODEL_VERSION - et.SubElement(project, 'groupId').text = group_id - et.SubElement(project, 'artifactId').text = artifact_id - et.SubElement(project, 'version').text = version + def _indent(elem, level=0): + ind = "\n" + level * " " + if len(elem): + if not elem.text or not elem.text.strip(): + elem.text = ind + " " + if not elem.tail or not elem.tail.strip(): + elem.tail = ind + for elem in elem: + _indent(elem, level + 1) + if not elem.tail or not elem.tail.strip(): + elem.tail = ind + else: + if level and (not elem.tail or not elem.tail.strip()): + elem.tail = ind + + project = et.Element( + '{}{}{}project'.format('{', DEFAULT_NAMESPACE, '}'), + attrib={'{}{}{}schemaLocation'.format('{', XSI_NAMESPACE, '}'): SCHEMA_LOCATION} + ) + + group_id, artifact_id, version = target.split(':') + + et.SubElement(project, 'modelVersion').text = MODEL_VERSION + et.SubElement(project, 'groupId').text = group_id + et.SubElement(project, 'artifactId').text = artifact_id + et.SubElement(project, 'version').text = version et.SubElement(project, 'packaging').text = packaging - - properties = et.SubElement(project, 'properties') - et.SubElement(properties, 'project.build.sourceEncoding').text = 'UTF-8' - + + properties = et.SubElement(project, 'properties') + et.SubElement(properties, 'project.build.sourceEncoding').text = 'UTF-8' + if prop_vars: for property, value in json.loads(base64.b64decode(prop_vars)).items(): et.SubElement(properties, property).text = value @@ -134,14 +134,14 @@ def build_pom_and_export_to_maven(**kwargs): plugins = et.SubElement(build, 'plugins') if packaging != 'pom': - maven_plugin = et.SubElement(plugins, 'plugin') - et.SubElement(maven_plugin, 'groupId').text = MAVEN_PLUGIN_GROUP_ID - et.SubElement(maven_plugin, 'artifactId').text = MAVEN_PLUGIN_ARTIFACT_ID - et.SubElement(maven_plugin, 'version').text = MAVEN_PLUGIN_VERSION - configuration = et.SubElement(maven_plugin, 'configuration') - et.SubElement(configuration, 'source').text = JAVA_LANGUAGE_LEVEL - et.SubElement(configuration, 'target').text = JAVA_LANGUAGE_LEVEL - + maven_plugin = et.SubElement(plugins, 'plugin') + et.SubElement(maven_plugin, 'groupId').text = MAVEN_PLUGIN_GROUP_ID + et.SubElement(maven_plugin, 'artifactId').text = MAVEN_PLUGIN_ARTIFACT_ID + et.SubElement(maven_plugin, 'version').text = MAVEN_PLUGIN_VERSION + configuration = et.SubElement(maven_plugin, 'configuration') + et.SubElement(configuration, 'source').text = JAVA_LANGUAGE_LEVEL + et.SubElement(configuration, 'target').text = JAVA_LANGUAGE_LEVEL + if source_dirs or external_jars or test_source_dirs: build_helper_plugin = et.SubElement(plugins, 'plugin') et.SubElement(build_helper_plugin, 'groupId').text = MAVEN_BUILD_HELPER_GROUP_ID @@ -214,9 +214,9 @@ def build_pom_and_export_to_maven(**kwargs): for target_dependency in target_dependencies + test_target_dependencies: dependency = et.SubElement(dependencies, 'dependency') dependency_info = split_artifacts(target_dependency) - + group_id, artifact_id, version, classifier = dependency_info[0].split(':') - + et.SubElement(dependency, 'groupId').text = group_id et.SubElement(dependency, 'artifactId').text = artifact_id et.SubElement(dependency, 'version').text = version @@ -224,7 +224,7 @@ def build_pom_and_export_to_maven(**kwargs): et.SubElement(dependency, 'classifier').text = classifier if target_dependency in test_target_dependencies: et.SubElement(dependency, 'scope').text = 'test' - + if len(dependency_info) > 1: exclusions = et.SubElement(dependency, 'exclusions') for exclude in dependency_info[1:]: @@ -242,17 +242,17 @@ def build_pom_and_export_to_maven(**kwargs): for classpath_exclude in test_target_dependencies_exclude: et.SubElement(classpath_excludes, 'classpathDependencyExclude').text = classpath_exclude - et.register_namespace('', DEFAULT_NAMESPACE) - et.register_namespace('xsi', XSI_NAMESPACE) - - _indent(project) - + et.register_namespace('', DEFAULT_NAMESPACE) + et.register_namespace('xsi', XSI_NAMESPACE) + + _indent(project) + et.ElementTree(project).write(pom_path) sys.stderr.write("[MAVEN EXPORT] Generated {} file for target {}\n".format(os.path.basename(pom_path), target_path)) - - -if __name__ == '__main__': - parser = argparse.ArgumentParser() + + +if __name__ == '__main__': + parser = argparse.ArgumentParser() parser.add_argument('--target-path', action='store', default='') parser.add_argument('--target', action='store') parser.add_argument('--pom-path', action='store') @@ -270,6 +270,6 @@ if __name__ == '__main__': parser.add_argument('--properties') parser.add_argument('--test-source-dirs', action='append', default=[]) parser.add_argument('--test-resource-dirs', action='append', default=[]) - args = parser.parse_args() - + args = parser.parse_args() + build_pom_and_export_to_maven(**vars(args)) diff --git a/build/ya.conf.json b/build/ya.conf.json index 5f7cc875d6..65f8998c1a 100644 --- a/build/ya.conf.json +++ b/build/ya.conf.json @@ -3902,13 +3902,13 @@ } ] }, - "mvn": { - "tools": { + "mvn": { + "tools": { "mvn": { "bottle": "maven", "executable": "mvn" } - }, + }, "platforms": [ { "host": { @@ -3929,7 +3929,7 @@ "default": true } ] - }, + }, "fast_diff": { "tools": { "fast_diff": { @@ -7101,7 +7101,7 @@ }, "ant": { "formula": { - "sandbox_id": 36996223, + "sandbox_id": 36996223, "match": "ant" }, "executable": { @@ -7112,18 +7112,18 @@ ] } }, - "maven": { - "formula": { - "sandbox_id": 39222824, - "match": "maven" - }, - "executable": { + "maven": { + "formula": { + "sandbox_id": 39222824, + "match": "maven" + }, + "executable": { "mvn": [ "bin", "mvn" ] - } - }, + } + }, "fast_diff": { "formula": { "sandbox_id": 42519064, diff --git a/contrib/python/ya.make b/contrib/python/ya.make index d01ced9f3a..5cfe2ec480 100644 --- a/contrib/python/ya.make +++ b/contrib/python/ya.make @@ -558,7 +558,7 @@ RECURSE( jsonpickle jsonpointer jsonref - jsonschema + jsonschema jsonstreams juggler_sdk juggler_sdk/cli diff --git a/library/python/strings/strings.py b/library/python/strings/strings.py index 5bfddfe78a..4559f3793f 100644 --- a/library/python/strings/strings.py +++ b/library/python/strings/strings.py @@ -12,7 +12,7 @@ logger = logging.getLogger(__name__) DEFAULT_ENCODING = 'utf-8' ENCODING_ERRORS_POLICY = 'replace' - + def left_strip(el, prefix): """ Strips prefix at the left of el diff --git a/util/system/platform.h b/util/system/platform.h index 58f310ab34..a44a6b7ea3 100644 --- a/util/system/platform.h +++ b/util/system/platform.h @@ -91,7 +91,7 @@ #define _x86_64_ #endif -#if defined(__i386__) || defined(_M_IX86) +#if defined(__i386__) || defined(_M_IX86) #define _i386_ #endif |