1 Commits

Author SHA1 Message Date
Yamashita Yuu
4d527c51e3 v20131216 2013-12-16 13:57:25 +09:00
3 changed files with 36 additions and 78 deletions

View File

@@ -18,13 +18,9 @@ Installing pyenv-virtualenv as a pyenv plugin will give you access to the
$ git clone git://github.com/yyuu/pyenv-virtualenv.git ~/.pyenv/plugins/pyenv-virtualenv
This will install the latest development version of pyenv-virtualenv into
the `~/.pyenv/plugins/pyenv-virtualenv` directory.
**Important note:** If you installed pyenv into a non-standard directory, make sure that you clone this
repo into the 'plugins' directory of wherever you installed into.
From inside that directory you can:
- Check out a specific release tag.
- Get the latest development release by running `git pull` to download the latest changes.
the `~/.pyenv/plugins/pyenv-virtualenv` directory. From that directory, you
can check out a specific release tag. To update pyenv-virtualenv, run `git
pull` to download the latest changes.
### Installing with Homebrew (for OS X users)
@@ -48,13 +44,13 @@ Or, if you would like to install the latest development release:
### Using `pyenv virtualenv` with pyenv
To create a virtualenv for the Python version use with pyenv, run
`pyenv virtualenv`, specifying the Python version you want and the name
of the virtualenv directory. For example,
`pyenv virtualenv` with tha exact name of the version you want to create
virtualenv. For example,
$ pyenv virtualenv 2.7.6 my-virtual-env-2.7.6
$ pyenv virtualenv 2.7.5 venv27
will create a virtualenv based on Python 2.7.6
under `~/.pyenv/versions` in a folder called `my-virtual-env-2.7.6`.
virtualenvs will be created into a directory of the same name
under `~/.pyenv/versions`.
### Create virtualenv from current version
@@ -64,7 +60,7 @@ virtualenv will be created with given name based on current
version.
$ pyenv version
3.3.3 (set by /home/yyuu/.pyenv/version)
3.3.2 (set by /home/yyuu/.pyenv/version)
$ pyenv virtualenv venv33
@@ -74,8 +70,8 @@ version.
$ pyenv shell venv27
$ pyenv virtualenvs
* venv27 (created from /home/yyuu/.pyenv/versions/2.7.6)
venv33 (created from /home/yyuu/.pyenv/versions/3.3.3)
* venv27 (created from /home/yyuu/.pyenv/versions/2.7.5)
venv33 (created from /home/yyuu/.pyenv/versions/3.3.2)
### Special environment variables
@@ -87,8 +83,6 @@ You can set certain environment variables to control the pyenv-virtualenv.
* `VIRTUALENV_VERSION`, if set, forces pyenv-virtualenv to install desired
version of virtualenv. If the virtualenv has not been installed,
pyenv-virtualenv will try to install the given version of virtualenv.
* `EZ_SETUP` and `GET_PIP`, if set and pyvenv is preferred than virtualenv,
use `ez_setup.py` and `get_pip.py` at specified location.
* `EZ_SETUP_URL` and `GET_PIP_URL`, if set and pyvenv is preferred
than virtualenv, download `ez_setup.py` and `get_pip.py` from specified URL.
* `SETUPTOOLS_VERSION` and `PIP_VERSION`, if set and pyvenv is preferred
@@ -97,15 +91,6 @@ You can set certain environment variables to control the pyenv-virtualenv.
## Version History
#### 20140110.1
* Fix install script
#### 20140110
* Support environment variables of `EZ_SETUP` and `GET_PIP`.
* Support a short option `-p` of `virtualenv`.
#### 20131216
* Use latest release of setuptools and pip if the version not given via environment variables.

View File

