aboutsummaryrefslogtreecommitdiffstats
path: root/build/scripts
diff options
context:
space:
mode:
authorNikita Slyusarev <nslus@yandex-team.com>2022-02-10 16:46:53 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:53 +0300
commit469afdc4e2587bf62ecdd096b75a0baa444c4012 (patch)
tree49e222ea1c5804306084bb3ae065bb702625360f /build/scripts
parentcd77cecfc03a3eaf87816af28a33067c4f0cdb59 (diff)
downloadydb-469afdc4e2587bf62ecdd096b75a0baa444c4012.tar.gz
Restoring authorship annotation for Nikita Slyusarev <nslus@yandex-team.com>. Commit 2 of 2.
Diffstat (limited to 'build/scripts')
-rw-r--r--build/scripts/fix_msvc_output.py58
-rw-r--r--build/scripts/link_dyn_lib.py38
-rw-r--r--build/scripts/run_msvc_wine.py46
-rw-r--r--build/scripts/stdout2stderr.py12
4 files changed, 77 insertions, 77 deletions
diff --git a/build/scripts/fix_msvc_output.py b/build/scripts/fix_msvc_output.py
index 4fda5b6321..b2e7d38307 100644
--- a/build/scripts/fix_msvc_output.py
+++ b/build/scripts/fix_msvc_output.py
@@ -1,13 +1,13 @@
-import subprocess
-import sys
-
+import subprocess
+import sys
+
import process_command_files as pcf
import process_whole_archive_option as pwa
-
-def out2err(cmd):
- return subprocess.Popen(cmd, stdout=sys.stderr).wait()
-
-
+
+def out2err(cmd):
+ return subprocess.Popen(cmd, stdout=sys.stderr).wait()
+
+
def decoding_needed(strval):
if sys.version_info >= (3, 0, 0):
return isinstance(strval, bytes)
@@ -15,28 +15,28 @@ def decoding_needed(strval):
return False
-def out2err_cut_first_line(cmd):
- p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
- first_line = True
- while True:
- line = p.stdout.readline()
+def out2err_cut_first_line(cmd):
+ p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
+ first_line = True
+ while True:
+ line = p.stdout.readline()
line = line.decode('utf-8') if decoding_needed(line) else line
- if not line:
- break
- if first_line:
- sys.stdout.write(line)
- first_line = False
- else:
- sys.stderr.write(line)
- return p.wait()
-
-
-if __name__ == '__main__':
+ if not line:
+ break
+ if first_line:
+ sys.stdout.write(line)
+ first_line = False
+ else:
+ sys.stderr.write(line)
+ return p.wait()
+
+
+if __name__ == '__main__':
mode = sys.argv[1]
args, wa_peers, wa_libs = pwa.get_whole_archive_peers_and_libs(pcf.skip_markers(sys.argv[2:]))
cmd = pwa.ProcessWholeArchiveOption('WINDOWS', wa_peers, wa_libs).construct_cmd(args)
- run = out2err
- if mode in ('cl', 'ml'):
- # First line of cl.exe and ml64.exe stdout is useless: it prints input file
- run = out2err_cut_first_line
- sys.exit(run(cmd))
+ run = out2err
+ if mode in ('cl', 'ml'):
+ # First line of cl.exe and ml64.exe stdout is useless: it prints input file
+ run = out2err_cut_first_line
+ sys.exit(run(cmd))
diff --git a/build/scripts/link_dyn_lib.py b/build/scripts/link_dyn_lib.py
index 1b48e6a204..23487f5c1e 100644
--- a/build/scripts/link_dyn_lib.py
+++ b/build/scripts/link_dyn_lib.py
@@ -112,31 +112,31 @@ def fix_gnu_param(arch, ex):
return ret
-def fix_windows_param(ex):
- with tempfile.NamedTemporaryFile(delete=False) as def_file:
- exports = []
- for item in ex:
- if item.get('lang') == 'C':
- exports.append(item.get('sym'))
- def_file.write('EXPORTS\n')
- for export in exports:
- def_file.write(' {}\n'.format(export))
- return ['/DEF:{}'.format(def_file.name)]
-
-
+def fix_windows_param(ex):
+ with tempfile.NamedTemporaryFile(delete=False) as def_file:
+ exports = []
+ for item in ex:
+ if item.get('lang') == 'C':
+ exports.append(item.get('sym'))
+ def_file.write('EXPORTS\n')
+ for export in exports:
+ def_file.write(' {}\n'.format(export))
+ return ['/DEF:{}'.format(def_file.name)]
+
+
musl_libs = '-lc', '-lcrypt', '-ldl', '-lm', '-lpthread', '-lrt', '-lutil'
def fix_cmd(arch, musl, c):
- if arch == 'WINDOWS':
- prefix = '/DEF:'
- f = fix_windows_param
+ if arch == 'WINDOWS':
+ prefix = '/DEF:'
+ f = fix_windows_param
else:
- prefix = '-Wl,--version-script='
+ prefix = '-Wl,--version-script='
if arch in ('DARWIN', 'IOS'):
- f = fix_darwin_param
- else:
- f = lambda x: fix_gnu_param(arch, x)
+ f = fix_darwin_param
+ else:
+ f = lambda x: fix_gnu_param(arch, x)
def do_fix(p):
if musl and p in musl_libs:
diff --git a/build/scripts/run_msvc_wine.py b/build/scripts/run_msvc_wine.py
index 0d41fde8b2..439d1f8831 100644
--- a/build/scripts/run_msvc_wine.py
+++ b/build/scripts/run_msvc_wine.py
@@ -16,14 +16,14 @@ procs = []
build_kekeke = 45
-def stringize(s):
- return s.encode('utf-8') if isinstance(s, unicode) else s
-
-
+def stringize(s):
+ return s.encode('utf-8') if isinstance(s, unicode) else s
+
+
def run_subprocess(*args, **kwargs):
- if 'env' in kwargs:
- kwargs['env'] = {stringize(k): stringize(v) for k, v in kwargs['env'].iteritems()}
-
+ if 'env' in kwargs:
+ kwargs['env'] = {stringize(k): stringize(v) for k, v in kwargs['env'].iteritems()}
+
p = subprocess.Popen(*args, **kwargs)
procs.append(p)
@@ -310,7 +310,7 @@ def colorize_line(l):
parts.extend(colorize_strings(l))
return ''.join(parts)
- except Exception:
+ except Exception:
return lll
@@ -361,11 +361,11 @@ def make_full_path_arg(arg, bld_root, short_root):
def fix_path(p):
topdirs = ['/%s/' % d for d in os.listdir('/')]
- def abs_path_start(path, pos):
- if pos < 0:
- return False
- return pos == 0 or path[pos - 1] == ':'
-
+ def abs_path_start(path, pos):
+ if pos < 0:
+ return False
+ return pos == 0 or path[pos - 1] == ':'
+
pp = None
for pr in topdirs:
pp2 = p.find(pr)
@@ -443,7 +443,7 @@ def run_main():
env['WINEDLLOVERRIDES'] = 'msvcr{}=n'.format(version)
env['WINEDEBUG'] = 'fixme-all'
- env['INCLUDE'] = ';'.join(fix_path(p) for p in incl_paths)
+ env['INCLUDE'] = ';'.join(fix_path(p) for p in incl_paths)
env['VSINSTALLDIR'] = fix_path(tc_dir)
env['VCINSTALLDIR'] = fix_path(tc_dir + '/VC')
env['WindowsSdkDir'] = fix_path(tc_dir)
@@ -475,20 +475,20 @@ def run_main():
out, _ = p.communicate()
return p.wait(), out
- def print_err_log(log):
- if not log:
- return
- if mode == 'cxx':
- log = colorize(log)
- print >>sys.stderr, log
-
+ def print_err_log(log):
+ if not log:
+ return
+ if mode == 'cxx':
+ log = colorize(log)
+ print >>sys.stderr, log
+
tout = 200
while True:
rc, out = run_process(0, tout)
if rc in (-signal.SIGALRM, signal.SIGALRM):
- print_err_log(out)
+ print_err_log(out)
print >>sys.stderr, '##append_tag##time out'
elif out and ' stack overflow ' in out:
print >>sys.stderr, '##append_tag##stack overflow'
@@ -503,7 +503,7 @@ def run_main():
print >>sys.stderr, e
else:
- print_err_log(out)
+ print_err_log(out)
# non-zero return code - bad, return it immediately
if rc:
diff --git a/build/scripts/stdout2stderr.py b/build/scripts/stdout2stderr.py
index 5220b36002..d7861fdda3 100644
--- a/build/scripts/stdout2stderr.py
+++ b/build/scripts/stdout2stderr.py
@@ -1,6 +1,6 @@
-import subprocess
-import sys
-
-if __name__ == '__main__':
- assert len(sys.argv) > 1
- sys.exit(subprocess.Popen(sys.argv[1:], stdout=sys.stderr).wait())
+import subprocess
+import sys
+
+if __name__ == '__main__':
+ assert len(sys.argv) > 1
+ sys.exit(subprocess.Popen(sys.argv[1:], stdout=sys.stderr).wait())