diff options
author | nalpp <nalpp@yandex-team.ru> | 2022-02-10 16:46:45 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:45 +0300 |
commit | 87f3eb38999df2d3c1cb77f8ffb9c52ec9c516fb (patch) | |
tree | f4ab0734eecf35b22f21952d1aa15496f267a6a3 /build/scripts/yndexer.py | |
parent | 198698b9c1e18958addc9682fbfba4576d604757 (diff) | |
download | ydb-87f3eb38999df2d3c1cb77f8ffb9c52ec9c516fb.tar.gz |
Restoring authorship annotation for <nalpp@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'build/scripts/yndexer.py')
-rw-r--r-- | build/scripts/yndexer.py | 94 |
1 files changed, 47 insertions, 47 deletions
diff --git a/build/scripts/yndexer.py b/build/scripts/yndexer.py index a38e28ba99f..007724d9a34 100644 --- a/build/scripts/yndexer.py +++ b/build/scripts/yndexer.py @@ -1,56 +1,56 @@ import sys import subprocess -import threading +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): + +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 - - + 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] + 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) @@ -71,9 +71,9 @@ if __name__ == '__main__': '-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) + process = Process(yndexer_args) + result = process.wait(timeout=timeout) + + if result != 0: + print >> sys.stderr, 'Yndexing process finished with code', result + touch(output_file) |