[pypy-commit] cffi cffi-1.0: Change the other two demos to the ffi.set_source() style too

arigo noreply at buildbot.pypy.org
Wed Apr 29 20:02:37 CEST 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: cffi-1.0
Changeset: r1878:68b878e3ccbb
Date: 2015-04-29 20:03 +0200
http://bitbucket.org/cffi/cffi/changeset/68b878e3ccbb/

Log:	Change the other two demos to the ffi.set_source() style too

diff --git a/demo/_curses_build.py b/demo/_curses_build.py
--- a/demo/_curses_build.py
+++ b/demo/_curses_build.py
@@ -4,7 +4,6 @@
     raise ImportError('No module named _curses')
 
 from cffi import FFI
-from _cffi1 import recompile
 
 ffi = FFI()
 
@@ -283,7 +282,7 @@
 """)
 
 
-recompile(ffi, "_curses_cffi", """
+ffi.set_source("_curses_cffi", """
 #ifdef __APPLE__
 /* the following define is necessary for OS X 10.6+; without it, the
    Apple-supplied ncurses.h sets NCURSES_OPAQUE to 1, and then Python
@@ -323,3 +322,6 @@
     getsyx(yx[0], yx[1]);
 }
 """, libraries=['ncurses', 'panel'])
+
+if __name__ == '__main__':
+    ffi.compile()
diff --git a/demo/_curses_setup.py b/demo/_curses_setup.py
new file mode 100644
--- /dev/null
+++ b/demo/_curses_setup.py
@@ -0,0 +1,13 @@
+from setuptools import setup
+
+setup(
+    name="_curses",
+    version="0.1",
+    py_modules=["_curses"],
+    setup_requires=["cffi>=1.0"],
+    cffi_modules=[
+        "_curses_build:ffi",
+    ],
+    install_requires=["cffi>=1.0"],   # should maybe be "cffi-backend" only?
+    zip_safe=False,
+)
diff --git a/demo/readdir2_build.py b/demo/readdir2_build.py
--- a/demo/readdir2_build.py
+++ b/demo/readdir2_build.py
@@ -1,5 +1,4 @@
 from cffi import FFI
-from _cffi1 import recompile
 
 ffi = FFI()
 ffi.cdef("""
@@ -21,7 +20,7 @@
     static const int DT_DIR;
 
 """)
-recompile(ffi, "_readdir2", """
+ffi.set_source("_readdir2", """
 #ifndef _ATFILE_SOURCE
 #  define _ATFILE_SOURCE
 #endif
@@ -32,3 +31,6 @@
 #include <sys/types.h>
 #include <dirent.h>
 """)
+
+if __name__ == '__main__':
+    ffi.compile()
diff --git a/demo/readdir2_setup.py b/demo/readdir2_setup.py
new file mode 100644
--- /dev/null
+++ b/demo/readdir2_setup.py
@@ -0,0 +1,13 @@
+from setuptools import setup
+
+setup(
+    name="readdir2",
+    version="0.1",
+    py_modules=["readdir2"],
+    setup_requires=["cffi>=1.0"],
+    cffi_modules=[
+        "readdir2_build:ffi",
+    ],
+    install_requires=["cffi>=1.0"],   # should maybe be "cffi-backend" only?
+    zip_safe=False,
+)


More information about the pypy-commit mailing list