mirror of
https://github.com/pyenv/pyenv-virtualenv.git
synced 2025-11-08 11:33:55 -05:00
workaround for pyvenv --system-site-packages (#62)
This commit is contained in:
@@ -6,10 +6,22 @@
|
||||
if [ ! -x "${PYENV_COMMAND_PATH}" ]; then
|
||||
virtualenv_prefix="$(pyenv-virtualenv-prefix 2>/dev/null || true)"
|
||||
if [ -d "${virtualenv_prefix}" ]; then
|
||||
shopt -s nullglob
|
||||
no_global_site_packages="$(echo "$(pyenv-prefix)/lib/"*"/no-global-site-packages.txt")"
|
||||
shopt -u nullglob
|
||||
if [ ! -f "${no_global_site_packages}" ]; then
|
||||
unset include_system_site_packages
|
||||
if [ -f "$(pyenv-prefix)/pyvenv.cfg" ]; then
|
||||
# pyvenv
|
||||
if grep -q -i "include-system-site-packages *= *true" "$(pyenv-prefix)/pyvenv.cfg" 1>/dev/null 2>&1; then
|
||||
include_system_site_packages=1
|
||||
fi
|
||||
else
|
||||
# virtualenv
|
||||
shopt -s nullglob
|
||||
no_global_site_packages="$(echo "$(pyenv-prefix)/lib/"*"/no-global-site-packages.txt")"
|
||||
shopt -u nullglob
|
||||
if [ ! -f "${no_global_site_packages}" ]; then
|
||||
include_system_site_packages=1
|
||||
fi
|
||||
fi
|
||||
if [ -n "${include_system_site_packages}" ]; then
|
||||
# virtualenv is created with `--system-site-packages`
|
||||
virtualenv_command_path="${virtualenv_prefix}/bin/${PYENV_COMMAND_PATH##*/}"
|
||||
if [ -x "${virtualenv_command_path}" ]; then
|
||||
|
||||
Reference in New Issue
Block a user