diff --git a/plugins/python-build/bin/python-build b/plugins/python-build/bin/python-build index d956f2bb..63b98510 100755 --- a/plugins/python-build/bin/python-build +++ b/plugins/python-build/bin/python-build @@ -1528,10 +1528,12 @@ build_package_get_pip() { build_package_ensurepip() { local ensurepip_opts - if [[ "$PYTHON_MAKE_INSTALL_TARGET" != *"altinstall"* ]]; then + # Install as `--altinstall` if the Python is installed as `altinstall` (#255) + if [[ "$PYTHON_MAKE_INSTALL_TARGET" == *"altinstall"* ]]; then ensurepip_opts="--altinstall" fi - "$PYTHON_BIN" -m ensurepip $ensurepip_opts 1>/dev/null 2>&1 || build_package_get_pip "$@" || return 1 + # FIXME: `--altinstall` with `get-pip.py` + "$PYTHON_BIN" -m ensurepip ${ensurepip_opts} 1>/dev/null 2>&1 || build_package_get_pip "$@" || return 1 } version() { diff --git a/plugins/python-build/test/pyenv_ext.bats b/plugins/python-build/test/pyenv_ext.bats index ae84c231..e565d705 100644 --- a/plugins/python-build/test/pyenv_ext.bats +++ b/plugins/python-build/test/pyenv_ext.bats @@ -159,3 +159,39 @@ OUT unstub make } + +@test "ensurepip without altinstall" { + mkdir -p "${INSTALL_ROOT}/bin" + cat < "${INSTALL_ROOT}/bin/python" +#!$BASH +echo "python \$@" >> "${INSTALL_ROOT}/build.log" +OUT + chmod +x "${INSTALL_ROOT}/bin/python" + + PYTHON_MAKE_INSTALL_TARGET="" TMPDIR="$TMP" run_inline_definition < "${INSTALL_ROOT}/bin/python" +#!$BASH +echo "python \$@" >> "${INSTALL_ROOT}/build.log" +OUT + chmod +x "${INSTALL_ROOT}/bin/python" + + PYTHON_MAKE_INSTALL_TARGET="altinstall" TMPDIR="$TMP" run_inline_definition <