Respect PULUMI_PYTHON_CMD in scripts (#5782)

If `PULUMI_PYTHON_CMD` is set, use it instead of running `python` directly.
This commit is contained in:
Justin Van Patten 2020-11-18 19:08:41 -08:00 committed by GitHub
parent 2b435bb1a7
commit 4c88e215ce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 23 additions and 11 deletions

View file

@ -2,7 +2,9 @@ CHANGELOG
=========
## HEAD (Unreleased)
_(none)_
- Respect PULUMI_PYTHON_CMD in scripts.
[#5782](https://github.com/pulumi/pulumi/pull/5782)
## 2.14.0 (2020-11-18)

View file

@ -47,6 +47,6 @@ if [ -n "${virtualenv:-}" ] ; then
exit 1
fi
else
# Otherwise, just run python3.
python3 -u -m pulumi.policy "$1" "$2"
# Otherwise, run either PULUMI_PYTHON_CMD (if set) or python3.
"${PULUMI_PYTHON_CMD:-python3}" -u -m pulumi.policy "$1" "$2"
fi

View file

@ -37,7 +37,12 @@ if defined pulumi_runtime_python_virtualenv (
exit 1
)
) else (
REM Otherwise, just run python. We use `python` instead of `python3` because Windows
REM Python installers install only `python.exe` by default.
@python -u -m pulumi.policy %pulumi_policy_python_engine_address% %pulumi_policy_python_program%
if defined PULUMI_PYTHON_CMD (
REM If PULUMI_PYTHON_CMD is defined, run it.
"%PULUMI_PYTHON_CMD%" -u -m pulumi.policy %pulumi_policy_python_engine_address% %pulumi_policy_python_program%
) else (
REM Otherwise, just run python. We use `python` instead of `python3` because Windows
REM Python installers install only `python.exe` by default.
@python -u -m pulumi.policy %pulumi_policy_python_engine_address% %pulumi_policy_python_program%
)
)

View file

@ -35,6 +35,6 @@ if [ -n "${PULUMI_RUNTIME_VIRTUALENV:-}" ] ; then
exit 1
fi
else
# Otherwise, just run python3.
python3 -u -m pulumi.dynamic $@
# Otherwise, run either PULUMI_PYTHON_CMD (if set) or python3.
"${PULUMI_PYTHON_CMD:-python3}" -u -m pulumi.dynamic $@
fi

View file

@ -20,7 +20,12 @@ if defined PULUMI_RUNTIME_VIRTUALENV (
exit 1
)
) else (
REM Otherwise, just run python. We use `python` instead of `python3` because Windows
REM Python installers install only `python.exe` by default.
@python -u -m pulumi.dynamic %*
if defined PULUMI_PYTHON_CMD (
REM If PULUMI_PYTHON_CMD is defined, run it.
"%PULUMI_PYTHON_CMD%" -u -m pulumi.dynamic %*
) else (
REM Otherwise, just run python. We use `python` instead of `python3` because Windows
REM Python installers install only `python.exe` by default.
@python -u -m pulumi.dynamic %*
)
)