summaryrefslogtreecommitdiffstats
path: root/build/scripts/fix_msvc_output.py
diff options
context:
space:
mode:
authorpg <[email protected]>2025-02-18 09:50:57 +0300
committerpg <[email protected]>2025-02-18 10:14:31 +0300
commitd506a01f2c1668b2a6720099c110304f5b015765 (patch)
treed65a4fdc55ec2c30a4b77018f9886c8bcfd6ef9e /build/scripts/fix_msvc_output.py
parentb9824e1dc11c30a60d6416b9d345758bc7901544 (diff)
refactor out py2 protobuf herobora after
commit_hash:8241ea2d9e5c3d12ca4c8902cdac23ed6630d4ce
Diffstat (limited to 'build/scripts/fix_msvc_output.py')
-rw-r--r--build/scripts/fix_msvc_output.py29
1 files changed, 22 insertions, 7 deletions
diff --git a/build/scripts/fix_msvc_output.py b/build/scripts/fix_msvc_output.py
index 49df9aee3bb..4a5c31102bf 100644
--- a/build/scripts/fix_msvc_output.py
+++ b/build/scripts/fix_msvc_output.py
@@ -1,5 +1,8 @@
import subprocess
-import os, sys
+import os
+import sys
+import json
+
# Explicitly enable local imports
# Don't forget to add imported scripts to inputs of the calling command!
@@ -7,8 +10,6 @@ sys.path.append(os.path.dirname(os.path.abspath(__file__)))
import process_command_files as pcf
import process_whole_archive_option as pwa
-from fix_py2_protobuf import fix_py2
-
def out2err(cmd):
return subprocess.Popen(cmd, stdout=sys.stderr).wait()
@@ -38,13 +39,27 @@ def out2err_cut_first_line(cmd):
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:]))
+ args = sys.argv[1:]
+ mode = args[0]
+ plugins = []
+
+ if mode == 'link' and '--start-plugins' in args:
+ ib = args.index('--start-plugins')
+ ie = args.index('--end-plugins')
+ plugins = args[ib + 1:ie]
+ args = args[:ib] + args[ie + 1:]
+
+ for p in plugins:
+ res = subprocess.check_output([sys.executable, p] + args).decode().strip()
+
+ if res:
+ args = json.loads(res)
+
+ args, wa_peers, wa_libs = pwa.get_whole_archive_peers_and_libs(pcf.skip_markers(args[1:]))
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
- if mode == 'link':
- cmd = fix_py2(cmd, have_comand_files=True, prefix='', suffix='lib')
+
sys.exit(run(cmd))