diff bin/venvit.sh @ 52:ac08d765aa32

allow cloning from hg instead of just svn
author Jeff Hammel <k0scist@gmail.com>
date Sun, 28 Mar 2010 16:38:51 -0400
parents f3ab51c79813
children 6463a7e37c45
line wrap: on
line diff
--- a/bin/venvit.sh	Sun Mar 28 16:06:50 2010 -0400
+++ b/bin/venvit.sh	Sun Mar 28 16:38:51 2010 -0400
@@ -1,28 +1,35 @@
 #!/bin/bash
+# make a virtualenv for the product
 
+# usage
 if (( $# != 1 ))
 then
-    echo "Usage: $0 <svn-location>"
+    echo "Usage: $0 <svn-or-hg-location>"
     exit 0
 fi
 
+# determine name of the package
 NAME=$1
-
 for i in /trunk /branches /tag
 do
     NAME=${NAME%%$i*}
 done
 NAME=${NAME##*/}
 
-#echo $NAME
+if svn info $1 2> /dev/null
+then
+    CHECKOUT="svn co"
+else
+    CHECKOUT="hg clone"
+fi
 
+# create a virtualenv and install the software
 VIRTUAL_ENV_LOCATION="${HOME}/virtualenv/virtualenv.py"
-
 python ${VIRTUAL_ENV_LOCATION} ${NAME}
 cd ${NAME}
 source bin/activate
 mkdir src/
 cd src/
-svn co $1 ${NAME}
+$CHECKOUT $1 ${NAME}
 cd ${NAME}
 python setup.py develop