tests/wpt/update: Fix print statements to be compatible with Python3

This commit is contained in:
marmeladema 2019-10-20 23:00:09 +01:00
parent 45817ac26e
commit 179caed30f
2 changed files with 9 additions and 5 deletions

View file

@ -2,6 +2,8 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this # License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/. # file, You can obtain one at https://mozilla.org/MPL/2.0/.
from __future__ import print_function
import json import json
from urlparse import urljoin from urlparse import urljoin
requests = None requests = None
@ -46,7 +48,7 @@ class GitHub(object):
if 200 <= resp.status_code < 300: if 200 <= resp.status_code < 300:
return resp.json() return resp.json()
else: else:
print resp.status_code, resp.json() print(resp.status_code, resp.json())
raise GitHubError(resp.status_code, resp.json()) raise GitHubError(resp.status_code, resp.json())
def repo(self, owner, name): def repo(self, owner, name):

View file

@ -1,3 +1,5 @@
from __future__ import print_function
import os import os
import re import re
import subprocess import subprocess
@ -155,7 +157,7 @@ class SelectCommits(Step):
while True: while True:
commits = state.source_commits[:] commits = state.source_commits[:]
for i, commit in enumerate(commits): for i, commit in enumerate(commits):
print "%i:\t%s" % (i, commit.message.summary) print("%i:\t%s" % (i, commit.message.summary))
remove = raw_input("Provide a space-separated list of any commits numbers to remove from the list to upstream:\n").strip() remove = raw_input("Provide a space-separated list of any commits numbers to remove from the list to upstream:\n").strip()
remove_idx = set() remove_idx = set()
@ -178,9 +180,9 @@ class SelectCommits(Step):
keep_commits = [(i,cmt) for i,cmt in enumerate(commits) if i not in remove_idx] keep_commits = [(i,cmt) for i,cmt in enumerate(commits) if i not in remove_idx]
#TODO: consider printed removed commits #TODO: consider printed removed commits
print "Selected the following commits to keep:" print("Selected the following commits to keep:")
for i, commit in keep_commits: for i, commit in keep_commits:
print "%i:\t%s" % (i, commit.message.summary) print("%i:\t%s" % (i, commit.message.summary))
confirm = raw_input("Keep the above commits? y/n\n").strip().lower() confirm = raw_input("Keep the above commits? y/n\n").strip().lower()
if confirm == "y": if confirm == "y":
@ -210,7 +212,7 @@ class MovePatches(Step):
try: try:
state.sync_tree.import_patch(stripped_patch, 1 + strip_count) state.sync_tree.import_patch(stripped_patch, 1 + strip_count)
except: except:
print patch.diff print(patch.diff)
raise raise
state.commits_loaded = i state.commits_loaded = i