Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1960)

Unified Diff: pylib/gyp/win_tool.py

Issue 1454433002: Python 3 compatibility Base URL: https://chromium.googlesource.com/external/gyp.git@master
Patch Set: Rebase with master (4ec6c4e3a94bd04a6da2858163d40b2429b8aad1) Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pylib/gyp/win_tool.py
diff --git a/pylib/gyp/win_tool.py b/pylib/gyp/win_tool.py
index bb6f1ea436f258aabdfa4843eee4ef301883c0ff..b837a25779ba84d7dfb9b437497d4f264d035da1 100755
--- a/pylib/gyp/win_tool.py
+++ b/pylib/gyp/win_tool.py
@@ -9,6 +9,8 @@
These functions are executed via gyp-win-tool when using the ninja generator.
"""
+from __future__ import print_function
+
import os
import re
import shutil
@@ -126,7 +128,7 @@ class WinTool(object):
if (not line.startswith(' Creating library ') and
not line.startswith('Generating code') and
not line.startswith('Finished generating code')):
- print line
+ print(line)
return link.returncode
def ExecLinkWithManifests(self, arch, embed_manifest, out, ldcmd, resname,
@@ -185,16 +187,18 @@ class WinTool(object):
our_manifest = '%(out)s.manifest' % variables
# Load and normalize the manifests. mt.exe sometimes removes whitespace,
# and sometimes doesn't unfortunately.
- with open(our_manifest, 'rb') as our_f:
- with open(assert_manifest, 'rb') as assert_f:
+ with open(our_manifest, 'r') as our_f:
+ with open(assert_manifest, 'r') as assert_f:
our_data = our_f.read().translate(None, string.whitespace)
assert_data = assert_f.read().translate(None, string.whitespace)
if our_data != assert_data:
os.unlink(out)
def dump(filename):
- sys.stderr.write('%s\n-----\n' % filename)
- with open(filename, 'rb') as f:
- sys.stderr.write(f.read() + '\n-----\n')
+ print(filename, file=sys.stderr)
+ print('-----', file=sys.stderr)
+ with open(filename, 'r') as f:
+ print(f.read(), file=sys.stderr)
+ print('-----', file=sys.stderr)
dump(intermediate_manifest)
dump(our_manifest)
dump(assert_manifest)
@@ -215,7 +219,7 @@ class WinTool(object):
out, _ = popen.communicate()
for line in out.splitlines():
if line and 'manifest authoring warning 81010002' not in line:
- print line
+ print(line)
return popen.returncode
def ExecManifestToRc(self, arch, *args):
@@ -223,7 +227,7 @@ class WinTool(object):
|args| is tuple containing path to resource file, path to manifest file
and resource name which can be "1" (for executables) or "2" (for DLLs)."""
manifest_path, resource_path, resource_name = args
- with open(resource_path, 'wb') as output:
+ with open(resource_path, 'w') as output:
output.write('#include <windows.h>\n%s RT_MANIFEST "%s"' % (
resource_name,
os.path.abspath(manifest_path).replace('\\', '/')))
@@ -255,7 +259,7 @@ class WinTool(object):
for x in lines if x.startswith(prefixes))
for line in lines:
if not line.startswith(prefixes) and line not in processing:
- print line
+ print(line)
return popen.returncode
def ExecAsmWrapper(self, arch, *args):
@@ -269,7 +273,7 @@ class WinTool(object):
not line.startswith('Microsoft (R) Macro Assembler') and
not line.startswith(' Assembling: ') and
line):
- print line
+ print(line)
return popen.returncode
def ExecRcWrapper(self, arch, *args):
@@ -283,7 +287,7 @@ class WinTool(object):
if (not line.startswith('Microsoft (R) Windows (R) Resource Compiler') and
not line.startswith('Copyright (C) Microsoft Corporation') and
line):
- print line
+ print(line)
return popen.returncode
def ExecActionWrapper(self, arch, rspfile, *dir):
@@ -292,7 +296,7 @@ class WinTool(object):
env = self._GetEnv(arch)
# TODO(scottmg): This is a temporary hack to get some specific variables
# through to actions that are set after gyp-time. http://crbug.com/333738.
- for k, v in os.environ.iteritems():
+ for k, v in os.environ.items():
if k not in env:
env[k] = v
args = open(rspfile).read()

Powered by Google App Engine
This is Rietveld 408576698