[pypy-svn] r71865 - in pypy/branch/ctypes-configure-cache-2/pypy/lib: . app_test ctypes_config_cache

arigo at codespeak.net arigo at codespeak.net
Sat Mar 6 14:22:28 CET 2010


Author: arigo
Date: Sat Mar  6 14:22:27 2010
New Revision: 71865

Added:
   pypy/branch/ctypes-configure-cache-2/pypy/lib/app_test/test_syslog.py   (contents, props changed)
Modified:
   pypy/branch/ctypes-configure-cache-2/pypy/lib/ctypes_config_cache/syslog.ctc.py
   pypy/branch/ctypes-configure-cache-2/pypy/lib/syslog.py
Log:
Test and fix.


Added: pypy/branch/ctypes-configure-cache-2/pypy/lib/app_test/test_syslog.py
==============================================================================
--- (empty file)
+++ pypy/branch/ctypes-configure-cache-2/pypy/lib/app_test/test_syslog.py	Sat Mar  6 14:22:27 2010
@@ -0,0 +1,11 @@
+
+# XXX very minimal test
+
+from pypy.lib.ctypes_config_cache import rebuild
+rebuild.rebuild_one('syslog.ctc.py')
+
+from pypy.lib import syslog
+
+
+def test_syslog():
+    assert hasattr(syslog, 'LOG_ALERT')

Modified: pypy/branch/ctypes-configure-cache-2/pypy/lib/ctypes_config_cache/syslog.ctc.py
==============================================================================
--- pypy/branch/ctypes-configure-cache-2/pypy/lib/ctypes_config_cache/syslog.ctc.py	(original)
+++ pypy/branch/ctypes-configure-cache-2/pypy/lib/ctypes_config_cache/syslog.ctc.py	Sat Mar  6 14:22:27 2010
@@ -64,17 +64,13 @@
     setattr(SyslogConfigure, key, DefinedConstantInteger(key))
 
 config = configure(SyslogConfigure)
-optional_constants = []
 for key in _OPTIONAL_CONSTANTS:
-    if config[key] is not None:
-        optional_constants.append(key)
-    else:
+    if config[key] is None:
         del config[key]
 for alias, key in _ALIAS:
-    if alias in optional_constants:
-        continue
-    config[alias] = config[key]
-    optional_constants.append(alias)
+    config.setdefault(alias, config[key])
 
-config['optional_constants'] = optional_constants
+all_constants = config.keys()
+all_constants.sort()
+config['ALL_CONSTANTS'] = tuple(all_constants)
 dumpcache(__file__, '_syslog_cache.py', config)

Modified: pypy/branch/ctypes-configure-cache-2/pypy/lib/syslog.py
==============================================================================
--- pypy/branch/ctypes-configure-cache-2/pypy/lib/syslog.py	(original)
+++ pypy/branch/ctypes-configure-cache-2/pypy/lib/syslog.py	Sat Mar  6 14:22:27 2010
@@ -56,9 +56,8 @@
 def LOG_UPTO(pri):
     return (1 << (pri + 1)) - 1
 
-__all__ = _CONSTANTS + tuple(optional_constants) + (
+__all__ = ALL_CONSTANTS + (
     'openlog', 'syslog', 'closelog', 'setlogmask',
     'LOG_MASK', 'LOG_UPTO')
 
-del optional_constants
-
+del ALL_CONSTANTS



More information about the Pypy-commit mailing list