mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-14 20:39:55 -05:00
Merge remote-tracking branch 'rbenv/master'
Using `git merge rbenv/master -s recursive -X rename-threshold=5%`. Conflicts: README.md bin/python-local-exec libexec/pyenv libexec/pyenv-help test/--version.bats
This commit is contained in:
commit
03ece82197
4 changed files with 30 additions and 22 deletions
|
@ -67,7 +67,6 @@ executables injected into your `PATH`, determines which Python version
|
|||
has been specified by your application, and passes your commands along
|
||||
to the correct Python installation.
|
||||
|
||||
|
||||
### Understanding PATH
|
||||
|
||||
When you run a command like `python` or `pip`, your operating system
|
||||
|
@ -83,7 +82,6 @@ precedence over another one at the end. In this example, the
|
|||
`/usr/local/bin` directory will be searched first, then `/usr/bin`,
|
||||
then `/bin`.
|
||||
|
||||
|
||||
### Understanding Shims
|
||||
|
||||
pyenv works by inserting a directory of _shims_ at the front of your
|
||||
|
@ -104,7 +102,6 @@ operating system will do the following:
|
|||
* Run the shim named `pip`, which in turn passes the command along to
|
||||
pyenv
|
||||
|
||||
|
||||
### Choosing the Python Version
|
||||
|
||||
When you execute a shim, pyenv determines which Python version to use by
|
||||
|
|
|
@ -36,7 +36,7 @@ resolve_link() {
|
|||
}
|
||||
|
||||
abs_dirname() {
|
||||
local cwd="$(pwd)"
|
||||
local cwd="$PWD"
|
||||
local path="$1"
|
||||
|
||||
while [ -n "$path" ]; do
|
||||
|
@ -71,10 +71,10 @@ if [ -z "${PYENV_DIR}" ]; then
|
|||
fi
|
||||
|
||||
if [ -z "${PYENV_DIR}" ]; then
|
||||
PYENV_DIR="$(pwd)"
|
||||
PYENV_DIR="$PWD"
|
||||
else
|
||||
cd "$PYENV_DIR" 2>/dev/null || abort "cannot change working directory to \`$PYENV_DIR'"
|
||||
PYENV_DIR="$(pwd)"
|
||||
PYENV_DIR="$PWD"
|
||||
cd "$OLDPWD"
|
||||
fi
|
||||
export PYENV_DIR
|
||||
|
|
|
@ -23,7 +23,8 @@ remove_from_path() {
|
|||
path_before="$result"
|
||||
result="${result//:$path_to_remove:/:}"
|
||||
done
|
||||
echo "${result%:}"
|
||||
result="${result%:}"
|
||||
echo "${result#:}"
|
||||
}
|
||||
|
||||
PYENV_COMMAND="$1"
|
||||
|
|
|
@ -59,6 +59,16 @@ create_executable() {
|
|||
assert_success "${PYENV_TEST_DIR}/bin/kill-all-humans"
|
||||
}
|
||||
|
||||
@test "doesn't include current directory in PATH search" {
|
||||
export PATH="$(path_without "kill-all-humans")"
|
||||
mkdir -p "$PYENV_TEST_DIR"
|
||||
cd "$PYENV_TEST_DIR"
|
||||
touch kill-all-humans
|
||||
chmod +x kill-all-humans
|
||||
PYENV_VERSION=system run pyenv-which kill-all-humans
|
||||
assert_failure "pyenv: kill-all-humans: command not found"
|
||||
}
|
||||
|
||||
@test "version not installed" {
|
||||
create_executable "3.4" "py.test"
|
||||
PYENV_VERSION=3.3 run pyenv-which py.test
|
||||
|
|
Loading…
Reference in a new issue