mirror of
https://github.com/chatmail/core.git
synced 2026-05-09 01:46:30 +03:00
remove some print statements
This commit is contained in:
@@ -1,9 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
set -ex
|
|
||||||
|
|
||||||
export DCC_RS_TARGET=release
|
|
||||||
|
|
||||||
cargo build -p deltachat_ffi --${DCC_RS_TARGET}
|
|
||||||
rm -rf build/ src/deltachat/*.so
|
|
||||||
DCC_RS_DEV=`pwd`/.. pip install -e .
|
|
||||||
36
python/install_python_bindings.py
Executable file
36
python/install_python_bindings.py
Executable file
@@ -0,0 +1,36 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
"""
|
||||||
|
setup a python binding development in-place install with cargo debug symbols.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
os.environ["DCC_RS_TARGET"] = target = "release"
|
||||||
|
|
||||||
|
toml = os.path.join(os.getcwd(), "..", "Cargo.toml")
|
||||||
|
assert os.path.exists(toml)
|
||||||
|
with open(toml) as f:
|
||||||
|
s = orig = f.read()
|
||||||
|
s += "\n"
|
||||||
|
s += "[profile.release]\n"
|
||||||
|
s += "debug = true\n"
|
||||||
|
with open(toml, "w") as f:
|
||||||
|
f.write(s)
|
||||||
|
print("temporarily modifying Cargo.toml to provide release build with debug symbols ")
|
||||||
|
try:
|
||||||
|
subprocess.check_call([
|
||||||
|
"cargo", "build", "-p", "deltachat_ffi", "--" + target
|
||||||
|
])
|
||||||
|
finally:
|
||||||
|
with open(toml, "w") as f:
|
||||||
|
f.write(orig)
|
||||||
|
print("\nreseted Cargo.toml to previous original state")
|
||||||
|
|
||||||
|
subprocess.check_call("rm -rf build/ src/deltachat/*.so" , shell=True)
|
||||||
|
|
||||||
|
subprocess.check_call([
|
||||||
|
"pip", "install", "-e", "."
|
||||||
|
])
|
||||||
@@ -25,6 +25,7 @@ def ffibuilder():
|
|||||||
else:
|
else:
|
||||||
raise NotImplementedError("Compilation not supported yet on Windows, can you help?")
|
raise NotImplementedError("Compilation not supported yet on Windows, can you help?")
|
||||||
objs = [os.path.join(projdir, 'target', target, 'libdeltachat.a')]
|
objs = [os.path.join(projdir, 'target', target, 'libdeltachat.a')]
|
||||||
|
assert os.path.exists(objs[0]), objs
|
||||||
incs = [os.path.join(projdir, 'deltachat-ffi')]
|
incs = [os.path.join(projdir, 'deltachat-ffi')]
|
||||||
else:
|
else:
|
||||||
libs = ['deltachat']
|
libs = ['deltachat']
|
||||||
|
|||||||
@@ -36,14 +36,17 @@ class Account(object):
|
|||||||
lib.dc_context_new(lib.py_dc_callback, ffi.NULL, ffi.NULL),
|
lib.dc_context_new(lib.py_dc_callback, ffi.NULL, ffi.NULL),
|
||||||
_destroy_dc_context,
|
_destroy_dc_context,
|
||||||
)
|
)
|
||||||
|
if eventlogging:
|
||||||
|
self._evlogger = EventLogger(self._dc_context, logid)
|
||||||
|
deltachat.set_context_callback(self._dc_context, self._process_event)
|
||||||
|
self._threads = IOThreads(self._dc_context, self._evlogger._log_event)
|
||||||
|
else:
|
||||||
self._threads = IOThreads(self._dc_context)
|
self._threads = IOThreads(self._dc_context)
|
||||||
|
|
||||||
if hasattr(db_path, "encode"):
|
if hasattr(db_path, "encode"):
|
||||||
db_path = db_path.encode("utf8")
|
db_path = db_path.encode("utf8")
|
||||||
if not lib.dc_open(self._dc_context, db_path, ffi.NULL):
|
if not lib.dc_open(self._dc_context, db_path, ffi.NULL):
|
||||||
raise ValueError("Could not dc_open: {}".format(db_path))
|
raise ValueError("Could not dc_open: {}".format(db_path))
|
||||||
if eventlogging:
|
|
||||||
self._evlogger = EventLogger(self._dc_context, logid)
|
|
||||||
deltachat.set_context_callback(self._dc_context, self._process_event)
|
|
||||||
self._configkeys = self.get_config("sys.config_keys").split()
|
self._configkeys = self.get_config("sys.config_keys").split()
|
||||||
self._imex_completed = threading.Event()
|
self._imex_completed = threading.Event()
|
||||||
|
|
||||||
@@ -340,7 +343,7 @@ class Account(object):
|
|||||||
|
|
||||||
def shutdown(self, wait=True):
|
def shutdown(self, wait=True):
|
||||||
""" stop threads and close and remove underlying dc_context and callbacks. """
|
""" stop threads and close and remove underlying dc_context and callbacks. """
|
||||||
if hasattr(self, "_dc_context"):
|
if hasattr(self, "_dc_context") and hasattr(self, "_threads"):
|
||||||
self.stop_threads(wait=False) # to interrupt idle and tell python threads to stop
|
self.stop_threads(wait=False) # to interrupt idle and tell python threads to stop
|
||||||
lib.dc_close(self._dc_context)
|
lib.dc_close(self._dc_context)
|
||||||
self.stop_threads(wait=wait) # to wait for threads
|
self.stop_threads(wait=wait) # to wait for threads
|
||||||
@@ -362,10 +365,11 @@ class Account(object):
|
|||||||
|
|
||||||
|
|
||||||
class IOThreads:
|
class IOThreads:
|
||||||
def __init__(self, dc_context):
|
def __init__(self, dc_context, log_event=lambda *args: None):
|
||||||
self._dc_context = dc_context
|
self._dc_context = dc_context
|
||||||
self._thread_quitflag = False
|
self._thread_quitflag = False
|
||||||
self._name2thread = {}
|
self._name2thread = {}
|
||||||
|
self._log_event = log_event
|
||||||
|
|
||||||
def is_started(self):
|
def is_started(self):
|
||||||
return len(self._name2thread) > 0
|
return len(self._name2thread) > 0
|
||||||
@@ -391,17 +395,19 @@ class IOThreads:
|
|||||||
thread.join()
|
thread.join()
|
||||||
|
|
||||||
def imap_thread_run(self):
|
def imap_thread_run(self):
|
||||||
|
self._log_event("py-bindings-info", 0, "IMAP THREAD START")
|
||||||
while not self._thread_quitflag:
|
while not self._thread_quitflag:
|
||||||
lib.dc_perform_imap_jobs(self._dc_context)
|
lib.dc_perform_imap_jobs(self._dc_context)
|
||||||
lib.dc_perform_imap_fetch(self._dc_context)
|
lib.dc_perform_imap_fetch(self._dc_context)
|
||||||
lib.dc_perform_imap_idle(self._dc_context)
|
lib.dc_perform_imap_idle(self._dc_context)
|
||||||
print("IMAP_THREAD finished")
|
self._log_event("py-bindings-info", 0, "IMAP THREAD FINISHED")
|
||||||
|
|
||||||
def smtp_thread_run(self):
|
def smtp_thread_run(self):
|
||||||
|
self._log_event("py-bindings-info", 0, "SMTP THREAD START")
|
||||||
while not self._thread_quitflag:
|
while not self._thread_quitflag:
|
||||||
lib.dc_perform_smtp_jobs(self._dc_context)
|
lib.dc_perform_smtp_jobs(self._dc_context)
|
||||||
lib.dc_perform_smtp_idle(self._dc_context)
|
lib.dc_perform_smtp_idle(self._dc_context)
|
||||||
print("SMTP_THREAD finished")
|
self._log_event("py-bindings-info", 0, "SMTP THREAD FINISHED")
|
||||||
|
|
||||||
|
|
||||||
class EventLogger:
|
class EventLogger:
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ def test_dc_close_events():
|
|||||||
if info_string in data2:
|
if info_string in data2:
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
print("skipping info event", data2)
|
print("skipping event", *ev)
|
||||||
|
|
||||||
find("disconnecting INBOX-watch")
|
find("disconnecting INBOX-watch")
|
||||||
find("disconnecting sentbox-thread")
|
find("disconnecting sentbox-thread")
|
||||||
|
|||||||
@@ -80,12 +80,10 @@ unsafe fn dc_job_perform(context: &Context, thread: libc::c_int, probe_network:
|
|||||||
params_probe
|
params_probe
|
||||||
};
|
};
|
||||||
|
|
||||||
info!(context, 0, "dc_job_perform before query");
|
|
||||||
let jobs: Result<Vec<dc_job_t>, _> = context.sql.query_map(
|
let jobs: Result<Vec<dc_job_t>, _> = context.sql.query_map(
|
||||||
query,
|
query,
|
||||||
params,
|
params,
|
||||||
|row| {
|
|row| {
|
||||||
info!(context, 0, "START jobs query_maps");
|
|
||||||
let job = dc_job_t {
|
let job = dc_job_t {
|
||||||
job_id: row.get(0)?,
|
job_id: row.get(0)?,
|
||||||
action: row.get(1)?,
|
action: row.get(1)?,
|
||||||
@@ -102,22 +100,17 @@ unsafe fn dc_job_perform(context: &Context, thread: libc::c_int, probe_network:
|
|||||||
let packed_c = to_cstring(packed);
|
let packed_c = to_cstring(packed);
|
||||||
dc_param_set_packed(job.param, packed_c);
|
dc_param_set_packed(job.param, packed_c);
|
||||||
free(packed_c as *mut _);
|
free(packed_c as *mut _);
|
||||||
info!(context, 0, "DONE jobs query_maps row");
|
|
||||||
Ok(job)
|
Ok(job)
|
||||||
},
|
},
|
||||||
|jobs| {
|
|jobs| {
|
||||||
info!(context, 0, "collecting jobs");
|
|
||||||
let res = jobs
|
let res = jobs
|
||||||
.collect::<Result<Vec<dc_job_t>, _>>()
|
.collect::<Result<Vec<dc_job_t>, _>>()
|
||||||
.map_err(Into::into);
|
.map_err(Into::into);
|
||||||
info!(context, 0, "collecting jobs done");
|
|
||||||
res
|
res
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
match jobs {
|
match jobs {
|
||||||
Ok(ref res) => {
|
Ok(ref res) => {}
|
||||||
info!(context, 0, "query done, {:?}", res.len());
|
|
||||||
}
|
|
||||||
Err(ref err) => {
|
Err(ref err) => {
|
||||||
info!(context, 0, "query failed: {:?}", err);
|
info!(context, 0, "query failed: {:?}", err);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user