Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0d3fa83

Browse files
author
Tarek Ziadé
committed
Merged revisions 73834 via svnmerge from
svn+ssh://[email protected]/python/trunk ........ r73834 | tarek.ziade | 2009-07-04 04:59:19 +0200 (Sat, 04 Jul 2009) | 1 line using print statements when used for user interaction ........
1 parent d06fa47 commit 0d3fa83

2 files changed

Lines changed: 11 additions & 29 deletions

File tree

Lib/distutils/dist.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -596,14 +596,14 @@ def _show_help(self, parser, global_options=1, display_options=1,
596596
options = self.global_options
597597
parser.set_option_table(options)
598598
parser.print_help(self.common_usage + "\nGlobal options:")
599-
self.announce('')
599+
print('')
600600

601601
if display_options:
602602
parser.set_option_table(self.display_options)
603603
parser.print_help(
604604
"Information display options (just display " +
605605
"information, ignore any commands)")
606-
self.announce('')
606+
print('')
607607

608608
for command in self.commands:
609609
if isinstance(command, type) and issubclass(command, Command):
@@ -617,9 +617,9 @@ def _show_help(self, parser, global_options=1, display_options=1,
617617
else:
618618
parser.set_option_table(klass.user_options)
619619
parser.print_help("Options for '%s' command:" % klass.__name__)
620-
self.announce('')
620+
print('')
621621

622-
self.announce(gen_usage(self.script_name))
622+
print(gen_usage(self.script_name))
623623

624624
def handle_display_options(self, option_order):
625625
"""If there were any non-global "display-only" options
@@ -634,8 +634,8 @@ def handle_display_options(self, option_order):
634634
# we ignore "foo bar").
635635
if self.help_commands:
636636
self.print_commands()
637-
self.announce('')
638-
self.announce(gen_usage(self.script_name))
637+
print('')
638+
print(gen_usage(self.script_name))
639639
return 1
640640

641641
# If user supplied any of the "display metadata" options, then
@@ -651,12 +651,12 @@ def handle_display_options(self, option_order):
651651
opt = translate_longopt(opt)
652652
value = getattr(self.metadata, "get_"+opt)()
653653
if opt in ['keywords', 'platforms']:
654-
self.announce(','.join(value))
654+
print(','.join(value))
655655
elif opt in ('classifiers', 'provides', 'requires',
656656
'obsoletes'):
657-
self.announce('\n'.join(value))
657+
print('\n'.join(value))
658658
else:
659-
self.announce(value)
659+
print(value)
660660
any_display_options = 1
661661

662662
return any_display_options
@@ -665,7 +665,7 @@ def print_command_list(self, commands, header, max_length):
665665
"""Print a subset of the list of all commands -- used by
666666
'print_commands()'.
667667
"""
668-
self.announce(header + ":")
668+
print(header + ":")
669669

670670
for cmd in commands:
671671
klass = self.cmdclass.get(cmd)
@@ -676,7 +676,7 @@ def print_command_list(self, commands, header, max_length):
676676
except AttributeError:
677677
description = "(no description available)"
678678

679-
self.announce(" %-*s %s" % (max_length, cmd, description))
679+
print(" %-*s %s" % (max_length, cmd, description))
680680

681681
def print_commands(self):
682682
"""Print out a help message listing all available commands with a

Lib/distutils/tests/test_dist.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -136,24 +136,6 @@ def test_finalize_options(self):
136136
self.assertEquals(dist.metadata.platforms, ['one', 'two'])
137137
self.assertEquals(dist.metadata.keywords, ['one', 'two'])
138138

139-
def test_show_help(self):
140-
class FancyGetopt(object):
141-
def __init__(self):
142-
self.count = 0
143-
144-
def set_option_table(self, *args):
145-
pass
146-
147-
def print_help(self, *args):
148-
self.count += 1
149-
150-
parser = FancyGetopt()
151-
dist = Distribution()
152-
dist.commands = ['sdist']
153-
dist.script_name = 'setup.py'
154-
dist._show_help(parser)
155-
self.assertEquals(parser.count, 3)
156-
157139
def test_get_command_packages(self):
158140
dist = Distribution()
159141
self.assertEquals(dist.command_packages, None)

0 commit comments

Comments
 (0)