jhbuild r2112 - in trunk: . jhbuild
- From: fpeters svn gnome org
- To: svn-commits-list gnome org
- Subject: jhbuild r2112 - in trunk: . jhbuild
- Date: Sat, 24 May 2008 18:14:00 +0000 (UTC)
Author: fpeters
Date: Sat May 24 18:13:59 2008
New Revision: 2112
URL: http://svn.gnome.org/viewvc/jhbuild?rev=2112&view=rev
Log:
* jhbuild/main.py: work around locale.getpreferredencoding() returning
an empty string in Mac OS X. (closes: #534650)
Modified:
trunk/ChangeLog
trunk/jhbuild/main.py
Modified: trunk/jhbuild/main.py
==============================================================================
--- trunk/jhbuild/main.py (original)
+++ trunk/jhbuild/main.py Sat May 24 18:13:59 2008
@@ -23,7 +23,6 @@
import traceback
import gettext
-import locale
localedir = os.path.abspath(os.path.join(os.path.dirname(__file__), '../mo'))
gettext.install('jhbuild', localedir=localedir, unicode=True)
import __builtin__
@@ -33,8 +32,24 @@
import jhbuild.commands
from jhbuild.errors import UsageError, FatalError
-_encoding = locale.getpreferredencoding()
+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'
def uprint(*args):
'''Print Unicode string encoded for the terminal'''
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]