Enable sane packaging for cffi applications
Currently cffi does compilation on import. This is awesome during development but it's anathema for properly packaged software. It nominally supports being built with distutils/setuptools however to making it actually do this is non obvious.
- Compilation on import hides installation problems on typical development setups
- Building with distutils places the built .so not inside of the
__pycache__but alongisde the normal .py files, which cffi doesn't notice and then attempts to compile on import.
- Putting the compile options into the package code instead of the build script (setup.py) means that developers have to invent their own method of shuttling those configs into the package at install time.
- I'm pretty sure i've run into another problem but I can't think of it off the top of my head.
Essentially you can't rely on compile on import on production systems because often times you install the package under a different user than what you first execute it as, which won't compile the .so. When you then import it it tries to compile the .so and fails due to permissions errors.
I'm not entirely sure what the best path forward is right now, certainly a good first step would be to ensure that the output of
setup.py build is picked up by cffi and then cffi won't try to recompile it.