@@ -11,7 +11,7 @@
# -f/--force Install even if the version appears to be installed already
#
PYENV_VIRTUALENV_VERSION="20140110.1"
PYENV_VIRTUALENV_VERSION="20131216"
set -e
[ -n "$PYENV_DEBUG" ] && set -x
@@ -128,44 +128,6 @@ venv() {
fi
}
install_setuptools() {
local version="$1"
{ if [ "${EZ_SETUP+defined}" ] && [ -f "${EZ_SETUP}" ]; then
echo "Installing setuptools from ${EZ_SETUP}..." 1>&2
cat "${EZ_SETUP}"
else
[ -n "${EZ_SETUP_URL}" ] || {
if [ -n "${SETUPTOOLS_VERSION}" ]; then
EZ_SETUP_URL="https://bitbucket.org/pypa/setuptools/raw/${SETUPTOOLS_VERSION}/ez_setup.py"
else
EZ_SETUP_URL="https://bitbucket.org/pypa/setuptools/downloads/ez_setup.py"
fi
}
echo "Installing setuptools from ${EZ_SETUP_URL}..." 1>&2
http get "${EZ_SETUP_URL}"
fi
} | PYENV_VERSION="${version}" pyenv-exec python
}
install_pip() {
local version="$1"
{ if [ "${GET_PIP+defined}" ] && [ -f "${GET_PIP}" ]; then
echo "Installing pip from ${GET_PIP}..." 1>&2
cat "${GET_PIP}"
else
[ -n "${GET_PIP_URL}" ] || {
if [ -n "${PIP_VERSION}" ]; then
GET_PIP_URL="https://raw.github.com/pypa/pip/${PIP_VERSION}/contrib/get-pip.py"
else
GET_PIP_URL="https://raw.github.com/pypa/pip/master/contrib/get-pip.py"
fi
}
echo "Installing pip from ${GET_PIP_URL}..." 1>&2
http get "${GET_PIP_URL}"
fi
} | PYENV_VERSION="${version}" pyenv-exec python
}
PYENV_VIRTUALENV_ROOT="$(abs_dirname "$0")/.."
if [ -z "${PYENV_VIRTUALENV_CACHE_PATH}" ]; then
PYENV_VIRTUALENV_CACHE_PATH="${PYTHON_BUILD_CACHE_PATH:-${PYENV_ROOT}/cache}"
@@ -186,10 +148,6 @@ for option in "${OPTIONS[@]}"; do
"h" | "help" )
usage 0
;;
"p" )
VIRTUALENV_OPTIONS[${#VIRTUALENV_OPTIONS[*]}]="--python=${ARGUMENTS[0]}"
ARGUMENTS=("${ARGUMENTS[@]:1}") # shift 1
;;
"q" | "quiet" )
QUIET="--quiet"
;;
@@ -325,12 +283,28 @@ mkdir -p "${PYENV_VIRTUALENV_CACHE_PATH}"
cd "${PYENV_VIRTUALENV_CACHE_PATH}"
venv $QUIET $VERBOSE "${VIRTUALENV_OPTIONS[@]}" "${VIRTUALENV_PATH}" && {
if virtualenv_is_pyvenv; then
[ -n "${EZ_SETUP_URL}" ] || {
if [ -n "${SETUPTOOLS_VERSION}" ]; then
EZ_SETUP_URL="https://bitbucket.org/pypa/setuptools/raw/${SETUPTOOLS_VERSION}/ez_setup.py"
else
EZ_SETUP_URL="https://bitbucket.org/pypa/setuptools/downloads/ez_setup.py"
fi
}
PYENV_VERSION="${VIRTUALENV_NAME}" pyenv-exec python -c 'import setuptools' 1>/dev/null 2>&1 || {
install_setuptools "${VIRTUALENV_NAME}" 1>&2
echo "Installing setuptools from ${EZ_SETUP_URL}..." 1>&2
http get "${EZ_SETUP_URL}" | PYENV_VERSION="${VIRTUALENV_NAME}" pyenv-exec python
}
[ -n "${GET_PIP_URL}" ] || {
if [ -n "${PIP_VERSION}" ]; then
GET_PIP_URL="https://raw.github.com/pypa/pip/${PIP_VERSION}/contrib/get-pip.py"
else
GET_PIP_URL="https://raw.github.com/pypa/pip/master/contrib/get-pip.py"
fi
}
PYENV_VERSION="${VIRTUALENV_NAME}" pyenv-which pip 1>/dev/null 2>&1 || {
install_pip "${VIRTUALENV_NAME}" 1>&2
echo "Installing pip from ${GET_PIP_URL}..." 1>&2
http get "${GET_PIP_URL}" | PYENV_VERSION="${VIRTUALENV_NAME}" pyenv-exec python
}
fi
} || STATUS="$?"

View File

@@ -1,18 +1,17 @@
#!/bin/sh
# Usage: PREFIX=/usr/local ./install.sh
#
# Installs pyenv-virtualenv under $PREFIX.
set -e
cd "$(dirname "$0")"
if [ -z "${PREFIX}" ]; then
PREFIX="/usr/local"
fi
BIN_PATH="${PREFIX}/bin"
mkdir -p "$BIN_PATH"
mkdir -p "${BIN_PATH}"
install -p bin/* "$BIN_PATH"
for file in bin/*; do
cp "${file}" "${BIN_PATH}"
done
echo "Installed pyenv-virtualenv at ${PREFIX}"