[pypy-svn] r73630 - pypy/branch/cpython-extension/pypy/module/cpyext
xoraxax at codespeak.net
xoraxax at codespeak.net
Sat Apr 10 17:40:42 CEST 2010
Author: xoraxax
Date: Sat Apr 10 17:40:41 2010
New Revision: 73630
Modified:
pypy/branch/cpython-extension/pypy/module/cpyext/api.py
Log:
Copy header files to _interfaces directory.
Modified: pypy/branch/cpython-extension/pypy/module/cpyext/api.py
==============================================================================
--- pypy/branch/cpython-extension/pypy/module/cpyext/api.py (original)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/api.py Sat Apr 10 17:40:41 2010
@@ -1,5 +1,6 @@
import ctypes
import sys
+import atexit
import py
@@ -36,11 +37,14 @@
size_t = rffi.ULONG
ADDR = lltype.Signed
-include_dir = py.path.local(autopath.pypydir) / 'module' / 'cpyext' / 'include'
-source_dir = py.path.local(autopath.pypydir) / 'module' / 'cpyext' / 'src'
+pypydir = py.path.local(autopath.pypydir)
+include_dir = pypydir / 'module' / 'cpyext' / 'include'
+source_dir = pypydir / 'module' / 'cpyext' / 'src'
+interfaces_dir = pypydir / "_interfaces"
include_dirs = [
include_dir,
udir,
+ interfaces_dir,
]
class CConfig:
@@ -67,6 +71,10 @@
udir.join('pypy_macros.h').write("/* Will be filled later */")
globals().update(rffi_platform.configure(CConfig_constants))
+def copy_header_files():
+ for name in ("pypy_decl.h", "pypy_macros.h"):
+ udir.join(name).copy(interfaces_dir / name)
+
_NOT_SPECIFIED = object()
CANNOT_FAIL = object()
@@ -557,13 +565,6 @@
for i in range(len(func.argtypes)))
body = "{ return _pypyAPI.%s(%s); }" % (name, callargs)
functions.append('%s\n%s\n' % (header, body))
- for name, (typ, expr) in GLOBALS.iteritems():
- name_clean = name.replace("#", "")
- if not globals_are_pointers:
- typ = typ.replace("*", "")
- pypy_decls.append('PyAPI_DATA(%s) %s;' % (typ, name_clean))
- if not globals_are_pointers and "#" not in name:
- pypy_decls.append("#define %s &%s" % (name, name,))
for name in VA_TP_LIST:
name_no_star = process_va_name(name)
header = ('%s pypy_va_get_%s(va_list* vp)' %
@@ -571,7 +572,14 @@
pypy_decls.append(header + ';')
functions.append(header + '\n{return va_arg(*vp, %s);}\n' % name)
export_symbols.append('pypy_va_get_%s' % (name_no_star,))
-
+
+ for name, (typ, expr) in GLOBALS.iteritems():
+ name_clean = name.replace("#", "")
+ if not globals_are_pointers:
+ typ = typ.replace("*", "")
+ pypy_decls.append('PyAPI_DATA(%s) %s;' % (typ, name_clean))
+ if not globals_are_pointers and "#" not in name:
+ pypy_decls.append("#define %s &%s" % (name, name,))
pypy_decls.append("#endif\n")
pypy_decl_h = udir.join('pypy_decl.h')
@@ -646,6 +654,7 @@
func.get_wrapper(space).c_name = name
setup_init_functions(eci)
+ copy_header_files()
@unwrap_spec(ObjSpace, str, str)
def load_extension_module(space, path, name):
More information about the Pypy-commit
mailing list