From d4ddc2f9dafba08259ff34b7c6f334438746a2dd Mon Sep 17 00:00:00 2001 From: holger krekel Date: Sat, 23 May 2020 21:57:50 +0200 Subject: [PATCH] make wheel building work again -- switch manylinux2014 (#1522) --- ci_scripts/docker-coredeps/Dockerfile | 2 +- ci_scripts/docker-coredeps/deps/build_rust.sh | 4 +-- ci_scripts/remote_python_packaging.sh | 2 +- ci_scripts/run_all.sh | 3 +- python/README.rst | 6 ++-- python/examples/echo_and_quit.py | 7 ++-- python/src/deltachat/message.py | 8 +++-- python/tests/auditwheels.py | 4 ++- python/tests/test_account.py | 32 +++++++++++++++++++ 9 files changed, 54 insertions(+), 14 deletions(-) diff --git a/ci_scripts/docker-coredeps/Dockerfile b/ci_scripts/docker-coredeps/Dockerfile index 50f53d1d5..293d9b0a4 100644 --- a/ci_scripts/docker-coredeps/Dockerfile +++ b/ci_scripts/docker-coredeps/Dockerfile @@ -1,4 +1,4 @@ -FROM quay.io/pypa/manylinux1_x86_64 +FROM quay.io/pypa/manylinux2010_x86_64 # Configure ld.so/ldconfig and pkg-config RUN echo /usr/local/lib64 > /etc/ld.so.conf.d/local.conf && \ diff --git a/ci_scripts/docker-coredeps/deps/build_rust.sh b/ci_scripts/docker-coredeps/deps/build_rust.sh index 93e8ed281..72d3e599d 100755 --- a/ci_scripts/docker-coredeps/deps/build_rust.sh +++ b/ci_scripts/docker-coredeps/deps/build_rust.sh @@ -3,9 +3,9 @@ set -e -x # Install Rust -curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly-2020-03-19 -y +curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain 1.43.1-x86_64-unknown-linux-gnu -y export PATH=/root/.cargo/bin:$PATH rustc --version # remove some 300-400 MB that we don't need for automated builds -rm -rf /root/.rustup/toolchains/nightly-2020-03-19-x86_64-unknown-linux-gnu/share/ +rm -rf /root/.rustup/toolchains/1.43.1-x86_64-unknown-linux-gnu/share diff --git a/ci_scripts/remote_python_packaging.sh b/ci_scripts/remote_python_packaging.sh index c6042ace8..61f2e8c9a 100755 --- a/ci_scripts/remote_python_packaging.sh +++ b/ci_scripts/remote_python_packaging.sh @@ -46,6 +46,6 @@ echo "--- Running $CIRCLE_JOB remotely" ssh -t $SSHTARGET bash "$BUILDDIR/exec_docker_run" mkdir -p workspace -rsync -avz "$SSHTARGET:$BUILDDIR/python/.docker-tox/wheelhouse/*manylinux1*" workspace/wheelhouse/ +rsync -avz "$SSHTARGET:$BUILDDIR/python/.docker-tox/wheelhouse/*manylinux201*" workspace/wheelhouse/ rsync -avz "$SSHTARGET:$BUILDDIR/python/.docker-tox/dist/*" workspace/wheelhouse/ rsync -avz "$SSHTARGET:$BUILDDIR/python/doc/_build/" workspace/py-docs diff --git a/ci_scripts/run_all.sh b/ci_scripts/run_all.sh index 6565ceedb..5a320d139 100755 --- a/ci_scripts/run_all.sh +++ b/ci_scripts/run_all.sh @@ -21,7 +21,8 @@ export DCC_RS_DEV=$(pwd) export PATH=$PATH:/opt/python/cp35-cp35m/bin export PYTHONDONTWRITEBYTECODE=1 pushd /bin -ln -s /opt/python/cp27-cp27m/bin/python2.7 +rm -f python3.5 +ln -s /opt/python/cp35-cp35m/bin/python3.5 ln -s /opt/python/cp36-cp36m/bin/python3.6 ln -s /opt/python/cp37-cp37m/bin/python3.7 ln -s /opt/python/cp38-cp38/bin/python3.8 diff --git a/python/README.rst b/python/README.rst index 077d81ab0..002880dd9 100644 --- a/python/README.rst +++ b/python/README.rst @@ -113,10 +113,10 @@ You may look at `examples `_. .. _`deltachat-core`: https://github.com/deltachat/deltachat-core-rust -Building manylinux1 based wheels -================================ +Building manylinux based wheels +==================================== -Building portable manylinux1 wheels which come with libdeltachat.so +Building portable manylinux wheels which come with libdeltachat.so can be done with docker-tooling. using docker pull / premade images diff --git a/python/examples/echo_and_quit.py b/python/examples/echo_and_quit.py index 367d1fd58..0dd3707fe 100644 --- a/python/examples/echo_and_quit.py +++ b/python/examples/echo_and_quit.py @@ -14,8 +14,11 @@ class EchoPlugin: # unconditionally accept the chat message.accept_sender_contact() addr = message.get_sender_contact().addr - text = message.text - message.chat.send_text("echoing from {}:\n{}".format(addr, text)) + if message.is_system_message(): + message.chat.send_text("echoing system message from {}:\n{}".format(addr, message)) + else: + text = message.text + message.chat.send_text("echoing from {}:\n{}".format(addr, text)) @account_hookimpl def ac_message_delivered(self, message): diff --git a/python/src/deltachat/message.py b/python/src/deltachat/message.py index 706f8c8f5..41bd51276 100644 --- a/python/src/deltachat/message.py +++ b/python/src/deltachat/message.py @@ -28,8 +28,10 @@ class Message(object): def __repr__(self): c = self.get_sender_contact() - return "".format( - self.id, c.id, c.addr, self.is_outgoing(), self.chat.id, self.chat.get_name()) + typ = "outgoing" if self.is_outgoing() else "incoming" + return "".format( + typ, self.is_system_message(), repr(self.text[:10]), + self.id, c.id, c.addr, self.chat.id, self.chat.get_name()) @classmethod def from_db(cls, account, id): @@ -94,7 +96,7 @@ class Message(object): def is_system_message(self): """ return True if this message is a system/info message. """ - return lib.dc_msg_is_info(self._dc_msg) + return bool(lib.dc_msg_is_info(self._dc_msg)) def is_setup_message(self): """ return True if this message is a setup message. """ diff --git a/python/tests/auditwheels.py b/python/tests/auditwheels.py index eb4f5055a..bb8549b1c 100644 --- a/python/tests/auditwheels.py +++ b/python/tests/auditwheels.py @@ -10,4 +10,6 @@ if __name__ == "__main__": for relpath in os.listdir(workspacedir): if relpath.startswith("deltachat"): p = os.path.join(workspacedir, relpath) - subprocess.check_call(["auditwheel", "repair", p, "-w", workspacedir]) + subprocess.check_call( + ["auditwheel", "repair", p, "-w", workspacedir, + "--plat", "manylinux2014_x86_64"]) diff --git a/python/tests/test_account.py b/python/tests/test_account.py index d134bc0a1..af590b866 100644 --- a/python/tests/test_account.py +++ b/python/tests/test_account.py @@ -1064,6 +1064,38 @@ class TestOnlineAccount: assert mime.get_all("From") assert mime.get_all("Received") + @pytest.mark.xfail(reason="core emits wrong DC_EVENT_INCOMING_MSG event") + def test_send_mark_seen_clean_incoming_events(self, acfactory, lp, data): + ac1, ac2 = acfactory.get_two_online_accounts() + chat = self.get_chat(ac1, ac2, both_created=True) + + message_queue = queue.Queue() + + class InPlugin: + @account_hookimpl + def ac_incoming_message(self, message): + message_queue.put(message) + + ac1.add_account_plugin(InPlugin()) + + lp.sec("sending one message from ac1 to ac2") + chat.send_text("hello") + + lp.sec("ac2: waiting to receive") + msg = ac2._evtracker.wait_next_incoming_message() + assert msg.text == "hello" + + lp.sec("ac2: mark seen {}".format(msg)) + msg.mark_seen() + + lp.sec("ac2: send echo message") + msg.chat.send_text("world") + + lp.sec("ac1: waiting for echo message") + incoming = message_queue.get(timeout=10) + assert incoming.text == "world" + assert msg.is_in_seen() + def test_send_and_receive_image(self, acfactory, lp, data): ac1, ac2 = acfactory.get_two_online_accounts() chat = self.get_chat(ac1, ac2)