Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
oh-my-zsh
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
github
oh-my-zsh
Commits
8efcf277
Commit
8efcf277
authored
Apr 22, 2018
by
Terrance Kennedy
Committed by
Marc Cornellà
Apr 22, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pyenv plugin refactor (8x faster) (#6165)
* Refactor pyenv plugin to use PATH
parent
897a7da6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
47 deletions
+14
-47
pyenv.plugin.zsh
plugins/pyenv/pyenv.plugin.zsh
+14
-47
No files found.
plugins/pyenv/pyenv.plugin.zsh
View file @
8efcf277
_homebrew-installed
()
{
# This plugin loads pyenv into the current shell and provides prompt info via
type
brew &> /dev/null
# the 'pyenv_prompt_info' function. Also loads pyenv-virtualenv if available.
}
_pyenv-from-homebrew-installed
()
{
if
((
$+
commands[pyenv]
))
;
then
brew
--prefix
pyenv &> /dev/null
eval
"
$(
pyenv init - zsh
)
"
}
if
((
$+
commands[pyenv-virtualenv-init]
))
;
then
eval
"
$(
pyenv virtualenv-init - zsh
)
"
FOUND_PYENV
=
0
pyenvdirs
=(
"
$HOME
/.pyenv"
"/usr/local/pyenv"
"/opt/pyenv"
)
for
pyenvdir
in
"
${
pyenvdirs
[@]
}
"
;
do
if
[
-d
$pyenvdir
/bin
-a
$FOUND_PYENV
-eq
0
]
;
then
FOUND_PYENV
=
1
export
PYENV_ROOT
=
$pyenvdir
export
PATH
=
${
pyenvdir
}
/bin:
$PATH
eval
"
$(
pyenv init - zsh
)
"
if
pyenv commands |
command grep
-q
virtualenv-init
;
then
eval
"
$(
pyenv virtualenv-init - zsh
)
"
fi
function
pyenv_prompt_info
()
{
echo
"
$(
pyenv version-name
)
"
}
fi
done
unset
pyenvdir
if
[
$FOUND_PYENV
-eq
0
]
;
then
pyenvdir
=
$(
brew
--prefix
pyenv 2> /dev/null
)
if
[
$?
-eq
0
-a
-d
$pyenvdir
/bin
]
;
then
FOUND_PYENV
=
1
export
PYENV_ROOT
=
$pyenvdir
export
PATH
=
${
pyenvdir
}
/bin:
$PATH
eval
"
$(
pyenv init - zsh
)
"
if
pyenv commands |
command grep
-q
virtualenv-init
;
then
eval
"
$(
pyenv virtualenv-init - zsh
)
"
fi
function
pyenv_prompt_info
()
{
echo
"
$(
pyenv version-name
)
"
}
fi
fi
fi
function
pyenv_prompt_info
()
{
echo
"
$(
pyenv version-name
)
"
if
[
$FOUND_PYENV
-eq
0
]
;
then
}
function
pyenv_prompt_info
()
{
echo
"system:
$(
python
-V
2>&1 |
cut
-f
2
-d
' '
)
"
}
else
# fallback to system python
function
pyenv_prompt_info
()
{
echo
"system:
$(
python
-V
2>&1 |
cut
-f
2
-d
' '
)
"
}
fi
fi
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment