2020import sys
2121
2222BASE_DIR = os .path .dirname (os .path .abspath (__file__ ))
23+ PY3 = bytes != str
2324
2425# A regex matching an argument corresponding to the output filename passed to
2526# link.exe.
@@ -124,6 +125,8 @@ def ExecLinkWrapper(self, arch, use_separate_mspdbsrv, *args):
124125 stdout = subprocess .PIPE ,
125126 stderr = subprocess .STDOUT )
126127 out , _ = link .communicate ()
128+ if PY3 :
129+ out = out .decode ('utf-8' )
127130 for line in out .splitlines ():
128131 if (not line .startswith (' Creating library ' ) and
129132 not line .startswith ('Generating code' ) and
@@ -215,6 +218,8 @@ def ExecManifestWrapper(self, arch, *args):
215218 popen = subprocess .Popen (args , shell = True , env = env ,
216219 stdout = subprocess .PIPE , stderr = subprocess .STDOUT )
217220 out , _ = popen .communicate ()
221+ if PY3 :
222+ out = out .decode ('utf-8' )
218223 for line in out .splitlines ():
219224 if line and 'manifest authoring warning 81010002' not in line :
220225 print (line )
@@ -247,6 +252,8 @@ def ExecMidlWrapper(self, arch, outdir, tlb, h, dlldata, iid, proxy, idl,
247252 popen = subprocess .Popen (args , shell = True , env = env ,
248253 stdout = subprocess .PIPE , stderr = subprocess .STDOUT )
249254 out , _ = popen .communicate ()
255+ if PY3 :
256+ out = out .decode ('utf-8' )
250257 # Filter junk out of stdout, and write filtered versions. Output we want
251258 # to filter is pairs of lines that look like this:
252259 # Processing C:\Program Files (x86)\Microsoft SDKs\...\include\objidl.idl
@@ -266,6 +273,8 @@ def ExecAsmWrapper(self, arch, *args):
266273 popen = subprocess .Popen (args , shell = True , env = env ,
267274 stdout = subprocess .PIPE , stderr = subprocess .STDOUT )
268275 out , _ = popen .communicate ()
276+ if PY3 :
277+ out = out .decode ('utf-8' )
269278 for line in out .splitlines ():
270279 if (not line .startswith ('Copyright (C) Microsoft Corporation' ) and
271280 not line .startswith ('Microsoft (R) Macro Assembler' ) and
@@ -281,6 +290,8 @@ def ExecRcWrapper(self, arch, *args):
281290 popen = subprocess .Popen (args , shell = True , env = env ,
282291 stdout = subprocess .PIPE , stderr = subprocess .STDOUT )
283292 out , _ = popen .communicate ()
293+ if PY3 :
294+ out = out .decode ('utf-8' )
284295 for line in out .splitlines ():
285296 if (not line .startswith ('Microsoft (R) Windows (R) Resource Compiler' ) and
286297 not line .startswith ('Copyright (C) Microsoft Corporation' ) and
0 commit comments