changeset 334:5b67dd5ce0ba

update virtualenv before upgrading
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 18 Jun 2013 15:44:55 -0700
parents 998d3c276b25
children 5438630e118c
files .bashrc
diffstat 1 files changed, 22 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/.bashrc	Tue Jun 18 14:44:14 2013 -0700
+++ b/.bashrc	Tue Jun 18 15:44:55 2013 -0700
@@ -1,3 +1,7 @@
+#!/bin/bash
+### bash rc file ###
+
+# so
 PROFILE=/etc/profile
 if [ -e "${PROFILE}" ]
 then
@@ -337,8 +341,26 @@
 recreate-venv() {
     # recreate a virtualenv
     VIRTUALENV="virtualenv.py"
+    if ! which ${VIRTUALENV}
+    then
+        return 1
+    fi
+    VENV_PATH=$(which ${VIRTUALENV} &> /dev/null)
+
+    # update virtualenv if possible
+    DIRNAME=$(dirname ${VENV_PATH})
+    if [ -d "${DIRNAME}/.git" ]
+    then
+        cd "${DIRNAME}"
+        git pull
+        cd --
+    fi
+
+
+    # for each virtualenv given...
     for i in $@
     do
+        # ...recreate it...
         ${VIRTUALENV} --clear "${i}"
 
         SRCDIR="${i}"/src