comparison .bashrc @ 531:42d3418e9154

.bashrc bin/setup-X.sh
author Jeff Hammel <jhammel@mozilla.com>
date Wed, 25 Sep 2013 11:54:06 -0700
parents b2ca27f83d5f
children e1aa8835edb7
comparison
equal deleted inserted replaced
530:772c61f04ccf 531:42d3418e9154
354 cd .. 354 cd ..
355 fi 355 fi
356 done 356 done
357 } 357 }
358 358
359 nearest-venv() {
360 if [[ "$#" == "0" ]]
361 then
362 directory=$PWD
363 else
364 directory=$1
365 fi
366 directory=$(python -c "import os; print os.path.abspath('${directory}')")
367
368 while [[ "${directory}" != "/" ]]
369 do
370 activate="${directory}/bin/activate"
371 if [ -e "${activate}" ]
372 then
373 echo ${directory}
374 return 0
375 fi
376
377 directory=$(dirname ${directory})
378
379 done
380 return 1
381 }
382
383 activate-nearest() {
384 nearest=$(nearest-venv)
385 activate=${nearest}/bin/activate
386 if [ -e "${activate}" ]
387 then
388 . ${activate}
389 fi
390 }
391
359 recreate-venv() { 392 recreate-venv() {
360 # recreate a virtualenv 393 # recreate a virtualenv
361 VIRTUALENV="virtualenv.py" 394 VIRTUALENV="virtualenv.py"
362 if ! which ${VIRTUALENV} 395 if ! which ${VIRTUALENV}
363 then 396 then
520 553
521 ### include overrides for commands 554 ### include overrides for commands
522 source ~/.bash_overrides 555 source ~/.bash_overrides
523 556
524 ### regenerate fluxbox menus here for convenience 557 ### regenerate fluxbox menus here for convenience
558 if type deactivate &> /dev/null
559 then
560 deactivate
561 fi
525 MENU=~/web/site/programs.html 562 MENU=~/web/site/programs.html
526 regeneratefluxmenu() { 563 regeneratefluxmenu() {
527 if [ -e $MENU ] 564 if [ -e $MENU ]
528 then 565 then
529 # XXX could be safer 566 # XXX could be safer