mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
fix: use print() function in both Python 2 and Python 3 (#18395)
Legacy print statements are syntax errors in Python 3 but print() function works as expected in both Python 2 and Python 3. Old style exceptions are syntax errors in Python 3 but new style exceptions work as expected in both Python 2 and Python 3.
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
# found in the LICENSE file.
|
||||
|
||||
"""Rewrites paths in -I, -L and other option to be relative to a sysroot."""
|
||||
from __future__ import print_function
|
||||
|
||||
import sys
|
||||
import os
|
||||
@@ -63,7 +64,7 @@ def main(argv):
|
||||
|
||||
for line in sys.stdin.readlines():
|
||||
line = RewriteLine(line.strip(), opts)
|
||||
print line
|
||||
print(line)
|
||||
return 0
|
||||
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
# found in the LICENSE file.
|
||||
|
||||
"""Convert pdb to sym for given directories"""
|
||||
from __future__ import print_function
|
||||
|
||||
import errno
|
||||
import glob
|
||||
@@ -12,6 +13,7 @@ import optparse
|
||||
import os
|
||||
import Queue
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import threading
|
||||
@@ -69,13 +71,13 @@ def GenerateSymbols(options, binaries):
|
||||
|
||||
if options.verbose:
|
||||
with print_lock:
|
||||
print "Generating symbols for %s" % binary
|
||||
print("Generating symbols for %s" % binary)
|
||||
|
||||
syms = GetCommandOutput([DUMP_SYMS, binary])
|
||||
module_line = re.match("MODULE [^ ]+ [^ ]+ ([0-9A-Fa-f]+) (.*)\r\n", syms)
|
||||
if module_line == None:
|
||||
with print_lock:
|
||||
print "Failed to get symbols for %s" % binary
|
||||
print("Failed to get symbols for %s" % binary)
|
||||
queue.task_done()
|
||||
continue
|
||||
|
||||
@@ -115,7 +117,7 @@ def main():
|
||||
(options, directories) = parser.parse_args()
|
||||
|
||||
if not options.symbols_dir:
|
||||
print "Required option --symbols-dir missing."
|
||||
print("Required option --symbols-dir missing.")
|
||||
return 1
|
||||
|
||||
if options.clear:
|
||||
|
||||
Reference in New Issue
Block a user