mirror of
https://github.com/chatmail/core.git
synced 2026-04-06 15:42:10 +03:00
* import python, try to adapt for rust * add missing wrapper functions * - try to write up how to build python bindings - strike some unused functions from deltachat.h * adjustments to make tox work * try to run circle-ci with python build * don't do docs * running cargo test as well * don't run cargo test anymore, that's done in other ci jobs * also build docs * don't run doxygen anymore * subst C with Rust * a try to get better wheels Closes #41
20 lines
457 B
Python
20 lines
457 B
Python
from .capi import lib
|
|
from .capi import ffi
|
|
|
|
|
|
def as_dc_charpointer(obj):
|
|
if obj == ffi.NULL or obj is None:
|
|
return ffi.NULL
|
|
if not isinstance(obj, bytes):
|
|
return obj.encode("utf8")
|
|
return obj
|
|
|
|
|
|
def iter_array(dc_array_t, constructor):
|
|
for i in range(0, lib.dc_array_get_cnt(dc_array_t)):
|
|
yield constructor(lib.dc_array_get_id(dc_array_t, i))
|
|
|
|
|
|
def from_dc_charpointer(obj):
|
|
return ffi.string(obj).decode("utf8")
|