summaryrefslogtreecommitdiffstats
path: root/build/scripts/yndexer.py
diff options
context:
space:
mode:
authormonster <[email protected]>2022-07-07 14:41:37 +0300
committermonster <[email protected]>2022-07-07 14:41:37 +0300
commit06e5c21a835c0e923506c4ff27929f34e00761c2 (patch)
tree75efcbc6854ef9bd476eb8bf00cc5c900da436a2 /build/scripts/yndexer.py
parent03f024c4412e3aa613bb543cf1660176320ba8f4 (diff)
fix ya.make
Diffstat (limited to 'build/scripts/yndexer.py')
-rw-r--r--build/scripts/yndexer.py79
1 files changed, 0 insertions, 79 deletions
diff --git a/build/scripts/yndexer.py b/build/scripts/yndexer.py
deleted file mode 100644
index a38e28ba99f..00000000000
--- a/build/scripts/yndexer.py
+++ /dev/null
@@ -1,79 +0,0 @@
-import sys
-import subprocess
-import threading
-import os
-import re
-
-
-rx_resource_dir = re.compile(r'libraries: =([^:]*)')
-
-
-def _try_to_kill(process):
- try:
- process.kill()
- except Exception:
- pass
-
-
-def touch(path):
- if not os.path.exists(path):
- with open(path, 'w'):
- pass
-
-
-class Process(object):
- def __init__(self, args):
- self._process = subprocess.Popen(args)
- self._event = threading.Event()
- self._result = None
- thread = threading.Thread(target=self._run)
- thread.setDaemon(True)
- thread.start()
-
- def _run(self):
- self._process.communicate()
- self._result = self._process.returncode
- self._event.set()
-
- def wait(self, timeout):
- self._event.wait(timeout=timeout)
- _try_to_kill(self._process)
- return self._result
-
-
-if __name__ == '__main__':
- args = sys.argv
-
- yndexer = args[1]
- timeout = int(args[2])
- arc_root = args[3]
- build_root = args[4]
- input_file = args[5]
- output_file = args[-1]
- tail_args = args[6:-1]
-
- subprocess.check_call(tail_args)
-
- clang = tail_args[0]
- out = subprocess.check_output([clang, '-print-search-dirs'])
- resource_dir = rx_resource_dir.search(out).group(1)
-
- yndexer_args = [
- yndexer, input_file,
- '-pb2',
- '-i', 'arc::{}'.format(arc_root),
- '-i', 'build::{}'.format(build_root),
- '-i', '.IGNORE::/',
- '-o', os.path.dirname(output_file),
- '-n', os.path.basename(output_file).rsplit('.ydx.pb2', 1)[0],
- '--'
- ] + tail_args + [
- '-resource-dir', resource_dir,
- ]
-
- process = Process(yndexer_args)
- result = process.wait(timeout=timeout)
-
- if result != 0:
- print >> sys.stderr, 'Yndexing process finished with code', result
- touch(output_file)