From: Georges Discry Date: Tue, 15 Nov 2022 11:22:31 +0000 (+0100) Subject: Use the right python when mkosi is a symlink X-Git-Tag: v15~389 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c662da41038048fd4ba9d608ae7f608efe90182d;p=thirdparty%2Fmkosi.git Use the right python when mkosi is a symlink When the `mkosi` on the `PATH` is a symlink to the script installed inside a virtualenv, the script fails to find the python executable inside the virtualenv and falls back to the main python3. This is notably the case when installing mkosi with pipx. By first following the symlink inside the virtualenv, the script can find the corresponding python executable. --- diff --git a/bin/mkosi b/bin/mkosi index 7bbc73445..3fac96b2a 100755 --- a/bin/mkosi +++ b/bin/mkosi @@ -13,6 +13,7 @@ # python3 -m pip install --user # python3 -m pip install --user --editable # /path/to/venv/bin/python3 -m pip install +# pipx install # and running directly from the source checkout. # # In the first and the next-to-last cases this script is a noop because we leave @@ -22,7 +23,7 @@ # cloned to, for "--editable" installations, when this script is run via sudo. # When running from a source checkout, we prepend that directory to the path. -PYROOT=$(dirname "$0") +PYROOT="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" if [[ -x "${PYROOT}/python3" ]] then