[yum-git] repodiff.py
Tim Lauridsen
timlau at linux.duke.edu
Thu May 29 19:19:18 UTC 2008
repodiff.py | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
New commits:
commit c4b79765922a614adddce54615e15144d2cb4332
Author: Tim Lauridsen <tim at naboo.local>
Date: Thu May 29 21:16:24 2008 +0200
more same way of setting locale (i hope)
diff --git a/repodiff.py b/repodiff.py
index e6d3d87..0062116 100755
--- a/repodiff.py
+++ b/repodiff.py
@@ -223,9 +223,13 @@ def main(args):
if __name__ == "__main__":
- # Always run in LANG=C, because this tool is not localized
- os.environ['LC_ALL'] = 'C'
- locale.setlocale(locale.LC_ALL, 'C')
+ 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 not sys.stdout.isatty():
import codecs, locale
sys.stdout = codecs.getwriter(locale.getpreferredencoding())(sys.stdout)
More information about the Yum-cvs-commits
mailing list