Setuptools functionality breaks when cffi_modules is used
Created originally on Bitbucket by Arnout van Meer
We've just had to change how one of our cffi related modules builds and added cffi_modules to our setup.py. This broke our build. I think I tracked the root of the issue down to setuptools_ext.py, specifically _add_py_module importing build_py (and likely build_ext) from distutils instead of setuptools. This results in any setuptools functionality getting 'lost'. It looks like an earlier modification to _add_c_module above it already seems to have fixed this.
We'd appreciated a quick fix to this; currently we're unable to make builds unless we locally edit the module.
Proposed patch:
#!diff
def _add_py_module(dist, ffi, module_name):
from distutils.dir_util import mkpath
- from distutils.command.build_py import build_py
- from distutils.command.build_ext import build_ext
+ from setuptools.command.build_py import build_py
+ from setuptools.command.build_ext import build_ext
from distutils import log
from cffi import recompiler