aboutsummaryrefslogtreecommitdiffstats
path: root/python/tidy/servo_tidy/tidy.py
diff options
context:
space:
mode:
authormarmeladema <xademax@gmail.com>2019-10-14 00:15:02 +0100
committermarmeladema <xademax@gmail.com>2019-10-16 00:22:06 +0100
commit4e1ee07a79a1d4f696c259c1774e215e389c8eee (patch)
tree859b879d1bcf9a4a251d35a189b2a14b1b35e6e0 /python/tidy/servo_tidy/tidy.py
parenteda6d3e0c5938fe161ed3821a8e984c9e14a6b8e (diff)
downloadservo-4e1ee07a79a1d4f696c259c1774e215e389c8eee.tar.gz
servo-4e1ee07a79a1d4f696c259c1774e215e389c8eee.zip
Improve print statement compatibility with Python3
Diffstat (limited to 'python/tidy/servo_tidy/tidy.py')
-rw-r--r--python/tidy/servo_tidy/tidy.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/python/tidy/servo_tidy/tidy.py b/python/tidy/servo_tidy/tidy.py
index 0069f344fa7..efd3648b2ab 100644
--- a/python/tidy/servo_tidy/tidy.py
+++ b/python/tidy/servo_tidy/tidy.py
@@ -7,6 +7,8 @@
# option. This file may not be copied, modified, or distributed
# except according to those terms.
+from __future__ import print_function
+
import contextlib
import fnmatch
import imp
@@ -514,7 +516,7 @@ def check_manifest_dirs(config_file, print_text=True):
lines = conf_file.splitlines(True)
if print_text:
- print '\rChecking the wpt manifest file...'
+ print('\rChecking the wpt manifest file...')
p = parser.parse(lines)
paths = rec_parse(wpt_path("web-platform-tests"), p)
@@ -908,7 +910,7 @@ def check_config_file(config_file, print_text=True):
lines = conf_file.splitlines(True)
if print_text:
- print '\rChecking the config file...'
+ print('\rChecking the config file...')
config_content = toml.loads(conf_file)
exclude = config_content.get("ignore", {})
@@ -995,7 +997,7 @@ def parse_config(config_file):
def check_directory_files(directories, print_text=True):
if print_text:
- print '\rChecking directories for correct file extensions...'
+ print('\rChecking directories for correct file extensions...')
for directory, file_extensions in directories.items():
files = sorted(os.listdir(directory))
for filename in files:
@@ -1015,7 +1017,7 @@ def collect_errors_for_files(files_to_check, checking_functions, line_checking_f
if not has_element:
raise StopIteration
if print_text:
- print '\rChecking files for tidiness...'
+ print('\rChecking files for tidiness...')
for filename in files_to_check:
if not os.path.exists(filename):
@@ -1037,7 +1039,7 @@ def collect_errors_for_files(files_to_check, checking_functions, line_checking_f
def get_dep_toml_files(only_changed_files=False):
if not only_changed_files:
- print '\nRunning the dependency licensing lint...'
+ print('\nRunning the dependency licensing lint...')
for root, directories, filenames in os.walk(".cargo"):
for filename in filenames:
if filename == "Cargo.toml":
@@ -1136,11 +1138,11 @@ def scan(only_changed_files=False, progress=True, stylo=False):
error = None
for error in errors:
colorama.init()
- print "\r\033[94m{}\033[0m:\033[93m{}\033[0m: \033[91m{}\033[0m".format(*error)
+ print("\r\033[94m{}\033[0m:\033[93m{}\033[0m: \033[91m{}\033[0m".format(*error))
- print
+ print()
if error is None:
colorama.init()
- print "\033[92mtidy reported no errors.\033[0m"
+ print("\033[92mtidy reported no errors.\033[0m")
return int(error is not None)