diff options
author | Leah Rowe <leah@libreboot.org> | 2025-01-05 21:48:45 +0000 |
---|---|---|
committer | Leah Rowe <leah@libreboot.org> | 2025-01-05 21:48:45 +0000 |
commit | 411fb697dfce1733c7c572205e3bdddd005d8c08 (patch) | |
tree | ec7596cbef74c2c1ecd58bd90032ac8b4a9a5246 /include/lib.sh | |
parent | e8336bcc3caaa7c3dad1d8e2324ba8977bf5aadb (diff) |
set up python in PATH, ensuring that it is python3
we already check the python version, and set a variable
for it, so that we can reliably use python3, even if
python in PATH doesn't correspond to python3. for
example if a system has python as python2 and python3
as python3
well, we use that when running deguard for example, but
various upstream projects that we use may need python,
and all of them use python3, not 2
so, re-use the python variable set up by lbmk, and
set it up in PATH accordingly. this now makes the note
about python3 obsolete, on docs/build.md in lbwww.git
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'include/lib.sh')
-rw-r--r-- | include/lib.sh | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/include/lib.sh b/include/lib.sh index a9a292c2..894a2cac 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -107,10 +107,19 @@ if [ -z "${TMPDIR+x}" ]; then export TMPDIR="/tmp" export TMPDIR="$(mktemp -d -t xbmk_XXXXXXXX)" touch lock || $err "cannot create 'lock' file" - rm -Rf "$XBMK_CACHE/xbmkpath" || $err "cannot remove xbmkpath" - mkdir -p "$XBMK_CACHE/xbmkpath" || $err "cannot create xbmkpath" - export PATH="$XBMK_CACHE/xbmkpath:$PATH" || \ - $err "Can't create xbmkpath" + rm -Rf "$XBMK_CACHE/xbmkpath" "$XBMK_CACHE/gnupath" || \ + $err "cannot remove xbmkpath" + mkdir -p "$XBMK_CACHE/gnupath" "$XBMK_CACHE/xbmkpath" || \ + $err "cannot create gnupath" + export PATH="$XBMK_CACHE/xbmkpath:$XBMK_CACHE/gnupath:$PATH" || \ + $err "Can't create gnupath/xbmkpath" + ( + # set up python v3.x in PATH, in case it's not set up correctly. + # see code above that detected the correct python3 command. + cd "$XBMK_CACHE/xbmkpath" || $err "can't cd $XBMK_CACHE/xbmkpath" + ln -s "`command -v "$python"`" python || \ + $err "Can't set up python symlink in $XBMK_CACHE/xbmkpath" + ) || $err "Can't set up python symlink in $XBMK_CACHE/xbmkpath" xbmk_parent="y" fi |