Skip to content

Instantly share code, notes, and snippets.

@elgertam
Forked from jedie/install_pipsi.sh
Created October 29, 2017 05:02
Show Gist options
  • Save elgertam/2d50ea280d2395dd2bbedbb169c59d2e to your computer and use it in GitHub Desktop.
Save elgertam/2d50ea280d2395dd2bbedbb169c59d2e to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# https://github.com/mitsuhiko/pipsi
BOOTSTRAP_DIR=~/.local/venvs/__bootstrap
BOOTSTRAP_PKGS=$(cat <<EOF
virtualenv
EOF
)
CMD=pipsi
VENV_DIR=~/.local/venvs/pipsi
BIN_DIR=~/.local/bin
PACKAGES=$(cat <<EOF
-e git+https://github.com/mitsuhiko/pipsi.git#egg=pipsi
EOF
)
set -e
(
echo 'Create the bootstrapping virtualenv w/ python 3'"'"'s `venv`'
set -x
/usr/bin/env python -m venv "${BOOTSTRAP_DIR}"
)
(
echo 'Activate bootstrapping virtualenv'
cd "${BOOTSTRAP_DIR}/bin/"
source ./activate # sourced with path prefix for pyenv compatibility
set -x
echo 'Install `virtualenv` into bootstrapping virtualenv'
"${BOOTSTRAP_DIR}/bin/pip" install -U pip
"${BOOTSTRAP_DIR}/bin/pip" install ${BOOTSTRAP_PKGS}
echo 'Create pipsi virtualenv w/ `virtualenv`'
virtualenv --python=python3 "${VENV_DIR}"
)
(
echo 'Activate pipsi virtualenv'
cd "${VENV_DIR}/bin/"
source ./activate
set -x
echo 'Install `pipsi` and `virtualenv`'
"${VENV_DIR}/bin/pip" install -U pip
"${VENV_DIR}/bin/pip" install ${BOOTSTRAP_PKGS}
"${VENV_DIR}/bin/pip" install ${PACKAGES}
mkdir -p "${BIN_DIR}"
ln -s "${VENV_DIR}/bin/${CMD}" "${BIN_DIR}/"
)
(
set -x
echo 'Clean up bootstrapping virtualenv'
rm -rf "${BOOTSTRAP_DIR}"
)
${CMD} --version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment