Allow for cases where user might've aliased some programs
The $(type -p | head -1) construct expects to always get a path, so need to ignore such aliases with -P Closes https://github.com/pyenv/pyenv/issues/1662
This commit is contained in:
parent
fdbcdd38f1
commit
ddf952ab2d
@ -29,7 +29,7 @@ if enable -f "${BASH_SOURCE%/*}"/../libexec/pyenv-realpath.dylib realpath 2>/dev
|
|||||||
else
|
else
|
||||||
[ -z "$PYENV_NATIVE_EXT" ] || abort "failed to load \`realpath' builtin"
|
[ -z "$PYENV_NATIVE_EXT" ] || abort "failed to load \`realpath' builtin"
|
||||||
|
|
||||||
READLINK=$(type -p greadlink readlink | head -1)
|
READLINK=$(type -P greadlink readlink | head -1)
|
||||||
[ -n "$READLINK" ] || abort "cannot find readlink - are you missing GNU coreutils?"
|
[ -n "$READLINK" ] || abort "cannot find readlink - are you missing GNU coreutils?"
|
||||||
|
|
||||||
resolve_link() {
|
resolve_link() {
|
||||||
|
@ -45,7 +45,7 @@ extract_initial_comment_block() {
|
|||||||
|
|
||||||
collect_documentation() {
|
collect_documentation() {
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
$(type -p gawk awk | head -1) '
|
$(type -P gawk awk | head -1) '
|
||||||
/^Summary:/ {
|
/^Summary:/ {
|
||||||
summary = substr($0, 10)
|
summary = substr($0, 10)
|
||||||
next
|
next
|
||||||
|
@ -26,7 +26,7 @@ if ! enable -f "${BASH_SOURCE%/*}"/pyenv-realpath.dylib realpath 2>/dev/null; th
|
|||||||
echo "pyenv: failed to load \`realpath' builtin" >&2
|
echo "pyenv: failed to load \`realpath' builtin" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
READLINK=$(type -p greadlink readlink | head -1)
|
READLINK=$(type -P greadlink readlink | head -1)
|
||||||
if [ -z "$READLINK" ]; then
|
if [ -z "$READLINK" ]; then
|
||||||
echo "pyenv: cannot find readlink - are you missing GNU coreutils?" >&2
|
echo "pyenv: cannot find readlink - are you missing GNU coreutils?" >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -33,7 +33,7 @@ if ! enable -f "${BASH_SOURCE%/*}"/pyenv-realpath.dylib realpath 2>/dev/null; th
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
READLINK=$(type -p greadlink readlink | head -1)
|
READLINK=$(type -P greadlink readlink | head -1)
|
||||||
if [ -z "$READLINK" ]; then
|
if [ -z "$READLINK" ]; then
|
||||||
echo "pyenv: cannot find readlink - are you missing GNU coreutils?" >&2
|
echo "pyenv: cannot find readlink - are you missing GNU coreutils?" >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -59,7 +59,7 @@ usage() {
|
|||||||
|
|
||||||
definitions() {
|
definitions() {
|
||||||
local query="$1"
|
local query="$1"
|
||||||
python-build --definitions | $(type -ap ggrep grep | head -1) -F "$query" || true
|
python-build --definitions | $(type -P ggrep grep | head -1) -F "$query" || true
|
||||||
}
|
}
|
||||||
|
|
||||||
indent() {
|
indent() {
|
||||||
|
@ -58,7 +58,7 @@ lib "$1"
|
|||||||
|
|
||||||
|
|
||||||
resolve_link() {
|
resolve_link() {
|
||||||
$(type -p greadlink readlink | head -1) "$1"
|
$(type -P greadlink readlink | head -1) "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
abs_dirname() {
|
abs_dirname() {
|
||||||
@ -1494,7 +1494,7 @@ build_package_verify_openssl() {
|
|||||||
RbConfig::CONFIG.fetch("configure_args").shellsplit.each { |arg| $stderr.puts " #{arg}" }
|
RbConfig::CONFIG.fetch("configure_args").shellsplit.each { |arg| $stderr.puts " #{arg}" }
|
||||||
exit 1
|
exit 1
|
||||||
end
|
end
|
||||||
' "$(basename "$(type -p yum apt-get | head -1)")" >&4 2>&1
|
' "$(basename "$(type -P yum apt-get | head -1)")" >&4 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
use_homebrew_zlib() {
|
use_homebrew_zlib() {
|
||||||
|
@ -89,7 +89,7 @@ install_tmp_fixture() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
resolve_link() {
|
resolve_link() {
|
||||||
$(type -p greadlink readlink | head -1) "$1"
|
$(type -P greadlink readlink | head -1) "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
run_inline_definition_with_name() {
|
run_inline_definition_with_name() {
|
||||||
|
@ -130,7 +130,7 @@ assert_output_contains() {
|
|||||||
echo "assert_output_contains needs an argument" >&2
|
echo "assert_output_contains needs an argument" >&2
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
echo "$output" | $(type -p ggrep grep | head -1) -F "$expected" >/dev/null || {
|
echo "$output" | $(type -P ggrep grep | head -1) -F "$expected" >/dev/null || {
|
||||||
{ echo "expected output to contain $expected"
|
{ echo "expected output to contain $expected"
|
||||||
echo "actual: $output"
|
echo "actual: $output"
|
||||||
} | flunk
|
} | flunk
|
||||||
|
Loading…
x
Reference in New Issue
Block a user