Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r862:da964df4e6c7 Date: 2012-08-18 12:03 +0200 http://bitbucket.org/cffi/cffi/changeset/da964df4e6c7/
Log: merge heads diff --git a/cffi/ffiplatform.py b/cffi/ffiplatform.py --- a/cffi/ffiplatform.py +++ b/cffi/ffiplatform.py @@ -11,9 +11,11 @@ """ -def get_extension(srcfilename, modname, **kwds): +def get_extension(srcfilename, modname, sources=(), **kwds): from distutils.core import Extension - return Extension(name=modname, sources=[srcfilename], **kwds) + allsources = [srcfilename] + allsources.extend(sources) + return Extension(name=modname, sources=allsources, **kwds) def compile(tmpdir, ext): """Compile a C extension module using distutils.""" diff --git a/testing/test_zdistutils.py b/testing/test_zdistutils.py --- a/testing/test_zdistutils.py +++ b/testing/test_zdistutils.py @@ -157,6 +157,24 @@ v.get_extension() assert os.path.exists(v.sourcefilename) + def test_extension_object_extra_sources(self): + ffi = FFI() + ffi.cdef("double test1eoes(double x);") + extra_source = str(udir.join('extension_extra_sources.c')) + with open(extra_source, 'w') as f: + f.write('double test1eoes(double x) { return x * 6.0; }\n') + csrc = '''/*9*/ + double test1eoes(double x); /* or #include "extra_sources.h" */ + ''' + lib = ffi.verify(csrc, sources=[extra_source], + force_generic_engine=self.generic) + assert lib.test1eoes(7.0) == 42.0 + v = ffi.verifier + ext = v.get_extension() + assert 'distutils.extension.Extension' in str(ext.__class__) + assert ext.sources == [v.sourcefilename, extra_source] + assert ext.name == v.get_module_name() + class TestDistUtilsCPython(DistUtilsTest): generic = False _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit