Make these print statements Python 3 compatible.

This commit is contained in:
Roy Wellington Ⅳ 2016-02-20 00:45:09 -08:00
parent 19b93ec025
commit edf6d2db24
3 changed files with 19 additions and 10 deletions

View file

@ -1,4 +1,7 @@
"""Tests for letsencrypt.plugins.webroot."""
from __future__ import print_function
import errno
import os
import shutil
@ -74,7 +77,7 @@ class AuthenticatorTest(unittest.TestCase):
os.chmod(self.path, 0o000)
try:
open(permission_canary, "r")
print "Warning, running tests as root skips permissions tests..."
print("Warning, running tests as root skips permissions tests...")
except IOError:
# ok, permissions work, test away...
self.assertRaises(errors.PluginError, self.auth.prepare)

View file

@ -1,4 +1,7 @@
"""Tests for letsencrypt.cli."""
from __future__ import print_function
import argparse
import functools
import itertools
@ -580,7 +583,7 @@ class CLITest(unittest.TestCase): # pylint: disable=too-many-public-methods
try:
ret, _, _, _ = self._call(args)
if ret:
print "Returned", ret
print("Returned", ret)
raise AssertionError(ret)
assert not error_expected, "renewal should have errored"
except: # pylint: disable=bare-except
@ -628,8 +631,8 @@ class CLITest(unittest.TestCase): # pylint: disable=too-many-public-methods
def _dump_log(self):
with open(os.path.join(self.logs_dir, "letsencrypt.log")) as lf:
print "Logs:"
print lf.read()
print("Logs:")
print(lf.read())
def _make_test_renewal_conf(self, testfile):

View file

@ -1,5 +1,8 @@
#!/usr/bin/env python
"""Let's Encrypt Apache configuration submission script"""
from __future__ import print_function
import argparse
import atexit
import contextlib
@ -48,20 +51,20 @@ def make_and_verify_selection(server_root, temp_dir):
"""
copied_files, copied_dirs = copy_config(server_root, temp_dir)
print textwrap.fill("A secure copy of the files that have been selected "
print(textwrap.fill("A secure copy of the files that have been selected "
"for submission has been created under {0}. All "
"comments have been removed and the files are only "
"accessible by the current user. A list of the files "
"that have been included is shown below. Please make "
"sure that this selection does not contain private "
"keys, passwords, or any other sensitive "
"information.".format(temp_dir))
print "\nFiles:"
"information.".format(temp_dir)))
print("\nFiles:")
for copied_file in copied_files:
print copied_file
print "Directories (including all contained files):"
print(copied_file)
print("Directories (including all contained files):")
for copied_dir in copied_dirs:
print copied_dir
print(copied_dir)
sys.stdout.write("\nIs it safe to submit these files? ")
while True: