Skip to content

Commit

Permalink
Make these print statements Python 3 compatible.
Browse files Browse the repository at this point in the history
  • Loading branch information
thanatos committed Feb 27, 2016
1 parent 19b93ec commit edf6d2d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
5 changes: 4 additions & 1 deletion letsencrypt/plugins/webroot_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
"""Tests for letsencrypt.plugins.webroot."""

from __future__ import print_function

import errno
import os
import shutil
Expand Down Expand Up @@ -74,7 +77,7 @@ def test_prepare_reraises_other_errors(self):
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)
Expand Down
9 changes: 6 additions & 3 deletions letsencrypt/tests/cli_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
"""Tests for letsencrypt.cli."""

from __future__ import print_function

import argparse
import functools
import itertools
Expand Down Expand Up @@ -580,7 +583,7 @@ def _test_renewal_common(self, due_for_renewal, extra_args, log_out=None,
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
Expand Down Expand Up @@ -628,8 +631,8 @@ def test_certonly_renewal_triggers(self):

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):
Expand Down
15 changes: 9 additions & 6 deletions letshelp-letsencrypt/letshelp_letsencrypt/apache.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit edf6d2d

Please sign in to comment.