[pypy-svn] r61235 - pypy/trunk/lib-python/modified-2.5.2

arigo at codespeak.net arigo at codespeak.net
Thu Jan 22 15:29:36 CET 2009


Author: arigo
Date: Thu Jan 22 15:29:36 2009
New Revision: 61235

Added:
   pypy/trunk/lib-python/modified-2.5.2/gettext.py
      - copied, changed from r61233, pypy/trunk/lib-python/2.5.2/gettext.py
Log:
Remove the default value of find(localedir=...) when running
on PyPy.  This default value is a bit useless, and it is
computed based on sys.prefix.


Copied: pypy/trunk/lib-python/modified-2.5.2/gettext.py (from r61233, pypy/trunk/lib-python/2.5.2/gettext.py)
==============================================================================
--- pypy/trunk/lib-python/2.5.2/gettext.py	(original)
+++ pypy/trunk/lib-python/modified-2.5.2/gettext.py	Thu Jan 22 15:29:36 2009
@@ -55,7 +55,11 @@
            'dgettext', 'dngettext', 'gettext', 'ngettext',
            ]
 
-_default_localedir = os.path.join(sys.prefix, 'share', 'locale')
+# PyPy: we cannot provide a sensible default because there is no sys.prefix
+if hasattr(sys, 'prefix'):
+    _default_localedir = os.path.join(sys.prefix, 'share', 'locale')
+else:
+    _default_localedir = None
 
 
 def test(condition, true, false):
@@ -422,6 +426,8 @@
     # Get some reasonable defaults for arguments that were not supplied
     if localedir is None:
         localedir = _default_localedir
+        if localedir is None:
+            raise TypeError("'localedir' argument required on PyPy")
     if languages is None:
         languages = []
         for envar in ('LANGUAGE', 'LC_ALL', 'LC_MESSAGES', 'LANG'):



More information about the Pypy-commit mailing list