diff options
author | orivej <orivej@yandex-team.ru> | 2022-02-10 16:45:01 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:01 +0300 |
commit | 2d37894b1b037cf24231090eda8589bbb44fb6fc (patch) | |
tree | be835aa92c6248212e705f25388ebafcf84bc7a1 /build/plugins/ssqls.py | |
parent | 718c552901d703c502ccbefdfc3c9028d608b947 (diff) | |
download | ydb-2d37894b1b037cf24231090eda8589bbb44fb6fc.tar.gz |
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'build/plugins/ssqls.py')
-rw-r--r-- | build/plugins/ssqls.py | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/build/plugins/ssqls.py b/build/plugins/ssqls.py index de3fe2cf5f..618cbc11bc 100644 --- a/build/plugins/ssqls.py +++ b/build/plugins/ssqls.py @@ -1,40 +1,40 @@ -from os.path import splitext - -import _import_wrapper as iw -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): - paths = lambda nodes: filter(None, (e.get('path') for e in nodes)) - 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(): - iw.addparser('ssqls', SSQLSParser) +from os.path import splitext + +import _import_wrapper as iw +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): + paths = lambda nodes: filter(None, (e.get('path') for e in nodes)) + 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(): + iw.addparser('ssqls', SSQLSParser) |