Mercurial > hg > config
comparison .bashrc @ 334:5b67dd5ce0ba
update virtualenv before upgrading
| author | Jeff Hammel <jhammel@mozilla.com> | 
|---|---|
| date | Tue, 18 Jun 2013 15:44:55 -0700 | 
| parents | d0f91aad5f84 | 
| children | 99f8142078c7 | 
   comparison
  equal
  deleted
  inserted
  replaced
| 333:998d3c276b25 | 334:5b67dd5ce0ba | 
|---|---|
| 1 #!/bin/bash | |
| 2 ### bash rc file ### | |
| 3 | |
| 4 # so | |
| 1 PROFILE=/etc/profile | 5 PROFILE=/etc/profile | 
| 2 if [ -e "${PROFILE}" ] | 6 if [ -e "${PROFILE}" ] | 
| 3 then | 7 then | 
| 4 . "${PROFILE}" | 8 . "${PROFILE}" | 
| 5 fi | 9 fi | 
| 335 } | 339 } | 
| 336 | 340 | 
| 337 recreate-venv() { | 341 recreate-venv() { | 
| 338 # recreate a virtualenv | 342 # recreate a virtualenv | 
| 339 VIRTUALENV="virtualenv.py" | 343 VIRTUALENV="virtualenv.py" | 
| 344 if ! which ${VIRTUALENV} | |
| 345 then | |
| 346 return 1 | |
| 347 fi | |
| 348 VENV_PATH=$(which ${VIRTUALENV} &> /dev/null) | |
| 349 | |
| 350 # update virtualenv if possible | |
| 351 DIRNAME=$(dirname ${VENV_PATH}) | |
| 352 if [ -d "${DIRNAME}/.git" ] | |
| 353 then | |
| 354 cd "${DIRNAME}" | |
| 355 git pull | |
| 356 cd -- | |
| 357 fi | |
| 358 | |
| 359 | |
| 360 # for each virtualenv given... | |
| 340 for i in $@ | 361 for i in $@ | 
| 341 do | 362 do | 
| 363 # ...recreate it... | |
| 342 ${VIRTUALENV} --clear "${i}" | 364 ${VIRTUALENV} --clear "${i}" | 
| 343 | 365 | 
| 344 SRCDIR="${i}"/src | 366 SRCDIR="${i}"/src | 
| 345 if [ -d "${SRCDIR}" ] | 367 if [ -d "${SRCDIR}" ] | 
| 346 then | 368 then | 
