Skip to content

Instantly share code, notes, and snippets.

@cwood
Created November 5, 2013 19:46
Show Gist options
  • Save cwood/7324980 to your computer and use it in GitHub Desktop.
Save cwood/7324980 to your computer and use it in GitHub Desktop.

Revisions

  1. cwood created this gist Nov 5, 2013.
    20 changes: 20 additions & 0 deletions update-virtualenvs.zsh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    #!/bin/zsh
    autoload -U colors && colors

    if [[ -z $1 ]]; then
    read "upgradePackage?Which pacakge to upgrade? "
    else
    upgradePackage=$1
    fi

    VIRTUALENV_INSTALLS="/var/virtualenvs"
    VIRTUALENV_HOMES=(`find $VIRTUALENV_INSTALLS -maxdepth 1 -type d`)

    for virtualenv in $VIRTUALENV_HOMES; do
    if [[ -e "$virtualenv/bin/activate" ]]; then
    echo "Working on ${fg[blue]}${virtualenv}${reset_color}"
    source $virtualenv/bin/activate
    pip install --upgrade $upgradePackage
    deactivate
    fi
    done