Przeglądaj źródła

Import recent changes from rbenv 0.4.0

pull/100/head
Yamashita Yuu 10 lat temu
rodzic
commit
8ddf8760d5
11 zmienionych plików z 74 dodań i 41 usunięć
  1. +18
    -2
      libexec/pyenv
  2. +4
    -3
      libexec/pyenv---version
  3. +8
    -4
      libexec/pyenv-exec
  4. +12
    -5
      libexec/pyenv-hooks
  5. +13
    -5
      libexec/pyenv-rehash
  6. +3
    -3
      libexec/pyenv-sh-shell
  7. +2
    -0
      libexec/pyenv-shims
  8. +2
    -8
      libexec/pyenv-version-file-read
  9. +6
    -6
      libexec/pyenv-version-name
  10. +2
    -2
      libexec/pyenv-versions
  11. +4
    -3
      libexec/pyenv-which

+ 18
- 2
libexec/pyenv Wyświetl plik

@ -1,9 +1,25 @@
#!/usr/bin/env bash
set -e
[ -n "$PYENV_DEBUG" ] && set -x
export -n CDPATH
if [ "$1" = "--debug" ]; then
export PYENV_DEBUG=1
shift
fi
if [ -n "$PYENV_DEBUG" ]; then
export PS4='+ [${BASH_SOURCE##*/}:${LINENO}] '
set -x
fi
READLINK=$(type -p greadlink readlink | head -1)
if [ -z "$READLINK" ]; then
echo "pyenv: cannot find readlink - are you missing GNU coreutils?" >&2
exit 1
fi
resolve_link() {
$(type -p greadlink readlink | head -1) "$1"
$READLINK "$1"
}
abs_dirname() {

+ 4
- 3
libexec/pyenv---version Wyświetl plik

@ -14,8 +14,9 @@ set -e
version="0.4.0-20131217"
cd "$PYENV_ROOT"
git_revision="$(git describe --tags HEAD 2>/dev/null || true)"
git_revision="${git_revision#v}"
if cd "$PYENV_ROOT" 2>/dev/null; then
git_revision="$(git describe --tags HEAD 2>/dev/null || true)"
git_revision="${git_revision#v}"
fi
echo "pyenv ${git_revision:-$version}"

+ 8
- 4
libexec/pyenv-exec Wyświetl plik

@ -7,11 +7,11 @@
# Runs an executable by first preparing PATH so that the selected Python
# version's `bin' directory is at the front.
#
# For example, if the currently selected Python version is 2.7.7:
# For example, if the currently selected Python version is 2.7.6:
# pyenv exec pip install -rrequirements.txt
#
# is equivalent to:
# PATH="$PYENV_ROOT/versions/2.7.7/bin:$PATH" pip install -rrequirements.txt
# PATH="$PYENV_ROOT/versions/2.7.6/bin:$PATH" pip install -rrequirements.txt
set -e
[ -n "$PYENV_DEBUG" ] && set -x
@ -21,7 +21,7 @@ if [ "$1" = "--complete" ]; then
exec pyenv shims --short
fi
export PYENV_VERSION="$(pyenv-version-name)"
PYENV_VERSION="$(pyenv-version-name)"
PYENV_COMMAND="$1"
if [ -z "$PYENV_COMMAND" ]; then
@ -29,10 +29,14 @@ if [ -z "$PYENV_COMMAND" ]; then
exit 1
fi
export PYENV_VERSION
PYENV_COMMAND_PATH="$(pyenv-which "$PYENV_COMMAND")"
PYENV_BIN_PATH="${PYENV_COMMAND_PATH%/*}"
for script in $(pyenv-hooks exec); do
OLDIFS="$IFS"
IFS=$'\n' scripts=(`rbenv-hooks exec`)
IFS="$OLDIFS"
for script in "${scripts[@]}"; do
source "$script"
done

+ 12
- 5
libexec/pyenv-hooks Wyświetl plik

@ -19,13 +19,18 @@ if [ -z "$PYENV_COMMAND" ]; then
exit 1
fi
READLINK=$(type -p greadlink readlink | head -1)
if [ -z "$READLINK" ]; then
echo "pyenv: cannot find readlink - are you missing GNU coreutils?" >&2
exit 1
fi
resolve_link() {
$(type -p greadlink readlink | head -1) $1
$READLINK "$1"
}
realpath() {
local cwd="$(pwd)"
local base="$(basename $1)"
local path="$1"
while [ -n "$path" ]; do
@ -34,13 +39,15 @@ realpath() {
path="$(resolve_link "$name" || true)"
done
echo "$(pwd)/$base"
echo "$(pwd)/$name"
cd "$cwd"
}
IFS=: hook_paths=($PYENV_HOOK_PATH)
shopt -s nullglob
for path in ${PYENV_HOOK_PATH//:/$'\n'}; do
for script in $path/"$PYENV_COMMAND"/*.bash; do
for path in "${hook_paths[@]}"; do
for script in "$path/$PYENV_COMMAND"/*.bash; do
echo $(realpath $script)
done
done

+ 13
- 5
libexec/pyenv-rehash Wyświetl plik

@ -17,7 +17,11 @@ mkdir -p "$SHIM_PATH"
set -o noclobber
{ echo > "$PROTOTYPE_SHIM_PATH"
} 2>/dev/null ||
{ echo "pyenv: cannot rehash: $PROTOTYPE_SHIM_PATH exists"
{ if [ -w "$SHIM_PATH" ]; then
echo "pyenv: cannot rehash: $PROTOTYPE_SHIM_PATH exists"
else
echo "pyenv: cannot rehash: $SHIM_PATH isn't writable"
fi
exit 1
} >&2
set +o noclobber
@ -78,9 +82,9 @@ remove_outdated_shims() {
# registered for installation as a shim. In this way, plugins may call
# `make_shims` with a glob to register many shims at once.
make_shims() {
local shims="$@"
local shims=("$@")
for file in $shims; do
for file in "${shims[@]}"; do
local shim="${file##*/}"
register_shim "$shim"
done
@ -92,7 +96,7 @@ registered_shims=()
registered_shims_index=""
# We will keep track of shims registered for installation with the
# global `reigstered_shims` array and with a global search index
# global `registered_shims` array and with a global search index
# string. The array will let us iterate over all registered shims. The
# index string will let us quickly check whether a shim with the given
# name has been registered or not.
@ -140,7 +144,11 @@ make_shims ../versions/*/bin/*
cd "$OLDPWD"
# Allow plugins to register shims.
for script in $(pyenv-hooks rehash); do
OLDIFS="$IFS"
IFS=$'\n' scripts=(`pyenv-hooks rehash`)
IFS="$OLDIFS"
for script in "${scripts[@]}"; do
source "$script"
done

+ 3
- 3
libexec/pyenv-sh-shell Wyświetl plik

@ -51,14 +51,14 @@ fi
# Make sure the specified version is installed.
if pyenv-prefix "${versions[@]}" >/dev/null; then
OLDIFS="$IFS"
IFS=: PYENV_VERSION="${versions[*]}"
IFS=: version="${versions[*]}"
IFS="$OLDIFS"
case "$shell" in
fish )
echo "setenv PYENV_VERSION \"${PYENV_VERSION}\""
echo "setenv PYENV_VERSION \"${version}\""
;;
* )
echo "export PYENV_VERSION=\"${PYENV_VERSION}\""
echo "export PYENV_VERSION=\"${version}\""
;;
esac
else

+ 2
- 0
libexec/pyenv-shims Wyświetl plik

@ -11,6 +11,8 @@ if [ "$1" = "--complete" ]; then
exit
fi
shopt -s nullglob
for command in "${PYENV_ROOT}/shims/"*; do
if [ "$1" = "--short" ]; then
echo "${command##*/}"

+ 2
- 8
libexec/pyenv-version-file-read Wyświetl plik

@ -8,14 +8,8 @@ VERSION_FILE="$1"
if [ -e "$VERSION_FILE" ]; then
# Read the first non-whitespace word from the specified version file.
# Be careful not to load it whole in case there's something crazy in it.
versions=()
while read -a words; do
word="${words[0]}"
if [ -n "$word" ]; then
length="${#versions[@]}"
versions=("${versions[@]}" "$word")
fi
done < <( cat "$VERSION_FILE" && echo )
words=( $(cut -b 1-1024 "$VERSION_FILE") )
versions=("${words[@]}")
if [ -n "$versions" ]; then
OLDIFS="$IFS"

+ 6
- 6
libexec/pyenv-version-name Wyświetl plik

@ -3,20 +3,20 @@
set -e
[ -n "$PYENV_DEBUG" ] && set -x
if [ -n "$PYENV_VERSION" ]; then
OLDIFS="$IFS"
IFS=: versions=($(echo "${PYENV_VERSION}"))
IFS="$IFS"
else
if [ -z "$PYENV_VERSION" ]; then
PYENV_VERSION_FILE="$(pyenv-version-file)"
OLDIFS="$IFS"
IFS=: versions=($(pyenv-version-file-read "$PYENV_VERSION_FILE" || true))
IFS=: PYENV_VERSION="${versions[*]}"
IFS="$OLDIFS"
export PYENV_VERSION
else
OLDIFS="$IFS"
IFS=: versions=($(echo "${PYENV_VERSION}"))
IFS="$IFS"
fi
if [ -z "$versions" ]; then
if [ -z "$versions" ] || [ "$versions" = "system" ]; then
echo "system"
exit
fi

+ 2
- 2
libexec/pyenv-versions Wyświetl plik

@ -34,9 +34,9 @@ array_exists() {
print_version() {
if array_exists "$1" "${current_versions[@]}"; then
echo "${hit_prefix}${1}${version_origin}"
echo "${hit_prefix}$1${version_origin}"
else
echo "${miss_prefix}${1}"
echo "${miss_prefix}$1"
fi
}

+ 4
- 3
libexec/pyenv-which Wyświetl plik

@ -36,9 +36,7 @@ remove_from_path() {
fi
local paths
OLDIFS="$IFS"
IFS=: paths=($PATH)
IFS="$OLDIFS"
for path in "${paths[@]}"; do
path="$(expand_path "$path" || true)"
@ -73,7 +71,10 @@ for version in "${versions[@]}"; do
fi
done
for script in $(pyenv-hooks which); do
OLDIFS="$IFS"
IFS=$'\n' scripts=(`pyenv-hooks which`)
IFS="$OLDIFS"
for script in "${scripts[@]}"; do
source "$script"
done

Ładowanie…
Anuluj
Zapisz