[Python-checkins] r73835 - in python/branches/py3k: Lib/distutils/dist.py Lib/distutils/tests/test_dist.py

tarek.ziade python-checkins at python.org
Sat Jul 4 05:00:50 CEST 2009


Author: tarek.ziade
Date: Sat Jul  4 05:00:50 2009
New Revision: 73835

Log:
Merged revisions 73834 via svnmerge from 
svn+ssh://pythondev@svn.python.org/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
........


Modified:
   python/branches/py3k/   (props changed)
   python/branches/py3k/Lib/distutils/dist.py
   python/branches/py3k/Lib/distutils/tests/test_dist.py

Modified: python/branches/py3k/Lib/distutils/dist.py
==============================================================================
--- python/branches/py3k/Lib/distutils/dist.py	(original)
+++ python/branches/py3k/Lib/distutils/dist.py	Sat Jul  4 05:00:50 2009
@@ -596,14 +596,14 @@
                 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):
@@ -617,9 +617,9 @@
             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
@@ -634,8 +634,8 @@
         # 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
@@ -651,12 +651,12 @@
                 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
@@ -665,7 +665,7 @@
         """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)
@@ -676,7 +676,7 @@
             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

Modified: python/branches/py3k/Lib/distutils/tests/test_dist.py
==============================================================================
--- python/branches/py3k/Lib/distutils/tests/test_dist.py	(original)
+++ python/branches/py3k/Lib/distutils/tests/test_dist.py	Sat Jul  4 05:00:50 2009
@@ -136,24 +136,6 @@
         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)


More information about the Python-checkins mailing list