1
0
Fork 0
mirror of https://github.com/deltachat/deltachat-core.git synced 2025-10-04 10:19:16 +02:00

WIP: First stop towards python bindings

This is a very rough first stab at compiling CFFI Python bindings
for deltachat-core.
This commit is contained in:
Floris Bruynooghe 2017-12-30 12:53:58 +01:00 committed by Floris Bruynooghe
parent 231d6b6a87
commit b1261ed028
4 changed files with 55 additions and 0 deletions

22
python/setup.py Normal file
View file

@ -0,0 +1,22 @@
import setuptools
setuptools.setup(
name='deltachat',
version='0.1',
description='Python bindings for deltachat-core using CFFI',
author='Delta Chat contributors',
setup_requires=['cffi>=1.0.0'],
install_requires=['cffi>=1.0.0'],
packages=setuptools.find_packages('src'),
package_dir={'': 'src'},
cffi_modules=['src/deltachat/_build.py:ffibuilder'],
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'License :: OSI Approved :: GNU General Public License (GPL)',
'Programming Language :: Python :: 3',
'Topic :: Communications :: Email',
'Topic :: Software Development :: Libraries',
],
)

View file

@ -0,0 +1,23 @@
import subprocess
import tempfile
import cffi
ffibuilder = cffi.FFI()
ffibuilder.set_source(
'deltachat.capi',
"""
#include <deltachat/mrmailbox.h>
""",
libraries=['deltachat'],
)
with tempfile.NamedTemporaryFile(mode='r') as fp:
proc = subprocess.run(['gcc', '-E', '-o', fp.name, '-DPY_CFFI=1',
'../src/mrmailbox.h'])
proc.check_returncode()
ffibuilder.cdef(fp.read())
if __name__ == '__main__':
ffibuilder.compile(verbose=True)