[pypy-svn] r46183 - pypy/branch/pypy-more-rtti-inprogress/rpython
fijal at codespeak.net
fijal at codespeak.net
Thu Aug 30 12:09:38 CEST 2007
Author: fijal
Date: Thu Aug 30 12:09:37 2007
New Revision: 46183
Modified:
pypy/branch/pypy-more-rtti-inprogress/rpython/extfunc.py
Log:
* Few helpers for configuration
* Be more verbose when raising exception for lazy_register
Modified: pypy/branch/pypy-more-rtti-inprogress/rpython/extfunc.py
==============================================================================
--- pypy/branch/pypy-more-rtti-inprogress/rpython/extfunc.py (original)
+++ pypy/branch/pypy-more-rtti-inprogress/rpython/extfunc.py Thu Aug 30 12:09:37 2007
@@ -47,7 +47,9 @@
raise exc, exc_inst, tb
class ExtRaisingEntry(ExtRegistryEntry):
_about_ = func
- def compute_result_annotation(self, *args_s):
+ def __getattr__(self, attr):
+ if attr == '_about_' or attr == '__dict__':
+ return super(ExtRegistryEntry, self).__getattr__(attr)
raise exc, exc_inst, tb
def registering(func):
@@ -90,6 +92,27 @@
class BaseLazyRegistering(object):
__metaclass__ = LazyRegisteringMeta
+ __ATTRIBUTES = ['includes', 'include_dirs']
+
+ def configure(self, CConfig):
+ from pypy.rpython.tool import rffi_platform as platform
+ # copy some stuff
+ for item in self.__ATTRIBUTES:
+ value = getattr(CConfig, '_%s_' % item, None)
+ if value:
+ setattr(self, '_%s_' % item, value)
+ self.__dict__.update(platform.configure(CConfig))
+
+ def llexternal(self, *args, **kwds):
+ from pypy.rpython.lltypesystem import rffi
+
+ for item in self.__ATTRIBUTES:
+ if item not in kwds:
+ kwds[item] = getattr(self, '_%s_' % item, [])
+ else:
+ kwds[item] += getattr(self, '_%s_' % item, [])
+ return rffi.llexternal(*args, **kwds)
+
class genericcallable(object):
""" A way to specify the callable annotation, but deferred until
we have bookkeeper
More information about the Pypy-commit
mailing list