From c24c99a4ef9cabe49240d4658fd5221cbc6d1d24 Mon Sep 17 00:00:00 2001 From: Tasko Olevski Date: Thu, 15 Jun 2023 12:00:48 +0200 Subject: [PATCH] fix: use go-based powerline-shell (#358) --- docker/py/Dockerfile | 3 ++- docker/py/bashrc | 4 ++-- docker/py/powerline.config | 10 ---------- docker/py/requirements.txt | 1 - 4 files changed, 4 insertions(+), 14 deletions(-) delete mode 100644 docker/py/powerline.config diff --git a/docker/py/Dockerfile b/docker/py/Dockerfile index adbac72a..af267deb 100644 --- a/docker/py/Dockerfile +++ b/docker/py/Dockerfile @@ -61,6 +61,8 @@ RUN apt-get update && apt-get install -yq --no-install-recommends \ rm -rf /var/lib/apt/lists/* && \ ln -s /usr/lib/x86_64-linux-musl/libc.so /lib/libc.musl-x86_64.so.1 && \ wget -q https://github.com/git-lfs/git-lfs/releases/download/v3.3.0/git-lfs-linux-"$(dpkg --print-architecture)"-v3.3.0.tar.gz -P /tmp && \ + wget -q https://github.com/justjanne/powerline-go/releases/download/v1.24/powerline-go-linux-"$(dpkg --print-architecture)" -O /usr/local/bin/powerline-shell && \ + chmod a+x /usr/local/bin/powerline-shell && \ tar -zxvf /tmp/git-lfs-linux-"$(dpkg --print-architecture)"-v3.3.0.tar.gz -C /tmp && \ /tmp/git-lfs-3.3.0/install.sh && \ rm -rf /tmp/git-lfs* @@ -75,7 +77,6 @@ RUN mkdir -p "$HOME/.ssh" && \ # configure bash and shell prompt ENV PATH=$HOME/.local/bin:$PATH:$HOME/.renku/bin COPY --chown=1000:100 bashrc /renku/ -COPY --chown=1000:100 powerline.config /home/${NB_USER}/.config/powerline-shell/config.json RUN cat "/renku/bashrc" >> "${HOME}/.bashrc" COPY entrypoint.sh /entrypoint.sh diff --git a/docker/py/bashrc b/docker/py/bashrc index 9890d140..8fb3003a 100644 --- a/docker/py/bashrc +++ b/docker/py/bashrc @@ -13,10 +13,10 @@ if [[ -z "$(git config --global --get user.email)" && -v EMAIL ]]; then fi function _update_ps1() { - PS1=$(powerline-shell $?) + PS1="$(/usr/local/bin/powerline-shell -error $? -jobs $(jobs -p | wc -l) -mode compatible -modules ssh,venv,cwd,git,root)" } -if [[ $TERM != linux && ! $PROMPT_COMMAND =~ _update_ps1 ]]; then +if [ "$TERM" != "linux" ] && [ -f "/usr/local/bin/powerline-shell" ]; then PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND" fi diff --git a/docker/py/powerline.config b/docker/py/powerline.config deleted file mode 100644 index a92bb34b..00000000 --- a/docker/py/powerline.config +++ /dev/null @@ -1,10 +0,0 @@ -{ - "segments": [ - "ssh", - "virtual_env", - "cwd", - "git", - "root" - ], - "mode": "compatible" -} diff --git a/docker/py/requirements.txt b/docker/py/requirements.txt index 5ee8db67..7395e8d8 100644 --- a/docker/py/requirements.txt +++ b/docker/py/requirements.txt @@ -6,7 +6,6 @@ jupyterlab-git==0.41.0 jupyterlab-system-monitor~=0.8.0 mistune>=2.0.1 # not directly required, pinned by Snyk to avoid a vulnerability papermill~=2.4.0 -powerline-shell~=0.7.0 requests>=2.20.0 setuptools>=65.5.1 # not directly required, pinned by Snyk to avoid a vulnerability virtualenv>=20.7.2