diff options
author | snermolaev <snermolaev@yandex-team.com> | 2023-09-28 06:22:03 +0300 |
---|---|---|
committer | snermolaev <snermolaev@yandex-team.com> | 2023-09-28 06:54:01 +0300 |
commit | f81163b16a32dcba19f1502ed5f99d236e843583 (patch) | |
tree | 620ae0d17229c56b4e5e21715b4e456f29bbc250 | |
parent | 5293f6848120dda6951497e3c264e5c088b4d884 (diff) | |
download | ydb-f81163b16a32dcba19f1502ed5f99d236e843583.tar.gz |
move ssql.py to build/internal/plugins
-rw-r--r-- | build/plugins/ssqls.py | 43 | ||||
-rw-r--r-- | build/plugins/tests/test_ssqls.py | 23 | ||||
-rw-r--r-- | build/plugins/tests/ya.make | 1 | ||||
-rw-r--r-- | build/plugins/ya.make | 2 |
4 files changed, 0 insertions, 69 deletions
diff --git a/build/plugins/ssqls.py b/build/plugins/ssqls.py deleted file mode 100644 index 0c47b90772..0000000000 --- a/build/plugins/ssqls.py +++ /dev/null @@ -1,43 +0,0 @@ -from os.path import splitext - -import ymake -from _common import resolve_includes - - -class SSQLSParser(object): - def __init__(self, path, unit): - s = unit.resolve_arc_path(path) - assert s.startswith('$S/') and s.endswith('.ssqls'), s - h = '$B/' + s[3:-6] + '.h' - - import xml.etree.cElementTree as ET - - try: - doc = ET.parse(path) - except ET.ParseError as e: - unit.message(['error', 'malformed XML {}: {}'.format(path, e)]) - doc = ET.Element('DbObject') - xmls, headers = self.parse_doc(doc) - self._includes = resolve_includes(unit, s, xmls) - self._induced = {'cpp': [h], 'h': resolve_includes(unit, h, headers)} - - @staticmethod - def parse_doc(doc): - def paths(nodes): - return [x for x in (e.get('path') for e in nodes) if x] - - includes = doc.findall('include') - ancestors = paths(doc.findall('ancestors/ancestor')) - headers = [e.text.strip('<>""') for e in includes] - headers += [splitext(s)[0] + '.h' for s in ancestors] - return paths(includes) + ancestors, headers - - def includes(self): - return self._includes - - def induced_deps(self): - return self._induced - - -def init(): - ymake.addparser('ssqls', SSQLSParser) diff --git a/build/plugins/tests/test_ssqls.py b/build/plugins/tests/test_ssqls.py deleted file mode 100644 index 44a775f482..0000000000 --- a/build/plugins/tests/test_ssqls.py +++ /dev/null @@ -1,23 +0,0 @@ -import xml.etree.cElementTree as ET - -import ssqls - - -example = '''\ -<?xml version="1.0" encoding="utf-8"?> -<DbObject> - <include path="A.ssqls"><a.h></include> - <include>"b.h"</include> - - <ancestors> - <ancestor path="C.ssqls"/> - </ancestors> -</DbObject> -''' - - -def test_include_parser(): - doc = ET.fromstring(example) - xmls, headers = ssqls.SSQLSParser.parse_doc(doc) - assert headers == ['a.h', 'b.h', 'C.h'] - assert xmls == ['A.ssqls', 'C.ssqls'] diff --git a/build/plugins/tests/ya.make b/build/plugins/tests/ya.make index 1dae544917..1b0f3cfc32 100644 --- a/build/plugins/tests/ya.make +++ b/build/plugins/tests/ya.make @@ -5,7 +5,6 @@ OWNER(g:ymake) TEST_SRCS( test_common.py test_requirements.py - test_ssqls.py ) PEERDIR( diff --git a/build/plugins/ya.make b/build/plugins/ya.make index 75b033baf8..fc69260f97 100644 --- a/build/plugins/ya.make +++ b/build/plugins/ya.make @@ -5,8 +5,6 @@ PY2_LIBRARY() PY_SRCS( TOP_LEVEL - ssqls.py - _common.py _requirements.py ) |