Use extension modules without building them
I have an application that includes a module that is built from a source checkout. When installed, the app doesn't know the source dir (which will have disappeared in the case of a pip install), and autobuilding in
ffi.verify is undesirable (not just because of build products clutter, but because building will generally fail).
To make CFFI modules usable after installation would require separating building the modules from loading them. For example:
#platform.py ffi = cffi.FFI() VERIFIER_C = ''' #include <myproj/platform.h>''' def ext_builder(src_dir): return ffi.build(VERIFIER_C, ext_package='platform', include_dirs=[src_dir]) lib = ffi.load(ext_package='platform', builder=ext_builder, autobuild=False)
ffi.verifier.get_extension would call the builder registered in
autobuild=True, the builder should never be called outside of
(putting this as a proposal, but the current behaviour is a bug that makes distribution of my application difficult)