def build_cffi(base_path, **extra): # dylib dylib = self.dylib() if callable(dylib): dylib = dylib() log.info('copying dylib %s', os.path.basename(dylib)) shutil.copy2(dylib, os.path.join(base_path, self.lib_filename)) # generate cffi module ffi = make_ffi() log.info('generating cffi module for %r' % self.module_path) py_file = os.path.join( base_path, *self.cffi_module_path.split('.')[1:]) + '.py' updated = cffi_recompiler.make_py_source(ffi, self.cffi_module_path, py_file) if not updated: log.info("already up-to-date") # wrapper log.info('generating wrapper for %r' % self.module_path) with open(os.path.join(base_path, self.name + '.py'), 'wb') as f: f.write((MODULE_PY % { 'cffi_module_path': self.cffi_module_path, 'lib_filename': self.lib_filename, 'rtld_flags': self.rtld_flags, }).encode('utf-8'))
def make_ffi(): from milksnake.ffi import make_ffi return make_ffi(self.module_path, self.get_header_source(), strip_directives=True)
def make_ffi(): from milksnake.ffi import make_ffi return make_ffi(self.module_path, self.get_header_source())