[yum-git] yum-builddep.py

James Antill james at linux.duke.edu
Mon Sep 15 15:21:43 UTC 2008


 yum-builddep.py |   19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)

New commits:
commit 3da900a38eedfc39be8fa3d151cf6c88d1b3f834
Author: James Antill <james at and.org>
Date:   Mon Sep 15 11:20:57 2008 -0400

    Use the setup_locale call instead of copy&paste

diff --git a/yum-builddep.py b/yum-builddep.py
index ea570c7..6d64000 100755
--- a/yum-builddep.py
+++ b/yum-builddep.py
@@ -18,7 +18,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 cli import *
 from utils import YumUtilBase
@@ -139,22 +139,7 @@ class YumBuildDep(YumUtilBase):
     
     
 if __name__ == '__main__':
-    import locale
-    # This test needs to be before locale.getpreferredencoding() as that
-    # does setlocale(LC_CTYPE, "")
-    try:
-        locale.setlocale(locale.LC_ALL, '')
-    except locale.Error, e:
-        # 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'
-
+    setup_locale()
     util = YumBuildDep()
         
        



More information about the Yum-cvs-commits mailing list