Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha 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)
commit07440b10daaaac3ffa18022f470a979004123f87 (patch)
tree48a88f080d45fd743cf53c79d7f1961b6ae916ff
parente2ca8c8db80c7bd19db05f05e4619236baa60680 (diff)
add back locale code to fix printing error messages
-rw-r--r--sjhbuild/main.py19
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)