Created
October 6, 2012 15:30
-
-
Save bobmurder/3845222 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # ARGUMENTS | |
| # <venv> (a virtualenv name) # this is required | |
| src=$HOME/dev | |
| dest=$HOME/.venv | |
| # the virtualenv name is required | |
| if [[ $# != "2" ]]; then | |
| script=$(echo $0 | grep -oE '[[:alnum:]]+\.[[:alnum:]]+$') | |
| echo "Usage: $script <venv>" | |
| echo " <venv> argument is required." | |
| exit 1; | |
| fi | |
| # if src or dest are non-existant | |
| if [[ ! -d $src/$1 || ! -d $dest ]]; then | |
| echo "check to make sure src and dest exist" | |
| exit 1; | |
| fi | |
| # main script | |
| virtualenv --distribute $dest/$1 # make new virtualenv | |
| rm -rf $dest/$1/lib/ # delete the new lib folder | |
| mv $src/$1/lib/ $dest/$1/ # move the old lib folder | |
| rm -rf $src/$1 # delete old virtualenv | |
| : # set the return value to 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment