Change print statements to work in python3
This is part of a series of changes to introduce Python3 support.
Change-Id: I373be5de7141aa127d7debdbce1df39148dbec32
diff --git a/subcmds/help.py b/subcmds/help.py
index 375d04d..57fb3cc 100644
--- a/subcmds/help.py
+++ b/subcmds/help.py
@@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+from __future__ import print_function
import re
import sys
from formatter import AbstractFormatter, DumbWriter
@@ -31,10 +32,8 @@
"""
def _PrintAllCommands(self):
- print 'usage: repo COMMAND [ARGS]'
- print """
-The complete list of recognized repo commands are:
-"""
+ print('usage: repo COMMAND [ARGS]')
+ print('The complete list of recognized repo commands are:')
commandNames = self.commands.keys()
commandNames.sort()
@@ -49,17 +48,14 @@
summary = command.helpSummary.strip()
except AttributeError:
summary = ''
- print fmt % (name, summary)
- print """
-See 'repo help <command>' for more information on a specific command.
-"""
+ print(fmt % (name, summary))
+ print("See 'repo help <command>' for more information on a"
+ 'specific command.')
def _PrintCommonCommands(self):
- print 'usage: repo COMMAND [ARGS]'
- print """
-The most commonly used repo commands are:
-"""
- commandNames = [name
+ print('usage: repo COMMAND [ARGS]')
+ print('The most commonly used repo commands are:')
+ commandNames = [name
for name in self.commands.keys()
if self.commands[name].common]
commandNames.sort()
@@ -75,11 +71,10 @@
summary = command.helpSummary.strip()
except AttributeError:
summary = ''
- print fmt % (name, summary)
- print """
-See 'repo help <command>' for more information on a specific command.
-See 'repo help --all' for a complete list of recognized commands.
-"""
+ print(fmt % (name, summary))
+ print(
+"See 'repo help <command>' for more information on a specific command.\n"
+"See 'repo help --all' for a complete list of recognized commands.")
def _PrintCommandHelp(self, cmd):
class _Out(Coloring):
@@ -162,7 +157,7 @@
try:
cmd = self.commands[name]
except KeyError:
- print >>sys.stderr, "repo: '%s' is not a repo command." % name
+ print("repo: '%s' is not a repo command." % name, file=sys.stderr)
sys.exit(1)
cmd.manifest = self.manifest