aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorarcadia-devtools <arcadia-devtools@yandex-team.ru>2022-06-10 01:13:52 +0300
committerarcadia-devtools <arcadia-devtools@yandex-team.ru>2022-06-10 01:13:52 +0300
commit1f0ba76cc76d92a01b47e922c28c008078844efd (patch)
treea5d87e333a485bdda66b33e0c7e93b273b525f2a
parent369c1c09940bf144ee472ea355968b6caec7435d (diff)
downloadydb-1f0ba76cc76d92a01b47e922c28c008078844efd.tar.gz
intermediate changes
ref:f2c1c3c5ceddb1e8ce4f8edb02e775ebb5ec9cd7
-rw-r--r--build/plugins/_custom_command.py65
-rw-r--r--build/plugins/_import_wrapper.py22
-rw-r--r--build/plugins/_unpickler.py42
-rw-r--r--build/plugins/code_generator.py6
-rw-r--r--build/plugins/ssqls.py4
-rw-r--r--build/plugins/tests/fake_ymake.py2
-rw-r--r--build/plugins/tests/test_code_generator.py4
-rw-r--r--build/plugins/tests/test_ssqls.py4
8 files changed, 15 insertions, 134 deletions
diff --git a/build/plugins/_custom_command.py b/build/plugins/_custom_command.py
deleted file mode 100644
index 9692214b22..0000000000
--- a/build/plugins/_custom_command.py
+++ /dev/null
@@ -1,65 +0,0 @@
-import subprocess
-import sys
-import os
-
-import _common as common
-
-
-class CustomCommand(object):
- def __setstate__(self, sdict):
- if isinstance(sdict, tuple):
- for elem in sdict:
- if isinstance(elem, dict):
- for key in elem:
- setattr(self, key, elem[key])
-
- self._source_root = None
- self._build_root = None
-
- def set_source_root(self, path):
- self._source_root = path
-
- def set_build_root(self, path):
- self._build_root = path
-
- 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))
-
- if stdout_path:
- stdout = open(stdout_path, 'wb')
- else:
- stdout = None
-
- env = os.environ.copy()
- env['ASAN_OPTIONS'] = 'detect_leaks=0'
-
- 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 _get_call_specs(self, name, kwargs):
- if isinstance(kwargs, dict):
- param = kwargs.get(name, None)
- if param:
- return self.resolve_path(param)
- return None
-
-
-def addrule(*unused):
- pass
-
-
-def addparser(*unused, **kwargs):
- pass
diff --git a/build/plugins/_import_wrapper.py b/build/plugins/_import_wrapper.py
deleted file mode 100644
index 3711f1e482..0000000000
--- a/build/plugins/_import_wrapper.py
+++ /dev/null
@@ -1,22 +0,0 @@
-try:
- from ymake import CustomCommand as RealCustomCommand
- from ymake import addparser
- from ymake import subst
-
- 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 addparser # noqa
-
-
-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
deleted file mode 100644
index e01e7b3118..0000000000
--- a/build/plugins/_unpickler.py
+++ /dev/null
@@ -1,42 +0,0 @@
-import sys
-
-sys.dont_write_bytecode = True
-
-import argparse
-import base64
-try:
- import cPickle as pickle
-except Exception:
- import pickle
-
-import _common as common
-
-
-def main():
- parser = argparse.ArgumentParser()
- parser.add_argument('--data', help='pickled object of TCustomCommand class', required=True)
- parser.add_argument('--src-root', help='$S real path', required=True)
- parser.add_argument('--build-root', help='$B real path', required=True)
- parser.add_argument('--tools', help='binaries needed by command', required=True, nargs='+')
- args, unknown_args = parser.parse_known_args()
-
- encoded_cmd = args.data
- src_root = args.src_root
- build_root = args.build_root
- tools = args.tools
-
- assert (int(tools[0]) == len(tools[1:])), "tools quantity != tools number!"
-
- cmd_object = pickle.loads(base64.b64decode(encoded_cmd))
-
- cmd_object.set_source_root(src_root)
- cmd_object.set_build_root(build_root)
-
- if len(tools[1:]) == 0:
- cmd_object.run(unknown_args, common.get_interpreter_path())
- else:
- cmd_object.run(unknown_args, *tools[1:])
-
-
-if __name__ == '__main__':
- main()
diff --git a/build/plugins/code_generator.py b/build/plugins/code_generator.py
index ca8bb18c15..c1dc792201 100644
--- a/build/plugins/code_generator.py
+++ b/build/plugins/code_generator.py
@@ -1,7 +1,7 @@
import re
import os
-import _import_wrapper as iw
+import ymake
pattern = re.compile(r"#include\s*[<\"](?P<INDUCED>[^>\"]+)[>\"]|(?:@|{@)\s*(?:import|include|from)\s*[\"'](?P<INCLUDE>[^\"']+)[\"']")
@@ -41,5 +41,5 @@ class CodeGeneratorTemplateParser(object):
def init():
- iw.addparser('markettemplate', CodeGeneratorTemplateParser)
- iw.addparser('macro', CodeGeneratorTemplateParser)
+ ymake.addparser('markettemplate', CodeGeneratorTemplateParser)
+ ymake.addparser('macro', CodeGeneratorTemplateParser)
diff --git a/build/plugins/ssqls.py b/build/plugins/ssqls.py
index 618cbc11bc..8c3ea86829 100644
--- a/build/plugins/ssqls.py
+++ b/build/plugins/ssqls.py
@@ -1,6 +1,6 @@
from os.path import splitext
-import _import_wrapper as iw
+import ymake
from _common import resolve_includes
@@ -37,4 +37,4 @@ class SSQLSParser(object):
def init():
- iw.addparser('ssqls', SSQLSParser)
+ ymake.addparser('ssqls', SSQLSParser)
diff --git a/build/plugins/tests/fake_ymake.py b/build/plugins/tests/fake_ymake.py
new file mode 100644
index 0000000000..a20d28525a
--- /dev/null
+++ b/build/plugins/tests/fake_ymake.py
@@ -0,0 +1,2 @@
+def addparser():
+ pass
diff --git a/build/plugins/tests/test_code_generator.py b/build/plugins/tests/test_code_generator.py
index a675d9068c..771babc0c0 100644
--- a/build/plugins/tests/test_code_generator.py
+++ b/build/plugins/tests/test_code_generator.py
@@ -1,3 +1,7 @@
+import sys
+from build.plugins.tests import fake_ymake
+sys.modules['ymake'] = fake_ymake
+
from build.plugins import code_generator
diff --git a/build/plugins/tests/test_ssqls.py b/build/plugins/tests/test_ssqls.py
index 2a1d032109..08798b1591 100644
--- a/build/plugins/tests/test_ssqls.py
+++ b/build/plugins/tests/test_ssqls.py
@@ -1,3 +1,7 @@
+import sys
+from build.plugins.tests import fake_ymake
+sys.modules['ymake'] = fake_ymake
+
import xml.etree.cElementTree as ET
from build.plugins import ssqls