[pypy-svn] r71956 - in pypy/release/1.2.x: . ctypes_configure pypy/lib/ctypes_config_cache

arigo at codespeak.net arigo at codespeak.net
Tue Mar 9 15:25:54 CET 2010


Author: arigo
Date: Tue Mar  9 15:25:52 2010
New Revision: 71956

Modified:
   pypy/release/1.2.x/README
   pypy/release/1.2.x/ctypes_configure/dumpcache.py
   pypy/release/1.2.x/pypy/lib/ctypes_config_cache/locale.ctc.py
Log:
svn merge svn+ssh://codespeak.net/svn/pypy/trunk -r71951:71955


Modified: pypy/release/1.2.x/README
==============================================================================
--- pypy/release/1.2.x/README	(original)
+++ pypy/release/1.2.x/README	Tue Mar  9 15:25:52 2010
@@ -9,11 +9,15 @@
 You can build self-contained Python implementations which execute
 independently from CPython.
 
+The home page is:
+
+    http://pypy.org/
+
 We invite you to head over to our detailed getting-started document:
 
     pypy/doc/getting-started.html or
     pypy/doc/getting-started.txt
-    (local if you got a tarball or svn checkout)
+    (local if you got a source tarball or svn checkout)
 
     http://codespeak.net/pypy/dist/pypy/doc/getting-started.html
 

Modified: pypy/release/1.2.x/ctypes_configure/dumpcache.py
==============================================================================
--- pypy/release/1.2.x/ctypes_configure/dumpcache.py	(original)
+++ pypy/release/1.2.x/ctypes_configure/dumpcache.py	Tue Mar  9 15:25:52 2010
@@ -10,6 +10,8 @@
     print >> f
     names = config.keys()
     names.sort()
+    print >> f, '__all__ = %r' % (tuple(names),)
+    print >> f
     for key in names:
         val = config[key]
         if isinstance(val, (int, long)):

Modified: pypy/release/1.2.x/pypy/lib/ctypes_config_cache/locale.ctc.py
==============================================================================
--- pypy/release/1.2.x/pypy/lib/ctypes_config_cache/locale.ctc.py	(original)
+++ pypy/release/1.2.x/pypy/lib/ctypes_config_cache/locale.ctc.py	Tue Mar  9 15:25:52 2010
@@ -5,42 +5,46 @@
 
 import autopath
 from ctypes_configure.configure import (configure, ExternalCompilationInfo,
-    ConstantInteger, DefinedConstantInteger, SimpleType)
+    ConstantInteger, DefinedConstantInteger, SimpleType, check_eci)
 from ctypes_configure.dumpcache import dumpcache
 
 # ____________________________________________________________
 
-_CONSTANTS = (
+_CONSTANTS = [
     'LC_CTYPE',
-    'LC_NUMERIC',
     'LC_TIME',
     'LC_COLLATE',
     'LC_MONETARY',
     'LC_MESSAGES',
+    'LC_NUMERIC',
     'LC_ALL',
-    'LC_PAPER',
-    'LC_NAME',
-    'LC_ADDRESS',
-    'LC_TELEPHONE',
-    'LC_MEASUREMENT',
-    'LC_IDENTIFICATION',
-)
+    'CHAR_MAX',
+]
 
 class LocaleConfigure:
     _compilation_info_ = ExternalCompilationInfo(includes=['locale.h'])
 for key in _CONSTANTS:
-    setattr(LocaleConfigure, key, ConstantInteger(key))
+    setattr(LocaleConfigure, key, DefinedConstantInteger(key))
 
 config = configure(LocaleConfigure, noerr=True)
+for key, value in config.items():
+    if value is None:
+        del config[key]
+        _CONSTANTS.remove(key)
 
 # ____________________________________________________________
 
-HAS_LANGINFO = True    # xxx hard-coded to True for now
+eci = ExternalCompilationInfo(includes=['langinfo.h'])
+HAS_LANGINFO = check_eci(eci)
 
 if HAS_LANGINFO:
-    # this is incomplete list
-    langinfo_names = ('CODESET D_T_FMT D_FMT T_FMT RADIXCHAR THOUSEP '
-                      'YESEXPR NOEXPR CRNCYSTR').split(" ")
+    # list of all possible names
+    langinfo_names = [
+        "RADIXCHAR", "THOUSEP", "CRNCYSTR",
+        "D_T_FMT", "D_FMT", "T_FMT", "AM_STR", "PM_STR",
+        "CODESET", "T_FMT_AMPM", "ERA", "ERA_D_FMT", "ERA_D_T_FMT",
+        "ERA_T_FMT", "ALT_DIGITS", "YESEXPR", "NOEXPR", "_DATE_FMT",
+        ]
     for i in range(1, 8):
         langinfo_names.append("DAY_%d" % i)
         langinfo_names.append("ABDAY_%d" % i)
@@ -49,16 +53,21 @@
         langinfo_names.append("ABMON_%d" % i)
     
     class LanginfoConfigure:
-        _compilation_info_ = ExternalCompilationInfo(includes=['langinfo.h'])
+        _compilation_info_ = eci
         nl_item = SimpleType('nl_item')
     for key in langinfo_names:
-        setattr(LanginfoConfigure, key, ConstantInteger(key))
+        setattr(LanginfoConfigure, key, DefinedConstantInteger(key))
 
-    config.update(configure(LanginfoConfigure))
-    _CONSTANTS = _CONSTANTS + tuple(langinfo_names)
+    langinfo_config = configure(LanginfoConfigure)
+    for key, value in langinfo_config.items():
+        if value is None:
+            del langinfo_config[key]
+            langinfo_names.remove(key)
+    config.update(langinfo_config)
+    _CONSTANTS += langinfo_names
 
 # ____________________________________________________________
 
-config['ALL_CONSTANTS'] = _CONSTANTS
+config['ALL_CONSTANTS'] = tuple(_CONSTANTS)
 config['HAS_LANGINFO'] = HAS_LANGINFO
 dumpcache(__file__, '_locale_cache.py', config)



More information about the Pypy-commit mailing list