[yum-commits] debuginfo-install.py yum-builddep.py yumdownloader.py

skvidal at osuosl.org skvidal at osuosl.org
Fri Feb 27 19:59:07 UTC 2009


 debuginfo-install.py |    2 +-
 yum-builddep.py      |    2 +-
 yumdownloader.py     |   22 ++++------------------
 3 files changed, 6 insertions(+), 20 deletions(-)

New commits:
commit ac1b17f16df6ef91f5704b66a6e58a3cb04c9cbb
Author: Seth Vidal <skvidal at fedoraproject.org>
Date:   Fri Feb 27 14:57:23 2009 -0500

    make sure we're not using print_help() anywhere - use format_help() instead as print_help
    breaks unicode - closes rh bug #470934

diff --git a/debuginfo-install.py b/debuginfo-install.py
index 99cc177..e4b8d0d 100755
--- a/debuginfo-install.py
+++ b/debuginfo-install.py
@@ -50,7 +50,7 @@ class DebugInfoInstall(YumUtilBase):
         opts = self.doUtilConfigSetup()
         # Check if there is anything to do.
         if len(self.cmds) < 1: 
-            self.optparser.print_help()
+            print self.optparser.format_help()
             sys.exit(0)
         if os.geteuid() != 0:
             print >> sys.stderr, "You must be root to run this command."
diff --git a/yum-builddep.py b/yum-builddep.py
index b257d41..9f89b8d 100755
--- a/yum-builddep.py
+++ b/yum-builddep.py
@@ -51,7 +51,7 @@ class YumBuildDep(YumUtilBase):
 
         # Check if there is anything to do.
         if len(self.cmds) < 1: 
-            self.optparser.print_help()
+            print self.optparser.format_help()
             sys.exit(0)
 
         if self.conf.uid != 0:
diff --git a/yumdownloader.py b/yumdownloader.py
index 032e929..e5e9c94 100755
--- a/yumdownloader.py
+++ b/yumdownloader.py
@@ -17,7 +17,7 @@ import sys
 sys.path.insert(0,'/usr/share/yum-cli')
 
 import yum
-from yum.misc import getCacheDir
+from yum.misc import getCacheDir, setup_locale
 from yum.packages import parsePackages
 
 from utils import YumUtilBase
@@ -59,7 +59,7 @@ class YumDownloader(YumUtilBase):
                 
         # Check if there is anything to do.
         if len(self.cmds) < 1: 
-            self.optparser.print_help()
+            print self.optparser.format_help()
             sys.exit(0)
 
         # make yumdownloader work as non root user.
@@ -298,23 +298,9 @@ class YumDownloader(YumUtilBase):
           help='operate on source packages')
         self.optparser.add_option("--archlist",
           help="only download packages of certain architecture(s)")        
-if __name__ == '__main__':
-    import locale,os
-    # This test needs to be before locale.getpreferredencoding() as that
-    # does setlocale(LC_CTYPE, "")
-    try:
-        locale.setlocale(locale.LC_ALL, '')
-    except locale.Error, ex:
-        # default to C locale if we get a failure.
-        print >> sys.stderr, 'Failed to set locale, defaulting to C'
-        os.environ['LC_ALL'] = 'C'
-        locale.setlocale(locale.LC_ALL, 'C')
-        
-    if True: # not sys.stdout.isatty():
-        import codecs
-        sys.stdout = codecs.getwriter(locale.getpreferredencoding())(sys.stdout)
-        sys.stdout.errors = 'replace'
 
+if __name__ == '__main__':
+    setup_locale()
     util = YumDownloader()
         
         


More information about the Yum-commits mailing list