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

Unified Diff: test/lib/TestGyp.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: test/lib/TestGyp.py
diff --git a/test/lib/TestGyp.py b/test/lib/TestGyp.py
index f32099be98794f9a90db3cd378ad777314266ca7..f0c119e0e476bac3bb35969cfef3091c61469875 100644
--- a/test/lib/TestGyp.py
+++ b/test/lib/TestGyp.py
@@ -6,6 +6,8 @@
TestGyp.py: a testing framework for GYP integration tests.
"""
+from __future__ import print_function
+
import collections
from contextlib import contextmanager
import itertools
@@ -282,13 +284,13 @@ class TestGypBase(TestCommon.TestCommon):
that expect exact output from the command (make) can
just set stdout= when they call the run_build() method.
"""
- print "Build is not up-to-date:"
- print self.banner('STDOUT ')
- print self.stdout()
+ print("Build is not up-to-date:")
+ print(self.banner('STDOUT '))
+ print(self.stdout())
stderr = self.stderr()
if stderr:
- print self.banner('STDERR ')
- print stderr
+ print(self.banner('STDERR '))
+ print(stderr)
def run_gyp(self, gyp_file, *args, **kw):
"""
@@ -326,7 +328,7 @@ class TestGypBase(TestCommon.TestCommon):
the tool-specific subclasses or clutter the tests themselves
with platform-specific code.
"""
- if kw.has_key('SYMROOT'):
+ if 'SYMROOT' in kw:
del kw['SYMROOT']
super(TestGypBase, self).run(*args, **kw)
@@ -556,7 +558,7 @@ class TestGypMake(TestGypBase):
# Makefile.gyp_filename), so use that if there is no Makefile.
chdir = kw.get('chdir', '')
if not os.path.exists(os.path.join(chdir, 'Makefile')):
- print "NO Makefile in " + os.path.join(chdir, 'Makefile')
+ print("NO Makefile in " + os.path.join(chdir, 'Makefile'))
arguments.insert(0, '-f')
arguments.insert(1, os.path.splitext(gyp_file)[0] + '.Makefile')
kw['arguments'] = arguments
@@ -663,7 +665,7 @@ def FindMSBuildInstallation(msvs_version = 'auto'):
msbuild_basekey = r'HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions'
if not registry.KeyExists(msbuild_basekey):
- print 'Error: could not find MSBuild base registry entry'
+ print('Error: could not find MSBuild base registry entry')
return None
msbuild_version = None
@@ -682,13 +684,13 @@ def FindMSBuildInstallation(msvs_version = 'auto'):
msbuild_version = msbuild_test_version
break
if not msbuild_version:
- print 'Error: could not find MSBuild registry entry'
+ print('Error: could not find MSBuild registry entry')
return None
msbuild_path = registry.GetValue(msbuild_basekey + '\\' + msbuild_version,
'MSBuildToolsPath')
if not msbuild_path:
- print 'Error: could not get MSBuild registry entry value'
+ print('Error: could not get MSBuild registry entry value')
return None
return os.path.join(msbuild_path, 'MSBuild.exe')
@@ -741,7 +743,7 @@ def FindVisualStudioInstallation():
uses_msbuild = msvs_version >= '2010'
msbuild_path = FindMSBuildInstallation(msvs_version)
return build_tool, uses_msbuild, msbuild_path
- print 'Error: could not find devenv'
+ print('Error: could not find devenv')
sys.exit(1)
class TestGypOnMSToolchain(TestGypBase):
@@ -886,10 +888,10 @@ class TestGypMSVS(TestGypOnMSToolchain):
Verifies that a build of the specified Visual Studio target is up to date.
Beware that VS2010 will behave strangely if you build under
- C:\USERS\yourname\AppData\Local. It will cause needless work. The ouptut
+ C:/USERS/yourname/AppData/Local. It will cause needless work. The ouptut
Nico 2016/07/29 22:22:06 out of interest, is this needed? with \ it's more
AWhetter 2016/11/05 23:59:50 I've worked around it by making the docstring a ra
will be "1 succeeded and 0 up to date". MSBuild tracing reveals that:
- "Project 'C:\Users\...\AppData\Local\...vcxproj' not up to date because
- 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 10.0\VC\BIN\1033\CLUI.DLL'
+ "Project 'C:/Users/.../AppData/Local/...vcxproj' not up to date because
+ 'C:/PROGRAM FILES (X86)/MICROSOFT VISUAL STUDIO 10.0/VC/BIN/1033/CLUI.DLL'
was modified at 02/21/2011 17:03:30, which is newer than '' which was
modified at 01/01/0001 00:00:00.
@@ -1187,4 +1189,4 @@ def TestGyp(*args, **kw):
for format_class in format_class_list:
if format == format_class.format:
return format_class(*args, **kw)
- raise Exception, "unknown format %r" % format
+ raise Exception("unknown format %r" % format)

Powered by Google App Engine
This is Rietveld 408576698