Skip to contentSkip to conversation

b4.sh: keep existing PYTHONPATH if set

PATCH Applied Dominique Martinet 2 participants 2 messages Apr 2, 2023 – May 26, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 b4.sh: keep existing PYTHONPATH if set

for setups depending on PYTHONPATH being set to provide dependencies e.g. requests, b4.sh overriding of the variable is too strong.

Set current directory and patatt's first but keep PYTHONPATH if it was not empty.

While we are here, remove useless use of env: the shell does the job just fine if the variable is set before exec

---
 b4.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
b4.sh +2 -1
index 10d33b740d5e..bd7e587151f2 100755
@@ -6,4 +6,5 @@
 REAL_SCRIPT=$(realpath -e ${BASH_SOURCE[0]})
 SCRIPT_TOP="${SCRIPT_TOP:-$(dirname ${REAL_SCRIPT})}"
 
-exec env PYTHONPATH="${SCRIPT_TOP}:${SCRIPT_TOP}/patatt" python3 "${SCRIPT_TOP}/b4/command.py" "${@}"
+PYTHONPATH="${SCRIPT_TOP}:${SCRIPT_TOP}/patatt${PYTHONPATH:+:$PYTHONPATH}" \
+	exec python3 "${SCRIPT_TOP}/b4/command.py" "${@}"

---
base-commit: 00303592f25693cb4eddf58fb51063afcff8dceb
change-id: 20230402-wrapper-keep-pythonpath-cbac5c0cc618

Best regards,

Signature · 1 line
Dominique Martinet | Asmadeus
#1 lore raw
Quoted 10 lines · Dominique Martinet

for setups depending on PYTHONPATH being set to provide dependencies e.g. requests, b4.sh overriding of the variable is too strong.

Set current directory and patatt's first but keep PYTHONPATH if it was not empty.

While we are here, remove useless use of env: the shell does the job just fine if the variable is set before exec

[...]

Applied, thanks!

[1/1] b4.sh: keep existing PYTHONPATH if set

      commit: bf2bb043b60cd8907f144a2d646c799c882ec711

Best regards,

Signature · 1 line
Konstantin Ryabitsev <[email protected]>