summaryrefslogtreecommitdiff
path: root/demo
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2016-06-05 23:01:54 +0200
committerArmin Rigo <arigo@tunes.org>2016-06-05 23:01:54 +0200
commitf3ba2e017250bfb0986134f19064426438c37f7c (patch)
treefe6a5c65968272b64957a6ebb7cd8869567bb069 /demo
parentaf4e83e3dee906aa54606546f397aa7848d01519 (diff)
downloadcffi-f3ba2e017250bfb0986134f19064426438c37f7c.tar.gz
Rename 'ffi' to 'ffibuilder' in the docs and in a few demos, when
it is used in out-of-line builders. I think it makes things clearer, particularly in examples where the two 'ffi' are close together (and even sometimes used in the same sentence...)
Diffstat (limited to 'demo')
-rw-r--r--demo/bsdopendirtype_build.py8
-rw-r--r--demo/bsdopendirtype_setup.py2
-rw-r--r--demo/embedding.py10
-rw-r--r--demo/gmp_build.py8
-rw-r--r--demo/setup.py12
5 files changed, 14 insertions, 26 deletions
diff --git a/demo/bsdopendirtype_build.py b/demo/bsdopendirtype_build.py
index a771b68..3c5bb0b 100644
--- a/demo/bsdopendirtype_build.py
+++ b/demo/bsdopendirtype_build.py
@@ -1,7 +1,7 @@
from cffi import FFI
-ffi = FFI()
-ffi.cdef("""
+ffibuilder = FFI()
+ffibuilder.cdef("""
typedef ... DIR;
struct dirent {
unsigned char d_type; /* type of file */
@@ -14,10 +14,10 @@ ffi.cdef("""
static const int DT_BLK, DT_CHR, DT_DIR, DT_FIFO, DT_LNK, DT_REG, DT_SOCK;
""")
-ffi.set_source("_bsdopendirtype", """
+ffibuilder.set_source("_bsdopendirtype", """
#include <sys/types.h>
#include <dirent.h>
""")
if __name__ == '__main__':
- ffi.compile()
+ ffibuilder.compile(verbose=True)
diff --git a/demo/bsdopendirtype_setup.py b/demo/bsdopendirtype_setup.py
index aa17a65..30a6cfb 100644
--- a/demo/bsdopendirtype_setup.py
+++ b/demo/bsdopendirtype_setup.py
@@ -6,7 +6,7 @@ setup(
py_modules=["bsdopendirtype"],
setup_requires=["cffi>=1.0.dev0"],
cffi_modules=[
- "bsdopendirtype_build.py:ffi",
+ "bsdopendirtype_build.py:ffibuilder",
],
install_requires=["cffi>=1.0.dev0"], # should maybe be "cffi-backend" only?
zip_safe=False,
diff --git a/demo/embedding.py b/demo/embedding.py
index 40c419f..b15c050 100644
--- a/demo/embedding.py
+++ b/demo/embedding.py
@@ -1,12 +1,12 @@
import cffi
-ffi = cffi.FFI()
+ffibuilder = cffi.FFI()
-ffi.embedding_api("""
+ffibuilder.embedding_api("""
int add(int, int);
""")
-ffi.embedding_init_code("""
+ffibuilder.embedding_init_code("""
from _embedding_cffi import ffi
print("preparing") # printed once
@@ -16,6 +16,6 @@ ffi.embedding_init_code("""
return x + y
""")
-ffi.set_source("_embedding_cffi", "")
+ffibuilder.set_source("_embedding_cffi", "")
-ffi.compile(verbose=True)
+ffibuilder.compile(verbose=True)
diff --git a/demo/gmp_build.py b/demo/gmp_build.py
index 763d6cd..e1a6000 100644
--- a/demo/gmp_build.py
+++ b/demo/gmp_build.py
@@ -6,9 +6,9 @@ import cffi
# http://bazaar.launchpad.net/~tolot-solar-empire/+junk/gmpy_cffi/files
#
-ffi = cffi.FFI()
+ffibuilder = cffi.FFI()
-ffi.cdef("""
+ffibuilder.cdef("""
typedef struct { ...; } MP_INT;
typedef MP_INT mpz_t[1];
@@ -19,8 +19,8 @@ ffi.cdef("""
""")
-ffi.set_source('_gmp_cffi', "#include <gmp.h>",
+ffibuilder.set_source('_gmp_cffi', "#include <gmp.h>",
libraries=['gmp', 'm'])
if __name__ == '__main__':
- ffi.compile(verbose=True)
+ ffibuilder.compile(verbose=True)
diff --git a/demo/setup.py b/demo/setup.py
deleted file mode 100644
index 81b4adb..0000000
--- a/demo/setup.py
+++ /dev/null
@@ -1,12 +0,0 @@
-#
-# A minimal example of setup.py to install a Python module
-# together with the custom C extension module generated by CFFI.
-#
-
-from distutils.core import setup
-from distutils.extension import Extension
-import bsdopendirtype
-
-setup(name='bsdopendirtype',
- py_modules=['bsdopendirtype'],
- ext_modules=[bsdopendirtype.ffi.verifier.get_extension()])