Fix inverted condition for --altinstall of ensurepip (#255)

This commit is contained in:
Yamashita Yuu 2015-05-27 00:49:23 +09:00
parent fe934642c5
commit ed684c239c
2 changed files with 40 additions and 2 deletions

View file

@ -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() {

View file

@ -159,3 +159,39 @@ OUT
unstub make
}
@test "ensurepip without altinstall" {
mkdir -p "${INSTALL_ROOT}/bin"
cat <<OUT > "${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 <<OUT
build_package_ensurepip
OUT
assert_success
assert_build_log <<OUT
python -m ensurepip
OUT
}
@test "ensurepip with altinstall" {
mkdir -p "${INSTALL_ROOT}/bin"
cat <<OUT > "${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 <<OUT
build_package_ensurepip
OUT
assert_success
assert_build_log <<OUT
python -m ensurepip --altinstall
OUT
}