aboutsummaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorspreis <spreis@yandex-team.com>2024-06-12 06:54:26 +0300
committerspreis <spreis@yandex-team.com>2024-06-12 12:20:00 +0300
commitf5553951374bace336d651d286a1132405c42225 (patch)
tree2f1d9001188feda9d2b5b5a1d94c024614bea54f /build
parentee73352b7d79a8de461b500ac641f482f599ee87 (diff)
downloadydb-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')
-rw-r--r--build/scripts/compile_cuda.py29
-rwxr-xr-xbuild/ymake_conf.py6
2 files changed, 25 insertions, 10 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)
diff --git a/build/ymake_conf.py b/build/ymake_conf.py
index b8f66aaf32..be7a776826 100755
--- a/build/ymake_conf.py
+++ b/build/ymake_conf.py
@@ -7,7 +7,6 @@ import base64
import itertools
import json
import logging
-import ntpath
import optparse
import os
import posixpath
@@ -270,10 +269,7 @@ class Platform(object):
return os
def exe(self, *paths):
- if self.is_windows:
- return ntpath.join(*itertools.chain(paths[:-1], (paths[-1] + '.exe',)))
- else:
- return posixpath.join(*paths)
+ return posixpath.join(*paths)
def __str__(self):
return '{name}-{os}-{arch}'.format(name=self.name, os=self.os, arch=self.arch)