diff options
author | Sascha Silbe <sascha-org-sugar-git@silbe.org> | 2010-02-03 10:38:31 (GMT) |
---|---|---|
committer | Sascha Silbe <sascha-org-sugar-git@silbe.org> | 2010-02-03 10:38:31 (GMT) |
commit | 07440b10daaaac3ffa18022f470a979004123f87 (patch) | |
tree | 48a88f080d45fd743cf53c79d7f1961b6ae916ff | |
parent | e2ca8c8db80c7bd19db05f05e4619236baa60680 (diff) |
add back locale code to fix printing error messages
-rw-r--r-- | sjhbuild/main.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/sjhbuild/main.py b/sjhbuild/main.py index 09a75bf..d1185b1 100644 --- a/sjhbuild/main.py +++ b/sjhbuild/main.py @@ -39,6 +39,25 @@ from config import Config import depscheck +if sys.platform == 'darwin': + # work around locale.getpreferredencoding() returning an empty string in + # Mac OS X, see http://bugzilla.gnome.org/show_bug.cgi?id=534650 and + # http://bazaar-vcs.org/DarwinCommandLineArgumentDecoding + sys.platform = 'posix' + try: + import locale + finally: + sys.platform = 'darwin' +else: + import locale + +try: + _encoding = locale.getpreferredencoding() + assert _encoding +except (locale.Error, AssertionError): + _encoding = 'ascii' + + # Need a literal copy as there's no other way to use our own Config class :-/ def main(base_dir, args): gettext.install('jhbuild', unicode=True) |