summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorTarek Ziadé <ziade.tarek@gmail.com>2009-07-04 02:59:19 (GMT)
committerTarek Ziadé <ziade.tarek@gmail.com>2009-07-04 02:59:19 (GMT)
commitcd947e0c6af9b81d5069cb57080f1d0eedec7bfd (patch)
tree1b190c1077f259dd71589703ec6cc108bae9af3e /Lib
parent63f1738d4bb904992afb748b3b2734d37cd7fdec (diff)
downloadcpython-cd947e0c6af9b81d5069cb57080f1d0eedec7bfd.zip
cpython-cd947e0c6af9b81d5069cb57080f1d0eedec7bfd.tar.gz
cpython-cd947e0c6af9b81d5069cb57080f1d0eedec7bfd.tar.bz2
using print statements when used for user interaction
Diffstat (limited to 'Lib')
-rw-r--r--Lib/distutils/dist.py22
-rw-r--r--Lib/distutils/tests/test_dist.py18
2 files changed, 11 insertions, 29 deletions
diff --git a/Lib/distutils/dist.py b/Lib/distutils/dist.py
index 7c29bf6..afed545 100644
--- a/Lib/distutils/dist.py
+++ b/Lib/distutils/dist.py
@@ -602,14 +602,14 @@ Common commands: (see '--help-commands' for more)
options = self.global_options
parser.set_option_table(options)
parser.print_help(self.common_usage + "\nGlobal options:")
- self.announce('')
+ print('')
if display_options:
parser.set_option_table(self.display_options)
parser.print_help(
"Information display options (just display " +
"information, ignore any commands)")
- self.announce('')
+ print('')
for command in self.commands:
if isinstance(command, type) and issubclass(command, Command):
@@ -623,9 +623,9 @@ Common commands: (see '--help-commands' for more)
else:
parser.set_option_table(klass.user_options)
parser.print_help("Options for '%s' command:" % klass.__name__)
- self.announce('')
+ print('')
- self.announce(gen_usage(self.script_name))
+ print(gen_usage(self.script_name))
def handle_display_options(self, option_order):
"""If there were any non-global "display-only" options
@@ -640,8 +640,8 @@ Common commands: (see '--help-commands' for more)
# we ignore "foo bar").
if self.help_commands:
self.print_commands()
- self.announce('')
- self.announce(gen_usage(self.script_name))
+ print('')
+ print(gen_usage(self.script_name))
return 1
# If user supplied any of the "display metadata" options, then
@@ -657,12 +657,12 @@ Common commands: (see '--help-commands' for more)
opt = translate_longopt(opt)
value = getattr(self.metadata, "get_"+opt)()
if opt in ['keywords', 'platforms']:
- self.announce(','.join(value))
+ print(','.join(value))
elif opt in ('classifiers', 'provides', 'requires',
'obsoletes'):
- self.announce('\n'.join(value))
+ print('\n'.join(value))
else:
- self.announce(value)
+ print(value)
any_display_options = 1
return any_display_options
@@ -671,7 +671,7 @@ Common commands: (see '--help-commands' for more)
"""Print a subset of the list of all commands -- used by
'print_commands()'.
"""
- self.announce(header + ":")
+ print(header + ":")
for cmd in commands:
klass = self.cmdclass.get(cmd)
@@ -682,7 +682,7 @@ Common commands: (see '--help-commands' for more)
except AttributeError:
description = "(no description available)"
- self.announce(" %-*s %s" % (max_length, cmd, description))
+ print(" %-*s %s" % (max_length, cmd, description))
def print_commands(self):
"""Print out a help message listing all available commands with a
diff --git a/Lib/distutils/tests/test_dist.py b/Lib/distutils/tests/test_dist.py
index 07f392c..75b74a2 100644
--- a/Lib/distutils/tests/test_dist.py
+++ b/Lib/distutils/tests/test_dist.py
@@ -165,24 +165,6 @@ class DistributionTestCase(support.TempdirManager,
self.assertEquals(dist.metadata.platforms, ['one', 'two'])
self.assertEquals(dist.metadata.keywords, ['one', 'two'])
- def test_show_help(self):
- class FancyGetopt(object):
- def __init__(self):
- self.count = 0
-
- def set_option_table(self, *args):
- pass
-
- def print_help(self, *args):
- self.count += 1
-
- parser = FancyGetopt()
- dist = Distribution()
- dist.commands = ['sdist']
- dist.script_name = 'setup.py'
- dist._show_help(parser)
- self.assertEquals(parser.count, 3)
-
def test_get_command_packages(self):
dist = Distribution()
self.assertEquals(dist.command_packages, None)