diff options
author | spreis <spreis@yandex-team.com> | 2024-06-12 06:54:26 +0300 |
---|---|---|
committer | spreis <spreis@yandex-team.com> | 2024-06-12 12:20:00 +0300 |
commit | f5553951374bace336d651d286a1132405c42225 (patch) | |
tree | 2f1d9001188feda9d2b5b5a1d94c024614bea54f /build/scripts/compile_cuda.py | |
parent | ee73352b7d79a8de461b500ac641f482f599ee87 (diff) | |
download | ydb-f5553951374bace336d651d286a1132405c42225.tar.gz |
Fix commands on Windows
In order to get stable command regardless of platform we shall use linux way of representing commands everywhere. Happily this almost always works on Windows except direct file presence checks like in compile_cuda.py
1412fdabc2fcf1732cd2578e0c6ffe91b220aa2e
Diffstat (limited to 'build/scripts/compile_cuda.py')
-rw-r--r-- | build/scripts/compile_cuda.py | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/build/scripts/compile_cuda.py b/build/scripts/compile_cuda.py index eadb4519d2..69b93cec91 100644 --- a/build/scripts/compile_cuda.py +++ b/build/scripts/compile_cuda.py @@ -1,18 +1,35 @@ import sys import subprocess import os +import platform import collections import re import tempfile -def is_clang(command): - for word in command: - if '--compiler-bindir' in word and 'clang' in word: - return True +def fix_win_bin_name(name): + res = os.path.normpath(name) + if not os.path.splitext(name)[1]: + return res + '.exe' + return res - return False +def find_compiler_bindir(command): + for idx, word in enumerate(command): + if '--compiler-bindir' in word: + return idx + return None +def is_clang(command): + cmplr_dir_idx = find_compiler_bindir(command) + return cmplr_dir_idx is not None and 'clang' in command[cmplr_dir_idx] + +def fix_win(command, flags): + if platform.system().lower() == "windows": + command[0] = fix_win_bin_name(command[0]) + cmplr_dir_idx = find_compiler_bindir(command) + if cmplr_dir_idx is not None: + key, value = command[cmplr_dir_idx].split('=') + command[cmplr_dir_idx] = key + '=' + fix_win_bin_name(value) def main(): try: @@ -35,6 +52,8 @@ def main(): command.remove('--y_dump_args') dump_args = True + fix_win(command, cflags) + executable = command[0] if not os.path.exists(executable): print >> sys.stderr, '{} not found'.format(executable) |