[pypy-commit] cffi cffi-1.0: Fix these two demos

arigo noreply at buildbot.pypy.org
Fri Apr 24 12:52:40 CEST 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: cffi-1.0
Changeset: r1794:fdb29c447984
Date: 2015-04-24 12:53 +0200
http://bitbucket.org/cffi/cffi/changeset/fdb29c447984/

Log:	Fix these two demos

diff --git a/_cffi1/bsdopendirtype_build.py b/_cffi1/bsdopendirtype_build.py
--- a/_cffi1/bsdopendirtype_build.py
+++ b/_cffi1/bsdopendirtype_build.py
@@ -1,5 +1,5 @@
-from cffi1 import FFI
-import recompiler
+from cffi import FFI
+from _cffi1 import recompile
 
 ffi = FFI()
 ffi.cdef("""
@@ -15,7 +15,7 @@
     static const int DT_BLK, DT_CHR, DT_DIR, DT_FIFO, DT_LNK, DT_REG, DT_SOCK;
 """)
 
-recompiler.recompile(ffi, "_bsdopendirtype", """
+recompile(ffi, "_bsdopendirtype", """
     #include <sys/types.h>
     #include <dirent.h>
 """)
diff --git a/_cffi1/readdir2_build.py b/_cffi1/readdir2_build.py
--- a/_cffi1/readdir2_build.py
+++ b/_cffi1/readdir2_build.py
@@ -1,5 +1,5 @@
-from cffi1 import FFI
-from recompiler import recompile
+from cffi import FFI
+from _cffi1 import recompile
 
 ffi = FFI()
 ffi.cdef("""
diff --git a/_cffi1/recompiler.py b/_cffi1/recompiler.py
--- a/_cffi1/recompiler.py
+++ b/_cffi1/recompiler.py
@@ -672,11 +672,7 @@
     include_dirs.insert(0, '.')   # XXX
     return ffiplatform.get_extension(source_name, module_name, **kwds)
 
-def recompile(ffi, module_name, preamble, tmpdir=None, **kwds):
-    if tmpdir is None:
-        tmpdir = 'build'
-        if not os.path.isdir(tmpdir):
-            os.mkdir(tmpdir)
+def recompile(ffi, module_name, preamble, tmpdir='.', **kwds):
     c_file = os.path.join(tmpdir, module_name + '.c')
     ext = _get_extension(module_name, c_file, kwds)
     make_c_source(ffi, module_name, preamble, c_file)


More information about the pypy-commit mailing list