Ability to fully override naming of temporary files
I would like to be able to fully override the naming of temporary files to ensure cffi's verifier has no chance to act up and change the hash for generated modules. The verifier should also support failing with an exception when it can't find the module instead of trying to build it anew.
The current automagical behavior is neat when it works, but can be absolutely unnerving when it doesn't. Less moving parts == less guesswork and awkward debugging sessions for me.
Rationale: I'm occasionally running into weird issues where a cffi-based package is installed with its compiled extension module, but the verifier still insists on recompiling it. In this instance, the error occured with CPython 2.7 (the Portable Python build), although I have also experienced it with PyPy before. I'm passing
to the setup() function in setup.py. When the setup.py imports the bullet module, the verifier generates py and pyd modules with the hash prefix "_cffi__x3eb38760xb07eed14", and these are being installed.
However, when first importing the installed module, CFFI expects a different hash:
>>> import bullet load_lib() called _cffi__x2d4f5f88x997efa59.c lib\site-packages\pybullet_cffi-0.1-py2.7-win32.egg\bullet\__pycache__\_cffi__x2 d4f5f88x997efa59.c(151) : fatal error C1083: Cannot open include file: 'bullet_w rapper.h': No such file or directory Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\ppy27\lib\site-packages\pybullet_cffi-0.1-py2.7-win32.egg\bullet\__in it__.py", line 4, in <module> from .proxy import * File "C:\ppy27\lib\site-packages\pybullet_cffi-0.1-py2.7-win32.egg\bullet\prox y.py", line 7, in <module> from ._bullet import * File "C:\ppy27\lib\site-packages\pybullet_cffi-0.1-py2.7-win32.egg\bullet\_bul let.py", line 523, in <module> """) File "C:\ppy27\lib\site-packages\pybullet_cffi-0.1-py2.7-win32.egg\bullet\inte rnal.py", line 84, in load_lib _LIB = _ffi.verify(VERIFY_SOURCE, **VERIFY_OPTIONS) File "C:\ppy27\lib\site-packages\cffi-0.5-py2.7-win32.egg\cffi\api.py", line 2 99, in verify lib = self.verifier.load_library() File "C:\ppy27\lib\site-packages\cffi-0.5-py2.7-win32.egg\cffi\verifier.py", l ine 63, in load_library self.compile_module() File "C:\ppy27\lib\site-packages\cffi-0.5-py2.7-win32.egg\cffi\verifier.py", l ine 51, in compile_module self._compile_module() File "C:\ppy27\lib\site-packages\cffi-0.5-py2.7-win32.egg\cffi\verifier.py", l ine 132, in _compile_module outputfilename = ffiplatform.compile(tmpdir, self.get_extension()) File "C:\ppy27\lib\site-packages\cffi-0.5-py2.7-win32.egg\cffi\ffiplatform.py" , line 25, in compile outputfilename = _build(tmpdir, ext) File "C:\ppy27\lib\site-packages\cffi-0.5-py2.7-win32.egg\cffi\ffiplatform.py" , line 50, in _build raise VerificationError('%s: %s' % (e.__class__.__name__, e)) cffi.ffiplatform.VerificationError: CompileError: command '"c:\Program Files (x8 6)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe"' failed with exit status 2
I have given up on hunting down these issues, I just want it to stop. Stuff like this makes CFFI appear fragile and moody instead of cunningly clever. With a more primitive alternative, a module could be outdated, but this is easier to remedy (just delete all generated files) than this autoelectric hellhole.